[libvirt PATCH 0/2] tests: Fix qemuxml2argvtest failure on macOS 12

As reported in https://listman.redhat.com/archives/libvir-list/2022-May/230762.html I'm still unclear on why this worked with all versions of macOS until 12, but the fix feels reasonable enough and I can't really justify digging much further. Test pipeline: https://gitlab.com/abologna/libvirt/-/pipelines/615807379 macOS 12 job: https://gitlab.com/abologna/libvirt/-/jobs/2895958597 Andrea Bolognani (2): util: Preserve macOS dyld environment by default tests: Reset macOS dyld environment src/util/vircommand.c | 2 ++ tests/qemuxml2argvtest.c | 2 ++ 2 files changed, 4 insertions(+) -- 2.37.2

The DYLD_* environment variables on macOS have the same purpose as the LD_* variables have on Linux. Since we're preserving the latter by default, it makes sense to do the same for the former as well. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- src/util/vircommand.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index d78c666f28..4e003266bf 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -1417,6 +1417,8 @@ virCommandAddEnvPassCommon(virCommand *cmd) virCommandAddEnvPass(cmd, "LD_PRELOAD"); virCommandAddEnvPass(cmd, "LD_LIBRARY_PATH"); + virCommandAddEnvPass(cmd, "DYLD_INSERT_LIBRARIES"); + virCommandAddEnvPass(cmd, "DYLD_FORCE_FLAT_NAMESPACE"); virCommandAddEnvPass(cmd, "PATH"); virCommandAddEnvPass(cmd, "HOME"); virCommandAddEnvPass(cmd, "USER"); -- 2.37.2

This is needed to ensure the environment variables that we need for the test program itself, specifically to load mock libraries, does not interfere with any command that gets invoked by it, either directly or indirectly. We already perform the same cleanup step for LD_* variables. This makes the test failures error : virCommandWait:2752 : internal error: Child process (/usr/libexec/qemu/vhost-user/test-vhost-user-gpu --print-capabilities) unexpected fatal signal 6: dyld[8896]: symbol not found in flat namespace '_virQEMUCapsGet' error : qemuVhostUserFillDomainGPU:394 : operation failed: Unable to find a satisfying vhost-user-gpu that were showing up on macOS 12 go away. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- tests/qemuxml2argvtest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 8933e373f7..4ecccdc272 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1053,6 +1053,8 @@ mymain(void) g_unsetenv("TMPDIR"); g_unsetenv("LD_PRELOAD"); g_unsetenv("LD_LIBRARY_PATH"); + g_unsetenv("DYLD_INSERT_LIBRARIES"); + g_unsetenv("DYLD_FORCE_FLAT_NAMESPACE"); g_unsetenv("QEMU_AUDIO_DRV"); g_unsetenv("SDL_AUDIODRIVER"); -- 2.37.2

On a Wednesday in 2022, Andrea Bolognani wrote:
As reported in
https://listman.redhat.com/archives/libvir-list/2022-May/230762.html
I'm still unclear on why this worked with all versions of macOS until 12, but the fix feels reasonable enough and I can't really justify digging much further.
Test pipeline: https://gitlab.com/abologna/libvirt/-/pipelines/615807379 macOS 12 job: https://gitlab.com/abologna/libvirt/-/jobs/2895958597
Andrea Bolognani (2): util: Preserve macOS dyld environment by default tests: Reset macOS dyld environment
src/util/vircommand.c | 2 ++ tests/qemuxml2argvtest.c | 2 ++ 2 files changed, 4 insertions(+)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Andrea Bolognani
-
Ján Tomko