diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2024-11-25 14:13:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-25 14:13:36 +0100 |
commit | d293fade24b34ccc2f5716b0ff5513e9533cf0c4 (patch) | |
tree | a687676488a82c29e770961fd0464d66929dc727 /test | |
parent | test: Dump coredumps from journal in the integration test wrapper (diff) | |
parent | test-namespace: tweak log message a bit (diff) | |
download | systemd-d293fade24b34ccc2f5716b0ff5513e9533cf0c4.tar.xz systemd-d293fade24b34ccc2f5716b0ff5513e9533cf0c4.zip |
Check inode number to see if we are in init namespace (#35306)
This is a more comprehensive fix compared to #35273. Also adds a minimal
test only.
Based on Luca's #35273 but generalizes the code a bit.
In v258 we really should get rid of the old heuristics around userns and
cgroupns detection, but given we are late in the v257 cycle this keeps
them in.
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/TEST-74-AUX-UTILS.detect-virt.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/units/TEST-74-AUX-UTILS.detect-virt.sh b/test/units/TEST-74-AUX-UTILS.detect-virt.sh index fe1db4d2aa..a1539d9b44 100755 --- a/test/units/TEST-74-AUX-UTILS.detect-virt.sh +++ b/test/units/TEST-74-AUX-UTILS.detect-virt.sh @@ -5,3 +5,7 @@ set -o pipefail SYSTEMD_IN_CHROOT=1 systemd-detect-virt --chroot (! SYSTEMD_IN_CHROOT=0 systemd-detect-virt --chroot) + +if ! systemd-detect-virt -c; then + unshare --mount-proc --fork --user --pid systemd-detect-virt --container +fi |