fix: avoid using libc as an executable test (#202680)

This commit is contained in:
Robo 2024-01-18 04:26:54 +09:00 committed by GitHub
parent 2e3df8a8b1
commit fe7233fdfb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -81,13 +81,7 @@ 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")
if [ -x "$libc_real_path" ]; then
# get version from executable
libc_version=$($libc_real_path --version | sed -n 's/.*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/.*release version \([0-9]\+\.[0-9]\+\).*/\1/p')
fi
libc_version=$(cat "$libc_real_path" | sed -n 's/.*release version \([0-9]\+\.[0-9]\+\).*/\1/p')
if [ "$(printf '%s\n' "2.28" "$libc_version" | sort -V | head -n1)" = "2.28" ]; then
found_required_glibc=1
else