From 82fb7a02974b836060b3fdeeb17926401bb15cb5 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 27 Aug 2026 06:48:50 +0900 Subject: [PATCH] import: dlopen libacl only when libarchive support is enabled Otherwise, test-dlopen-note.py fails when libarchive support is disabled but libacl support is enabled. Also, log the dlopen_libarchive() failure at LOG_ERR level, matching how the other failures are already logged. Fixes #43530. --- src/import/import-common.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/import/import-common.c b/src/import/import-common.c index eb828d6b14..7633aadc53 100644 --- a/src/import/import-common.c +++ b/src/import/import-common.c @@ -32,11 +32,18 @@ int import_fork_tar_x(int tree_fd, int userns_fd, PidRef *ret_pid) { assert(tree_fd >= 0); assert(ret_pid); - (void) dlopen_libacl(LOG_DEBUG); - r = dlopen_libarchive(LOG_DEBUG); + r = dlopen_libarchive(LOG_ERR); if (r < 0) return r; + /* Add the #if guard here to suppress a test-dlopen-note.py failure. If libarchive support is + * disabled, dlopen_libarchive() above fails, so this code is never reached. However, without + * the #if guard, the dlopen_libacl symbol would still end up in the final executable, and the + * resulting missing dlopen note would trigger the test failure. */ +#if HAVE_LIBARCHIVE + (void) dlopen_libacl(LOG_DEBUG); +#endif + TarFlags flags = (userns_fd >= 0 ? TAR_SQUASH_UIDS_ABOVE_64K : 0) | (mac_selinux_use() ? TAR_SELINUX : 0); @@ -101,11 +108,16 @@ int import_fork_tar_c(int tree_fd, int userns_fd, PidRef *ret_pid) { assert(tree_fd >= 0); assert(ret_pid); - (void) dlopen_libacl(LOG_DEBUG); - r = dlopen_libarchive(LOG_DEBUG); + r = dlopen_libarchive(LOG_ERR); if (r < 0) return r; + /* Add the #if guard here to suppress a test-dlopen-note.py failure. See the comment in + * import_fork_tar_x() above. */ +#if HAVE_LIBARCHIVE + (void) dlopen_libacl(LOG_DEBUG); +#endif + TarFlags flags = (userns_fd >= 0 ? TAR_SQUASH_UIDS_ABOVE_64K : 0) | (mac_selinux_use() ? TAR_SELINUX : 0);