From aed5f4d65d2dbfda2c98abd7eb371751016838ab Mon Sep 17 00:00:00 2001 From: Kim Reenberg Date: Wed, 17 Jan 2024 07:29:01 +0100 Subject: [PATCH] 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 Co-authored-by: Robo --- resources/server/bin/helpers/check-requirements-linux.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/server/bin/helpers/check-requirements-linux.sh b/resources/server/bin/helpers/check-requirements-linux.sh index 625b569602a..c3d3d8ece6a 100644 --- a/resources/server/bin/helpers/check-requirements-linux.sh +++ b/resources/server/bin/helpers/check-requirements-linux.sh @@ -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