fix: fallback to strings for non-executable libc.so.6 (#202581)

* fix: fallback to strings for non-executable libc.so.6

* chore: use cat over strings

---------

Co-authored-by: khreenberg <unknown>
Co-authored-by: Robo <hop2deep@gmail.com>
This commit is contained in:
Kim Reenberg 2024-01-17 07:29:01 +01:00 committed by GitHub
parent 70348b0a63
commit aed5f4d65d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -81,7 +81,13 @@ if [ -n "$(ldd --version | grep -v musl)" ]; then
# Rather than trusting the output of ldd --version (which is not always accurate)
# we instead use the version of the cached libc.so.6 file itself.
libc_real_path=$(readlink -f "$libc_path")
libc_version=$($libc_real_path --version | sed -n 's/.*stable release version \([0-9]\+\.[0-9]\+\).*/\1/p')
if [ -x "$libc_real_path" ]; then
# get version from executable
libc_version=$($libc_real_path --version | sed -n 's/.*stable release version \([0-9]\+\.[0-9]\+\).*/\1/p')
else
# .so is not executable on this host; try getting from strings
libc_version=$(cat "$libc_real_path" | sed -n 's/.*stable release version \([0-9]\+\.[0-9]\+\).*/\1/p')
fi
if [ "$(printf '%s\n' "2.28" "$libc_version" | sort -V | head -n1)" = "2.28" ]; then
found_required_glibc=1
else