@@ -53,7 +53,7 @@ if [ "$OS_ID" != "alpine" ]; then
5353 libstdcpp_paths=$( /sbin/ldconfig -p | grep ' libstdc++.so.6' )
5454
5555 if [ " $( echo " $libstdcpp_paths " | wc -l) " -gt 1 ]; then
56- libstdcpp_path=$( echo " $libstdcpp_paths " | grep " $LDCONFIG_ARCH " | awk ' {print $NF}' | head -n1 )
56+ libstdcpp_path=$( echo " $libstdcpp_paths " | grep " $LDCONFIG_ARCH " | awk ' {print $NF}' )
5757 else
5858 libstdcpp_path=$( echo " $libstdcpp_paths " | awk ' {print $NF}' )
5959 fi
@@ -72,18 +72,22 @@ if [ -z "$libstdcpp_path" ]; then
7272 fi
7373fi
7474
75- if [ -n " $libstdcpp_path " ]; then
75+ while [ -n " $libstdcpp_path " ]; do
7676 # Extracts the version number from the path, e.g. libstdc++.so.6.0.22 -> 6.0.22
7777 # which is then compared based on the fact that release versioning and symbol versioning
7878 # are aligned for libstdc++. Refs https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html
7979 # (i-e) GLIBCXX_3.4.<release> is provided by libstdc++.so.6.y.<release>
80- libstdcpp_real_path=$( readlink -f " $libstdcpp_path " )
80+ libstdcpp_path_line=$( echo " $libstdcpp_path " | head -n1)
81+ libstdcpp_real_path=$( readlink -f " $libstdcpp_path_line " )
8182 libstdcpp_version=$( echo " $libstdcpp_real_path " | awk -F' \\.so\\.' ' {print $NF}' )
8283 if [ " $( printf ' %s\n' " 6.0.25" " $libstdcpp_version " | sort -V | head -n1) " = " 6.0.25" ]; then
8384 found_required_glibcxx=1
84- else
85- echo " Warning: Missing GLIBCXX >= 3.4.25! from $libstdcpp_real_path "
85+ break
8686 fi
87+ libstdcpp_path=$( echo " $libstdcpp_path " | tail -n +2) # remove first line
88+ done
89+ if [ " $found_required_glibcxx " = " 0" ]; then
90+ echo " Warning: Missing GLIBCXX >= 3.4.25! from $libstdcpp_real_path "
8791fi
8892
8993if [ " $OS_ID " = " alpine" ]; then
@@ -105,7 +109,7 @@ elif [ -z "$(ldd --version 2>&1 | grep 'musl libc')" ]; then
105109 libc_paths=$( /sbin/ldconfig -p | grep ' libc.so.6' )
106110
107111 if [ " $( echo " $libc_paths " | wc -l) " -gt 1 ]; then
108- libc_path=$( echo " $libc_paths " | grep " $LDCONFIG_ARCH " | awk ' {print $NF}' | head -n1 )
112+ libc_path=$( echo " $libc_paths " | grep " $LDCONFIG_ARCH " | awk ' {print $NF}' )
109113 else
110114 libc_path=$( echo " $libc_paths " | awk ' {print $NF}' )
111115 fi
@@ -119,16 +123,20 @@ elif [ -z "$(ldd --version 2>&1 | grep 'musl libc')" ]; then
119123 echo " Warning: Can't find libc.so or ldconfig, can't verify libc version"
120124 fi
121125
122- if [ -n " $libc_path " ]; then
126+ while [ -n " $libc_path " ]; do
123127 # Rather than trusting the output of ldd --version (which is not always accurate)
124128 # we instead use the version of the cached libc.so.6 file itself.
125- libc_real_path=$( readlink -f " $libc_path " )
129+ libc_path_line=$( echo " $libc_path " | head -n1)
130+ libc_real_path=$( readlink -f " $libc_path_line " )
126131 libc_version=$( cat " $libc_real_path " | sed -n ' s/.*release version \([0-9]\+\.[0-9]\+\).*/\1/p' )
127132 if [ " $( printf ' %s\n' " 2.28" " $libc_version " | sort -V | head -n1) " = " 2.28" ]; then
128133 found_required_glibc=1
129- else
130- echo " Warning: Missing GLIBC >= 2.28! from $libc_real_path "
134+ break
131135 fi
136+ libc_path=$( echo " $libc_path " | tail -n +2) # remove first line
137+ done
138+ if [ " $found_required_glibc " = " 0" ]; then
139+ echo " Warning: Missing GLIBC >= 2.28! from $libc_real_path "
132140 fi
133141else
134142 echo " Warning: musl detected, skipping GLIBC check"
0 commit comments