diff options
author | Jake Hunsaker <jhunsake@redhat.com> | 2022-02-14 09:37:30 -0500 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2022-02-14 10:57:45 -0500 |
commit | f22efe044f1f0565b57d6aeca2081a5227e0312c (patch) | |
tree | cf662b437c63126c70c79701024ab6547ecdf4c4 | |
parent | 8ac6293337b862ca94177f731fd95cadb8bdc7b5 (diff) | |
download | sos-f22efe044f1f0565b57d6aeca2081a5227e0312c.tar.gz |
[utilities] Don't try to chroot to /
With the recent fix for sysroot being `None` to always being (correctly)
`/`, we should guard against situations where `sos_get_command_output()`
would now try to chroot to `/` before running any command. Incidentally,
this would also cause our unittests to fail if they were run by a
non-root user.
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r-- | sos/utilities.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sos/utilities.py b/sos/utilities.py index 6b13415b..d782123a 100644 --- a/sos/utilities.py +++ b/sos/utilities.py @@ -120,7 +120,7 @@ def sos_get_command_output(command, timeout=TIMEOUT_DEFAULT, stderr=False, # closure are caught in the parent (chroot and chdir are bound from # the enclosing scope). def _child_prep_fn(): - if (chroot): + if chroot and chroot != '/': os.chroot(chroot) if (chdir): os.chdir(chdir) |