From df0a4353eb48b538b3b63897be5e35d181d6ab20 Mon Sep 17 00:00:00 2001 From: Jake Hunsaker Date: Fri, 19 May 2023 12:06:44 -0400 Subject: [Plugin|Archive] Fix collection of symlinks in containers When collecting an sos report from witin a container, and intending to collect host-level information, symlink collection would previously collect the container's version of the symlink target due to how they would resolve within the `Archive.add_file()` flow. Fix this by simply forcing the follow up collection of the sysroot location of the symlink target, which would previously be aborted due to the fact that sos had already collected the container's matching file. This introduces a certain level of inefficiency by way of doubling the copy operations, however ensuring that we only make a single copy operation originally involves a quite fragile set of path mangling that depends heavily upon how the symlinks are created on the host's filesystem. For example a symlink using a relative path could be resolved somewhat easily, but a symlink using an absolute path introduces a certain amount of indeterminate resolution, which we cannot allow for the vast majority of use cases that are performed outside of a container. Resolves: rhbz#2075720 Signed-off-by: Jake Hunsaker --- tests/unittests/plugin_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/unittests/plugin_tests.py b/tests/unittests/plugin_tests.py index 8170a1dd..49784514 100644 --- a/tests/unittests/plugin_tests.py +++ b/tests/unittests/plugin_tests.py @@ -45,7 +45,7 @@ class MockArchive(TarFileArchive): def name(self): return "mock.archive" - def add_file(self, src, dest=None): + def add_file(self, src, dest=None, force=False): if not dest: dest = src self.m[src] = dest -- cgit