diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-11-20 09:34:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 09:34:25 +0100 |
commit | 52b0351a154e9ad3f6a62c5de61198e454d86ecb (patch) | |
tree | 9f55b655cac07ab41ebe5d744ae5464c8ea748b3 /test | |
parent | units: add initrd directory to list of conditions for systemd-confext (diff) | |
parent | core/exec-invoke: suppress placeholder home only in build_environment() (diff) | |
download | systemd-52b0351a154e9ad3f6a62c5de61198e454d86ecb.tar.xz systemd-52b0351a154e9ad3f6a62c5de61198e454d86ecb.zip |
core/exec-invoke: suppress placeholder home only in build_environment() (#35219)
Alternative to https://github.com/systemd/systemd/pull/34789
Closes #34789
Diffstat (limited to 'test')
-rwxr-xr-x | test/units/TEST-07-PID1.working-directory.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/units/TEST-07-PID1.working-directory.sh b/test/units/TEST-07-PID1.working-directory.sh new file mode 100755 index 0000000000..1cff3e0602 --- /dev/null +++ b/test/units/TEST-07-PID1.working-directory.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later + +set -eux +set -o pipefail + +# shellcheck source=test/units/util.sh +. "$(dirname "$0")"/util.sh + +(! systemd-run --wait -p DynamicUser=yes \ + -p EnvironmentFile=-/usr/lib/systemd/systemd-asan-env \ + -p WorkingDirectory='~' true) + +assert_eq "$(systemd-run --pipe --uid=root -p WorkingDirectory='~' pwd)" "/root" +assert_eq "$(systemd-run --pipe --uid=nobody -p WorkingDirectory='~' pwd)" "/" +assert_eq "$(systemd-run --pipe --uid=testuser -p WorkingDirectory='~' pwd)" "/home/testuser" + +(! systemd-run --wait -p DynamicUser=yes -p User=testuser \ + -p EnvironmentFile=-/usr/lib/systemd/systemd-asan-env \ + -p WorkingDirectory='~' true) |