Skip to content

Commit aed5f4d

Browse files
fix: fallback to strings for non-executable libc.so.6 (microsoft#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 <[email protected]>
1 parent 70348b0 commit aed5f4d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

resources/server/bin/helpers/check-requirements-linux.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@ if [ -n "$(ldd --version | grep -v musl)" ]; then
8181
# Rather than trusting the output of ldd --version (which is not always accurate)
8282
# we instead use the version of the cached libc.so.6 file itself.
8383
libc_real_path=$(readlink -f "$libc_path")
84-
libc_version=$($libc_real_path --version | sed -n 's/.*stable release version \([0-9]\+\.[0-9]\+\).*/\1/p')
84+
if [ -x "$libc_real_path" ]; then
85+
# get version from executable
86+
libc_version=$($libc_real_path --version | sed -n 's/.*stable release version \([0-9]\+\.[0-9]\+\).*/\1/p')
87+
else
88+
# .so is not executable on this host; try getting from strings
89+
libc_version=$(cat "$libc_real_path" | sed -n 's/.*stable release version \([0-9]\+\.[0-9]\+\).*/\1/p')
90+
fi
8591
if [ "$(printf '%s\n' "2.28" "$libc_version" | sort -V | head -n1)" = "2.28" ]; then
8692
found_required_glibc=1
8793
else

0 commit comments

Comments
 (0)