From 5f347d3160f745b8ed1c1290a61956cdcc09a73a Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 2 Aug 2022 13:54:57 +0200 Subject: [PATCH 1/2] test: install libgcc_s.so.1 explicitly if available 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 | 5 ----- test/test-functions | 14 ++++++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/test/TEST-70-TPM2/test.sh b/test/TEST-70-TPM2/test.sh index baf75aaf11..90197a71b9 100755 --- a/test/TEST-70-TPM2/test.sh +++ b/test/TEST-70-TPM2/test.sh @@ -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" diff --git a/test/test-functions b/test/test-functions index 1fc695feb5..2c3863aca1 100644 --- a/test/test-functions +++ b/test/test-functions @@ -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. From 134d4f1b9d00b92fd08d5d7e5b6db4523298378f Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 2 Aug 2022 18:28:43 +0200 Subject: [PATCH 2/2] test: be a bit more verbose about shared library symlinks For example: ``` D: Installing /usr/lib64/libz.so.1.2.11 D: Creating symlink /usr/lib64/libz.so.1.2.11 -> /usr/lib64/libz.so.1 D: Creating extra symlink: /lib64/libz.so D: Installing /usr/lib64/libgcc_s-12-20220507.so.1 D: Creating symlink /usr/lib64/libgcc_s-12-20220507.so.1 -> /usr/lib64/libgcc_s.so.1 ``` --- test/test-functions | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test-functions b/test/test-functions index 2c3863aca1..b208825e67 100644 --- a/test/test-functions +++ b/test/test-functions @@ -2429,6 +2429,7 @@ inst_library() { inst_simple "$reallib" "$reallib" inst_dir "${dest%/*}" [[ -d "${dest%/*}" ]] && dest="$(readlink -f "${dest%/*}")/${dest##*/}" + ddebug "Creating symlink $reallib -> $dest" ln -sfn -- "$(convert_abs_rel "${dest}" "${reallib}")" "${initdir}/${dest}" else inst_simple "$src" "$dest"