]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: install libgcc_s.so.1 explicitly if available
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 2 Aug 2022 11:54:57 +0000 (13:54 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 2 Aug 2022 16:28:35 +0000 (18:28 +0200)
Since the library is dlopen()ed by libpthread and required during
pthread_exit()/pthread_cancel(), let's install it explicitly if available to
avoid unexpected fails in tests. This also consolidates all related
workarounds for this library across the test scripts.

test/TEST-70-TPM2/test.sh
test/test-functions

index baf75aaf1119ae0e0753e2574e813529ed438c18..90197a71b9e07f70c5b99e01d72295412222d32c 100755 (executable)
@@ -20,11 +20,6 @@ test_append_files() {
         install_dmevent
         generate_module_dependencies
         inst_binary tpm2_pcrextend
-
-        # On Ubuntu, cryptsetup does not link against libgcc_s.so.1
-        if get_bool "$LOOKS_LIKE_DEBIAN"; then
-            inst_library "/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/libgcc_s.so.1"
-        fi
 }
 
 TEST_70_TPM_DEVICE="tpm-tis"
index 1fc695feb5de177a9efd4fe6817923831cfc326e..2c3863aca1f04427e718ab276513dd2906fe12a9 100644 (file)
@@ -967,12 +967,6 @@ install_multipath() {
         # Install the library itself and create necessary symlinks
         inst_library "$file"
     done < <(find /lib*/multipath -type f)
-
-    if get_bool "$LOOKS_LIKE_ARCH"; then
-        # On Arch the multipath libraries are not linked against libgcc_s.so.1,
-        # but it's still required at runtime
-        inst_library "/lib64/libgcc_s.so.1"
-    fi
 }
 
 install_lvm() {
@@ -1227,6 +1221,14 @@ install_missing_libraries() {
         LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$(get_ldpath "$i")" inst_libs "$i"
     done
 
+    # Install libgcc_s.so if available, since it's dlopen()ed by libpthread
+    # and might cause unexpected failures during pthread_exit()/pthread_cancel()
+    # if not present
+    # See: https://github.com/systemd/systemd/pull/23858
+    while read -r libgcc_s; do
+        [[ -e "$libgcc_s" ]] && inst_library "$libgcc_s"
+    done < <(ldconfig -p | awk '/\/libgcc_s.so.1$/ { print $4 }')
+
     local lib path
     # A number of dependencies is now optional via dlopen, so the install
     # script will not pick them up, since it looks at linkage.