]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: use relative paths to executables
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 21 Sep 2025 13:10:21 +0000 (22:10 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 23 Sep 2025 14:48:53 +0000 (15:48 +0100)
This also makes shebang always use env command, and drops unnecessary
'bash -c' or 'sh -c' when a signle command is invoked in the shell,
like sleep or echo.

90 files changed:
test/integration-tests/TEST-03-JOBS/TEST-03-JOBS.units/always-activating.service
test/integration-tests/TEST-03-JOBS/TEST-03-JOBS.units/hello.service
test/integration-tests/TEST-03-JOBS/TEST-03-JOBS.units/sleep-infinity-restart-direct.service
test/integration-tests/TEST-03-JOBS/TEST-03-JOBS.units/sleep-infinity-restart-normal.service
test/integration-tests/TEST-03-JOBS/TEST-03-JOBS.units/sleep-infinity-simple.service
test/integration-tests/TEST-03-JOBS/TEST-03-JOBS.units/sleep.service
test/integration-tests/TEST-03-JOBS/TEST-03-JOBS.units/unstoppable.service
test/integration-tests/TEST-06-SELINUX/TEST-06-SELINUX.units/hola.service
test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue14566-repro.service
test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue16115-repro-1.service
test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue16115-repro-2.service
test/integration-tests/TEST-07-PID1/TEST-07-PID1.units/issue16115-repro-3.service
test/integration-tests/TEST-16-EXTEND-TIMEOUT/TEST-16-EXTEND-TIMEOUT.units/fail-stop.service
test/integration-tests/TEST-62-RESTRICT-IFACES/TEST-62-RESTRICT-IFACES.units/TEST-62-RESTRICT-IFACES-6.service
test/integration-tests/TEST-63-PATH/TEST-63-PATH.units/test63-issue-24577-dep.service
test/integration-tests/TEST-63-PATH/TEST-63-PATH.units/test63-issue-24577.service
test/units/TEST-04-JOURNAL.SYSTEMD_JOURNAL_COMPRESS.sh
test/units/TEST-04-JOURNAL.journal.sh
test/units/TEST-07-PID1.exec-context.sh
test/units/TEST-07-PID1.exec-deserialization.sh
test/units/TEST-07-PID1.issue-31752.sh
test/units/TEST-07-PID1.issue-33672.sh
test/units/TEST-07-PID1.main-PID-change.sh
test/units/TEST-07-PID1.mqueue-ownership.sh
test/units/TEST-07-PID1.private-network.sh
test/units/TEST-07-PID1.quota.sh
test/units/TEST-07-PID1.transient-unit-container.sh
test/units/TEST-07-PID1.type-exec-parallel.sh
test/units/TEST-13-NSPAWN.machined.sh
test/units/TEST-13-NSPAWN.nspawn-oci.sh
test/units/TEST-13-NSPAWN.nspawn.sh
test/units/TEST-13-NSPAWN.nss-mymachines.sh
test/units/TEST-13-NSPAWN.unpriv.sh
test/units/TEST-15-DROPIN.sh
test/units/TEST-16-EXTEND-TIMEOUT.sh
test/units/TEST-17-UDEV.IMPORT.sh
test/units/TEST-17-UDEV.TAG.sh
test/units/TEST-17-UDEV.failed-event.sh
test/units/TEST-17-UDEV.queued-events-serialization.sh
test/units/TEST-17-UDEV.verify.sh
test/units/TEST-17-UDEV.watch.sh
test/units/TEST-19-CGROUP.keyed-properties.sh
test/units/TEST-22-TMPFILES.01.sh
test/units/TEST-22-TMPFILES.02.sh
test/units/TEST-22-TMPFILES.03.sh
test/units/TEST-22-TMPFILES.04.sh
test/units/TEST-22-TMPFILES.05.sh
test/units/TEST-22-TMPFILES.06.sh
test/units/TEST-22-TMPFILES.07.sh
test/units/TEST-22-TMPFILES.08.sh
test/units/TEST-22-TMPFILES.13.sh
test/units/TEST-22-TMPFILES.14.sh
test/units/TEST-22-TMPFILES.15.sh
test/units/TEST-22-TMPFILES.16.sh
test/units/TEST-22-TMPFILES.17.sh
test/units/TEST-22-TMPFILES.18.sh
test/units/TEST-22-TMPFILES.19.sh
test/units/TEST-23-UNIT-FILE.ExecReload.sh
test/units/TEST-23-UNIT-FILE.ExecStopPost.sh
test/units/TEST-23-UNIT-FILE.exec-command-ex.sh
test/units/TEST-23-UNIT-FILE.oneshot-restart.sh
test/units/TEST-23-UNIT-FILE.statedir.sh
test/units/TEST-23-UNIT-FILE.type-exec.sh
test/units/TEST-26-SYSTEMCTL.sh
test/units/TEST-34-DYNAMICUSERMIGRATE.sh
test/units/TEST-35-LOGIN.sh
test/units/TEST-38-FREEZER.sh
test/units/TEST-43-PRIVATEUSER-UNPRIV.sh
test/units/TEST-46-HOMED.sh
test/units/TEST-50-DISSECT.DDI.sh
test/units/TEST-50-DISSECT.dissect.sh
test/units/TEST-54-CREDS.sh
test/units/TEST-55-OOMD.sh
test/units/TEST-60-MOUNT-RATELIMIT.sh
test/units/TEST-65-ANALYZE.sh
test/units/TEST-68-PROPAGATE-EXIT-STATUS.sh
test/units/TEST-69-SHUTDOWN.py
test/units/TEST-74-AUX-UTILS.ask-password.sh
test/units/TEST-74-AUX-UTILS.capsule.sh
test/units/TEST-74-AUX-UTILS.delta.sh
test/units/TEST-74-AUX-UTILS.pty-forward.sh
test/units/TEST-74-AUX-UTILS.run.sh
test/units/TEST-74-AUX-UTILS.varlinkctl.sh
test/units/TEST-74-AUX-UTILS.vpick.sh
test/units/TEST-75-RESOLVED.sh
test/units/TEST-79-MEMPRESS.sh
test/units/TEST-81-GENERATORS.run-generator.sh
test/units/TEST-82-SOFTREBOOT.sh
test/units/TEST-87-AUX-UTILS-VM.coredump.sh
test/units/util.sh

index 93ddb85c75fe6cd1e36d5c6e030ba2054cb65d61..e2714a57adeb343e8d66aa1603fb028a015c4260 100644 (file)
@@ -5,4 +5,4 @@ After=always-activating.socket
 
 [Service]
 Type=notify
-ExecStart=bash -c 'sleep infinity'
+ExecStart=sleep infinity
index 0c3f2f817d969e49a601bbbef0491471be24c628..b3c8199d1b4837315b9be06c9653c8e94f318c17 100644 (file)
@@ -3,4 +3,4 @@
 Description=Hello World
 
 [Service]
-ExecStart=/bin/echo "Hello World"
+ExecStart=echo "Hello World"
index 00316db1f1a4e5b132a039ce4472d8761dc9d8ca..bc898bd7ed6733dcf7c1d63f35d07f901df6ff3e 100644 (file)
@@ -3,6 +3,6 @@
 OnFailure=restart-on-failure.service
 
 [Service]
-ExecStart=/bin/sleep infinity
+ExecStart=sleep infinity
 Restart=on-failure
 RestartMode=direct
index dabba4c4f02b04059f8f2e204813a795dfd25d82..0ec9c7ff5ffb9d8d2e8bc888fea3ee0c29020518 100644 (file)
@@ -3,6 +3,6 @@
 OnFailure=restart-on-failure.service
 
 [Service]
-ExecStart=/bin/sleep infinity
+ExecStart=sleep infinity
 Restart=on-failure
 RestartMode=normal
index 211346d7c002f0166b40b17ce20219eade20b1b4..043e2503bdc85ddb550e64d41c5e141c5c4fad9a 100644 (file)
@@ -4,4 +4,4 @@ Description=Sleep infinitely
 
 [Service]
 Type=simple
-ExecStart=/bin/sleep infinity
+ExecStart=sleep infinity
index 32c2037a09433c493ed63c0085ccb5c39cf71e3d..b071c94e253dfba21e7ea729d5bc6a65388ea9c0 100644 (file)
@@ -4,4 +4,4 @@ Description=Sleep for 1 minute
 
 [Service]
 Type=oneshot
-ExecStart=/bin/sleep 60
+ExecStart=sleep 60
index 6eb7c19eab3d1397ad07c418854ca16b31063d1f..9d3e732e4518ae6ab1fbfdee4c494a6594434290 100644 (file)
@@ -2,5 +2,5 @@
 [Service]
 Type=oneshot
 RemainAfterExit=yes
-ExecStart=/bin/echo "I'm unstoppable!"
-ExecStop=/bin/systemctl start --no-block unstoppable.service
+ExecStart=echo "I'm unstoppable!"
+ExecStop=systemctl start --no-block unstoppable.service
index 94f9b47b722ddb21ee14947d5723fef4d367b460..0acf808480bb1e9f5b0fbea56c91898c09bceb77 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: LGPL-2.1-or-later
 [Service]
 Type=oneshot
-ExecStart=/bin/echo Start Hola
-ExecReload=/bin/echo Reload Hola
-ExecStop=/bin/echo Stop Hola
+ExecStart=echo Start Hola
+ExecReload=echo Reload Hola
+ExecStop=echo Stop Hola
 RemainAfterExit=yes
index 757f978101e1923ade2b6f2028cafe3a13754e15..4fd77160813d68bd15cf8e42414eeeaaa208dc9e 100644 (file)
@@ -4,5 +4,5 @@ Description=Issue 14566 Repro
 
 [Service]
 ExecStart=/usr/lib/systemd/tests/testdata/TEST-07-PID1.units/%N.sh
-ExecStopPost=/bin/true
+ExecStopPost=true
 KillMode=mixed
index 90252b388ad21b4d7d0e883172f8e5511797cee4..b841777c846ffd1a9203ba69794e62ebb5f89c9e 100644 (file)
@@ -5,6 +5,6 @@ Description=Issue 16115 Repro with on-abnormal
 [Service]
 Type=simple
 Restart=on-abnormal
-ExecCondition=/bin/false
+ExecCondition=false
 ExecStart=sleep 100
 RestartSec=1
index 7c65691029d90e757b4febe839d361ecf341ade8..e41a968e164c6aae13ee534e61ae0b081351eb57 100644 (file)
@@ -5,6 +5,6 @@ Description=Issue 16115 Repro with on-failure
 [Service]
 Type=simple
 Restart=on-failure
-ExecCondition=/bin/false
+ExecCondition=false
 ExecStart=sleep 100
 RestartSec=1
index c68f93d11d78113cc4f4531cdb919275c9b79be1..c1942dbd40a68e4d7f868f9970e02a7b7fe09530 100644 (file)
@@ -5,6 +5,6 @@ Description=Issue 22257 Repro with Restart=always
 [Service]
 Type=simple
 Restart=always
-ExecCondition=/bin/false
+ExecCondition=false
 ExecStart=sleep 100
 RestartSec=1
index 6d66731f85838bc6c55c9fb0e0fe137d6b0f5c29..e3b374cc71067820e6cea0f64101cfb9fb1df239 100644 (file)
@@ -13,4 +13,4 @@ Environment=SERVICE=fail_stop extend_timeout_interval=5 sleep_interval=7 start_i
 ExecStart=/usr/lib/systemd/tests/testdata/TEST-16-EXTEND-TIMEOUT.units/extend-timeout.sh
 # Due to 6041a7ee2c1bbff6301082f192fc1b0882400d42 SIGTERM isn't sent as the service shuts down with STOPPING=1
 # This file makes the test assess.sh quicker by notifying it that this test has finished.
-ExecStopPost=/bin/bash -c '[[ $SERVICE_RESULT == timeout && $EXIT_CODE == killed ]] && touch /fail_runtime.terminated'
+ExecStopPost=bash -c '[[ $SERVICE_RESULT == timeout && $EXIT_CODE == killed ]] && touch /fail_runtime.terminated'
index 876d8f36e77524269235135b68f198a219772467..b7e91f7e68211860bf1f6a0e66a1dd0ed78b29e8 100644 (file)
@@ -2,9 +2,9 @@
 [Unit]
 Description=TEST-62-RESTRICT-IFACES-altname
 [Service]
-ExecStart=/bin/sh -c 'ping -c 1 -W 0.2 192.168.113.1'
-ExecStart=/bin/sh -c 'ping -c 1 -W 0.2 192.168.113.5'
-ExecStart=/bin/sh -c '! ping -c 1 -W 0.2 192.168.113.9'
+ExecStart=sh -c 'ping -c 1 -W 0.2 192.168.113.1'
+ExecStart=sh -c 'ping -c 1 -W 0.2 192.168.113.5'
+ExecStart=sh -c '! ping -c 1 -W 0.2 192.168.113.9'
 RestrictNetworkInterfaces=veth0-altname-with-more-than-15-chars
 RestrictNetworkInterfaces=veth1-altname-with-more-than-15-chars
 Type=oneshot
index e332ea474e75bc335c799b053d9024f82f993405..92de94993da8f7980d2ce8e2e0319d4c655d6ea3 100644 (file)
@@ -1,4 +1,4 @@
 # SPDX-License-Identifier: LGPL-2.1-or-later
 [Service]
 Type=oneshot
-ExecStart=bash -c 'sleep infinity'
+ExecStart=sleep infinity
index 568518bbf6083129078106fc7918ece00400b2f1..7664ed0c114f1cbeea95ee8ddcad0213f352b961 100644 (file)
@@ -5,4 +5,4 @@ After=test63-issue-24577-dep.service
 
 [Service]
 Type=oneshot
-ExecStart=bash -c 'sleep infinity'
+ExecStart=sleep infinity
index 6da9f5e4205d2b740ceacfc359d98458c1a77ff4..1561ed971ebe09fa26524b86b7d1f5bec245c06c 100755 (executable)
@@ -26,7 +26,7 @@ EOF
     journalctl --rotate
 
     ID="$(systemd-id128 new)"
-    systemd-cat -t "$ID" /bin/bash -c "for ((i=0;i<100;i++)); do echo -n hoge with ${c}; done; echo"
+    systemd-cat -t "$ID" bash -c "for ((i=0;i<100;i++)); do echo -n hoge with ${c}; done; echo"
     journalctl --sync
     timeout 10 bash -c "until SYSTEMD_LOG_LEVEL=debug journalctl --verify --quiet --file /var/log/journal/$MACHINE_ID/system.journal 2>&1 | grep -q -F 'compress=${c}'; do sleep .5; done"
 
index 8834d5ae592eeb8ad5509465e9f659d543799848..14892120eb409b22d2134eb71630ddcb47a853c5 100755 (executable)
@@ -93,7 +93,7 @@ grep -vq "^_PID=$PID" /tmp/output
 # https://github.com/systemd/systemd/issues/15654
 ID=$(systemd-id128 new)
 printf "This will\nusually fail\nand be truncated\n" >/tmp/expected
-systemd-cat -t "$ID" /bin/sh -c 'env echo -n "This will";echo;env echo -n "usually fail";echo;env echo -n "and be truncated";echo;'
+systemd-cat -t "$ID" sh -c 'env echo -n "This will";echo;env echo -n "usually fail";echo;env echo -n "and be truncated";echo;'
 journalctl --sync
 journalctl -b -o cat -t "$ID" >/tmp/output
 diff /tmp/expected /tmp/output
@@ -120,7 +120,7 @@ journalctl -b -n 1 /bin/true /bin/false
 journalctl -b -n 1 /bin/true + /bin/false
 journalctl -b -n 1 -r --unit "systemd*"
 
-systemd-run --user -M "testuser@.host" /bin/echo hello
+systemd-run --user -M "testuser@.host" echo hello
 journalctl --sync
 journalctl -b -n 1 -r --user-unit "*"
 
@@ -158,7 +158,7 @@ journalctl --header | grep system.journal
 journalctl --field _EXE | grep . >/dev/null
 journalctl --no-hostname --utc --catalog | grep . >/dev/null
 # Exercise executable_is_script() and the related code, e.g. `journalctl -b /path/to/a/script.sh` should turn
-# into ((_EXE=/bin/bash AND _COMM=script.sh) AND _BOOT_ID=c002e3683ba14fa8b6c1e12878386514)
+# into ((_EXE=/usr/bin/bash AND _COMM=script.sh) AND _BOOT_ID=c002e3683ba14fa8b6c1e12878386514)
 journalctl -b "$(readlink -f "$0")" | grep . >/dev/null
 journalctl -b "$(systemd-id128 boot-id)" | grep . >/dev/null
 journalctl --since yesterday --reverse | grep . >/dev/null
@@ -219,7 +219,7 @@ journalctl --follow --merge | head -n1 | grep .
 rm -f /tmp/issue-26746-log /tmp/issue-26746-cursor
 ID="$(systemd-id128 new)"
 journalctl -t "$ID" --follow --cursor-file=/tmp/issue-26746-cursor | tee /tmp/issue-26746-log &
-systemd-cat -t "$ID" /bin/sh -c 'echo hogehoge'
+systemd-cat -t "$ID" sh -c 'echo hogehoge'
 # shellcheck disable=SC2016
 timeout 10 bash -c 'until [[ -f /tmp/issue-26746-log && "$(cat /tmp/issue-26746-log)" =~ hogehoge ]]; do sleep .5; done'
 pkill -TERM journalctl
index 592c64ca4ce869ab0094ae478d87171d5946b408..2ec7f018e851523cb2725106f5361a0148b34733 100755 (executable)
@@ -405,7 +405,7 @@ if [[ ! -v ASAN_OPTIONS ]]; then
     # Here, -p EnvironmentFile=-/usr/lib/systemd/systemd-asan-env does not work,
     # as sd-executor loads NSS module and fails before applying the environment:
     # (true)[660]: test-dynamicuser-fail.service: Changing to the requested working directory failed: No such file or directory
-    # (true)[660]: test-dynamicuser-fail.service: Failed at step CHDIR spawning /usr/bin/true: No such file or directory
+    # (true)[660]: test-dynamicuser-fail.service: Failed at step CHDIR spawning true: No such file or directory
     # TEST-07-PID1.sh[660]: ==660==LeakSanitizer has encountered a fatal error.
     # TEST-07-PID1.sh[660]: ==660==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
     # TEST-07-PID1.sh[660]: ==660==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
index 04f17c88e9dbcfc3552aaec1d4694fdfdc621592..580fa090f649db8f80a327001a473a21240f69e9 100755 (executable)
@@ -193,7 +193,7 @@ testcase_issue_6533() {
     cat >"$unit_path" <<EOF
 [Service]
 Type=simple
-ExecStart=/bin/sleep 5
+ExecStart=sleep 5
 EOF
     systemctl daemon-reload
 
@@ -207,7 +207,7 @@ EOF
     cat >"$unit_path" <<EOF
 [Service]
 Type=simple
-ExecStart=/bin/sleep 5
+ExecStart=sleep 5
 ExecStart=bash -c "echo foo >>$log_file"
 EOF
     systemctl daemon-reload
index 89ec07e46bf0e54857d483c59db6e9ddbb663cfd..73b6cc69ee6cfa1e9e987bec8a88d1805b5a2744 100755 (executable)
@@ -23,7 +23,7 @@ trap cleanup EXIT
 
 cat > /run/systemd/system/"$UNIT" <<EOF
 [Service]
-ExecStart=/usr/bin/true
+ExecStart=true
 RemainAfterExit=yes
 EOF
 
index 370497c346df280f3061d4539c274a9da73d6e43..603505884abc462e2554ddc0bab174b691984494 100755 (executable)
@@ -23,7 +23,7 @@ trap cleanup EXIT
 
 cat > /run/systemd/system/"$UNIT" <<EOF
 [Service]
-ExecStart=/usr/bin/true
+ExecStart=true
 EOF
 
 mkdir /run/systemd/system/"$UNIT".d
index 16f3510e5edeffc09b06842dc987f15ed4fad04a..960323035ce73a4646b13cac23d61bef91c6ec08 100755 (executable)
@@ -18,7 +18,7 @@ INTERNALPID=$!
 disown
 
 # Start a test process outside of our own cgroup
-systemd-run -p DynamicUser=1 --unit=test-sleep.service /bin/sleep infinity
+systemd-run -p DynamicUser=1 --unit=test-sleep.service sleep infinity
 EXTERNALPID="$(systemctl show -P MainPID test-sleep.service)"
 
 # Update our own main PID to the external test PID, this should work
@@ -162,11 +162,11 @@ chmod 755 /dev/shm/test-mainpid3.sh
 test "$(systemctl show -P Result test-mainpidsh3.service)" = timeout
 
 # Test that scope units work
-systemd-run --scope --unit test-true.scope /bin/true
+systemd-run --scope --unit test-true.scope true
 test "$(systemctl show -P Result test-true.scope)" = success
 
 # Test that user scope units work as well
 
 systemctl start user@4711.service
-runas testuser systemd-run --scope --user --unit test-true.scope /bin/true
+runas testuser systemd-run --scope --user --unit test-true.scope true
 test "$(systemctl show -P Result test-true.scope)" = success
index 19116d19d1398f3b8d12deeb5082ca2ce8d1df1f..19fc101950ddebe7876df971547b73cd57ac45b3 100755 (executable)
@@ -35,7 +35,7 @@ cat << 'EOF' > /run/systemd/system/mqueue-ownership.service
 Description=Dummy service for the socket unit
 Requires=%N.socket
 [Service]
-ExecStart=/usr/bin/true
+ExecStart=true
 Type=oneshot
 EOF
 
index 37658f7d1cd1869dc935535d63f9b194365b7777..9b39733546ec3bf3bcecbaa79841cd1e3311e8cf 100755 (executable)
@@ -4,4 +4,4 @@ set -eux
 set -o pipefail
 
 # For issue https://github.com/systemd/systemd/issues/29526
-systemd-run -p PrivateNetwork=yes --wait /bin/true
+systemd-run -p PrivateNetwork=yes --wait true
index 748b5ee6589e824dbcaa50588cf708f98e1e46aa..a68d9dd53d495c4ec59ddf6cdcf15b79808ccf6b 100755 (executable)
@@ -41,7 +41,7 @@ PrivateUsers=yes
 TemporaryFileSystem=/run /var/opt /var/lib /vol
 ${exec_directory_directive}
 ${exec_quota_directive}
-ExecStart=/bin/bash -c ' \
+ExecStart=bash -c ' \
     set -eux; \
     set -o pipefail; \
     touch ${directory}/quotadir/testfile; \
@@ -77,7 +77,7 @@ PrivateUsers=yes
 TemporaryFileSystem=/run /var/opt /var/lib /vol
 ${exec_directory_directive}
 ${exec_quota_directive}
-ExecStart=/bin/bash -c ' \
+ExecStart=bash -c ' \
     set -eux; \
     set -o pipefail; \
     (! fallocate -l 10000G ${directory}/quotadir/largefile); \
index 60316bf2fa6ce90b8885c01e50ec9d192295fac3..a17f08bd51f0b621aa6f15ed757c0c7436d60c1a 100755 (executable)
@@ -121,8 +121,8 @@ After=basic.target
 
 [Service]
 Type=oneshot
-ExecStart=/bin/sh -c 'echo "$EXPECTED_OUTPUT"  > "$guest_output"'
-ExecStartPost=/usr/bin/systemctl --no-block exit 0
+ExecStart=sh -c 'echo "$EXPECTED_OUTPUT"  > "$guest_output"'
+ExecStartPost=systemctl --no-block exit 0
 TimeoutStopSec=15s
 
 [Install]
index 30f80c539b5084fc8e474370b258feafbebb55b9..23c4c9e4d4ffc6f7aefd328c65d673c7053dfb7a 100755 (executable)
@@ -6,4 +6,4 @@ set -o pipefail
 # Make sure that we never mistake a process starting but failing quickly for a process failing to start, with Type=exec.
 # See https://github.com/systemd/systemd/pull/30799
 
-seq 25 | xargs -n 1 -P 0 systemd-run -p Type=exec /bin/false
+seq 25 | xargs -n 1 -P 0 systemd-run -p Type=exec false
index 76db239f916a2d0a2d189abd249f56b1aa89fb57..d93b3f0441fc921e4f98e07e293e2f011c03023f 100755 (executable)
@@ -40,7 +40,7 @@ done
 # Create one "long running" container with some basic signal handling
 create_dummy_container /var/lib/machines/long-running
 cat >/var/lib/machines/long-running/sbin/init <<\EOF
-#!/usr/bin/bash
+#!/usr/bin/env bash
 
 set -x
 
@@ -316,7 +316,7 @@ varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Unreg
 # test io.systemd.Machine.List with addresses, OSRelease, and UIDShift fields
 create_dummy_container "/var/lib/machines/container-without-os-release"
 cat >>/var/lib/machines/container-without-os-release/sbin/init <<\EOF
-#!/usr/bin/bash
+#!/usr/bin/env bash
 
 set -x
 
@@ -397,13 +397,13 @@ rm -f /tmp/none-existent-file
 # server side, to not generate early SIGHUP. Hence, let's just invoke "sleep
 # infinity" client side, once we acquired the fd (passing it to it), and kill
 # it once we verified everything worked.
-PID=$(systemd-notify --fork -- varlinkctl --exec call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": "shell", "user": "root", "path": "/bin/bash", "args": ["/bin/bash", "-c", "echo $FOO > /tmp/none-existent-file"], "environment": ["FOO=BAR"]}' -- sleep infinity)
+PID=$(systemd-notify --fork -- varlinkctl --exec call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": "shell", "user": "root", "path": "/usr/bin/bash", "args": ["bash", "-c", "echo $FOO > /tmp/none-existent-file"], "environment": ["FOO=BAR"]}' -- sleep infinity)
 timeout 30 bash -c "until test -e /tmp/none-existent-file; do sleep .5; done"
 grep -q "BAR" /tmp/none-existent-file
 kill "$PID"
 
 # Test varlinkctl's --exec fd passing logic properly
-assert_eq "$(varlinkctl --exec call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": "shell", "user": "root", "path": "/bin/bash", "args": ["/bin/bash", "-c", "echo $((7 + 8))"], "environment": ["TERM=dumb"]}' -- bash -c 'read -r -N 2 x <&3 ; echo "$x"')" 15
+assert_eq "$(varlinkctl --exec call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": "shell", "user": "root", "path": "/usr/bin/bash", "args": ["bash", "-c", "echo $((7 + 8))"], "environment": ["TERM=dumb"]}' -- bash -c 'read -r -N 2 x <&3 ; echo "$x"')" 15
 
 # test io.systemd.Machine.MapFrom
 varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.MapFrom '{"name": "long-running", "uid":0, "gid": 0}'
index 65dcc96b5942f5bfc340a5eb10a07a03daee4586..bae3e2e085c509605ccc4782c2627f5940a39283 100755 (executable)
@@ -351,7 +351,8 @@ EOF
 # Create a simple "entrypoint" script that validates that the container
 # is created correctly according to the OCI config
 cat >"$OCI/rootfs/entrypoint.sh" <<EOF
-#!/usr/bin/bash -e
+#!/usr/bin/env bash
+set -e
 
 # Mounts
 mountpoint /root
index 13ef96ad0a6359e8be3080ddf916ad6463fac070..2bd3962ffb90b9f43683ec18505755ecc3879080 100755 (executable)
@@ -193,7 +193,7 @@ testcase_sanity() {
     # "Fake" getent passwd's bare minimum, so we don't have to pull it in
     # with all the DSO shenanigans
     cat >"$root/bin/getent" <<\EOF
-#!/bin/bash
+#!/usr/bin/env bash
 
 if [[ $# -eq 0 ]]; then
     :
@@ -456,7 +456,7 @@ Port=tcp:60
 Port=udp:60:61
 EOF
     cat >"$root/entrypoint.sh" <<\EOF
-#!/bin/bash
+#!/usr/bin/env bash
 set -ex
 
 env
@@ -844,7 +844,7 @@ testcase_owneridmap() {
     # "Fake" getent passwd's bare minimum, so we don't have to pull it in
     # with all the DSO shenanigans
     cat >"$root/bin/getent" <<\EOF
-#!/bin/bash
+#!/usr/bin/env bash
 
 if [[ $# -eq 0 ]]; then
     :
@@ -869,7 +869,7 @@ EOF
                            --user=testuser \
                            --bind=/tmp/owneridmap/bind:/home/testuser:owneridmap \
                            ${COVERAGE_BUILD_DIR:+--bind="$COVERAGE_BUILD_DIR"} \
-                           /usr/bin/bash -c "$cmd" |& tee nspawn.out; then
+                           bash -c "$cmd" |& tee nspawn.out; then
         if grep -q "Failed to map ids for bind mount.*: Function not implemented" nspawn.out; then
             echo "idmapped mounts are not supported, skipping the test..."
             return 0
@@ -906,7 +906,8 @@ testcase_os_release() {
     create_dummy_container "$root"
     entrypoint="$root/entrypoint.sh"
     cat >"$entrypoint" <<\EOF
-#!/usr/bin/bash -ex
+#!/usr/bin/env bash
+set -ex
 
 . /tmp/os-release
 [[ -n "${ID:-}" && "$ID" != "$container_host_id" ]] && exit 1
@@ -953,7 +954,7 @@ testcase_machinectl_bind() {
     cat >"$service_path" <<EOF
 [Service]
 Type=notify
-ExecStart=systemd-nspawn --directory="$root" --notify-ready=no /usr/bin/bash -xec "$cmd"
+ExecStart=systemd-nspawn --directory="$root" --notify-ready=no bash -xec "$cmd"
 EOF
 
     systemctl daemon-reload
index a0dda91944420618f4c45c9641c6f32eb1250438..2735cf61b415dcbc888c61a6b72ed6f50b39209c 100755 (executable)
@@ -25,7 +25,8 @@ mount --bind "$(mktemp --tmpdir=/var/tmp -d)" /var/lib/machines
 # 1) Have no IP addresses assigned
 create_dummy_container /var/lib/machines/nss-mymachines-noip
 cat >/var/lib/machines/nss-mymachines-noip/sbin/init <<\EOF
-#!/usr/bin/bash -ex
+#!/usr/bin/env bash
+set -ex
 
 ip addr show dev ve-noip
 touch /initialized
@@ -38,7 +39,8 @@ EOF
 # 2) Have one IP address assigned (IPv4 only)
 create_dummy_container /var/lib/machines/nss-mymachines-singleip
 cat >/var/lib/machines/nss-mymachines-singleip/sbin/init <<\EOF
-#!/usr/bin/bash -ex
+#!/usr/bin/env bash
+set -ex
 
 ip addr add 10.1.0.2/24 dev ve-singleip
 ip addr show dev ve-singleip
@@ -51,7 +53,8 @@ EOF
 # 3) Have bunch of IP addresses assigned (both IPv4 and IPv6)
 create_dummy_container /var/lib/machines/nss-mymachines-manyips
 cat >/var/lib/machines/nss-mymachines-manyips/sbin/init <<\EOF
-#!/usr/bin/bash -ex
+#!/usr/bin/env bash
+set -ex
 
 ip addr add 10.2.0.2/24 dev ve-manyips
 for i in {100..120}; do
index 17ccb19c8ebc3aad1bfb5b1256f45d375c0e93d8..b9ac5d903b71ac7961693a5ccd56b8189cba9375 100755 (executable)
@@ -24,7 +24,7 @@ run0 -u testuser mkdir -p .local/state/machines
 
 create_dummy_container /home/testuser/.local/state/machines/zurps
 cat >/home/testuser/.local/state/machines/zurps/sbin/init <<EOF
-#!/bin/sh
+#!/usr/bin/env bash
 echo "I am living in a container"
 exec sleep infinity
 EOF
index c036bdbd6b5f77e05d3ea89d50601ca1a269cd57..dd850f41e1f95d00b10af0035857a6d925b4fa32 100755 (executable)
@@ -116,16 +116,16 @@ testcase_basic_dropins() {
 
     echo "*** test service.d/ top level drop-in"
     create_services test15-a test15-b
-    check_ko test15-a ExecCondition "/bin/echo a"
-    check_ko test15-b ExecCondition "/bin/echo b"
+    check_ko test15-a ExecCondition "echo a"
+    check_ko test15-b ExecCondition "echo b"
     mkdir -p /run/systemd/system/service.d
     cat >/run/systemd/system/service.d/override.conf <<EOF
 [Service]
-ExecCondition=/bin/echo %n
+ExecCondition=echo %n
 EOF
     systemctl daemon-reload
-    check_ok test15-a ExecCondition "/bin/echo test15-a"
-    check_ok test15-b ExecCondition "/bin/echo test15-b"
+    check_ok test15-a ExecCondition "echo test15-a"
+    check_ok test15-b ExecCondition "echo test15-b"
     rm -rf /run/systemd/system/service.d
 
     clear_units test15-{a,b,c,c1}.service
index c60995a975176bf6e1dc9362970d365b655c9942..19f3ed771b20cee9adfe91e24caa448083a8bd2c 100755 (executable)
@@ -70,21 +70,21 @@ runtime_max_sec=5
 systemd-run \
     --property=RuntimeMaxSec=${runtime_max_sec}s \
     -u runtime-max-sec-test-1.service \
-    /usr/bin/sh -c "while true; do sleep 1; done"
+    sh -c "while true; do sleep 1; done"
 wait_for_timeout runtime-max-sec-test-1.service $((runtime_max_sec + 2))
 
 systemd-run \
     --property=RuntimeMaxSec=${runtime_max_sec}s \
     --scope \
     -u runtime-max-sec-test-2.scope \
-    /usr/bin/sh -c "while true; do sleep 1; done" &
+    sh -c "while true; do sleep 1; done" &
 wait_for_timeout runtime-max-sec-test-2.scope $((runtime_max_sec + 2))
 
 # These ensure that RuntimeMaxSec is honored for scope and service
 # units if the value is changed and then the manager is reloaded.
 systemd-run \
     -u runtime-max-sec-test-3.service \
-    /usr/bin/sh -c "while true; do sleep 1; done"
+    sh -c "while true; do sleep 1; done"
 mkdir -p /etc/systemd/system/runtime-max-sec-test-3.service.d/
 cat > /etc/systemd/system/runtime-max-sec-test-3.service.d/override.conf << EOF
 [Service]
@@ -96,7 +96,7 @@ wait_for_timeout runtime-max-sec-test-3.service $((runtime_max_sec + 2))
 systemd-run \
     --scope \
     -u runtime-max-sec-test-4.scope \
-    /usr/bin/sh -c "while true; do sleep 1; done" &
+    sh -c "while true; do sleep 1; done" &
 
 # Wait until the unit is running to avoid race with creating the override.
 until systemctl is-active runtime-max-sec-test-4.scope; do
index 60be31a126ca3d64c523140aaf9ae2799977d1cd..d960ddd98112101aeda275169ae1227aa953f534 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 set -ex
 set -o pipefail
@@ -7,7 +7,7 @@ mkdir -p /run/udev/rules.d/
 
 cat >/run/udev/rules.d/50-testsuite.rules <<EOF
 SUBSYSTEM=="mem", KERNEL=="null", OPTIONS="log_level=debug"
-ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", IMPORT{program}="/bin/echo -e HOGE=aa\\\\x20\\\\x20\\\\x20bb\nFOO=\\\\x20aaa\\\\x20\n\n\n"
+ACTION=="add", SUBSYSTEM=="mem", KERNEL=="null", IMPORT{program}="/usr/bin/echo -e HOGE=aa\\\\x20\\\\x20\\\\x20bb\nFOO=\\\\x20aaa\\\\x20\n\n\n"
 EOF
 
 udevadm control --reload
index d1c3c8556672a5c9a0107616357d28f8c2962b16..81790d03eec6fd576247db96832fb144bac302c1 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 set -ex
 set -o pipefail
index 56ecf49e3b06e215f8773fc49eea398ea517e4d8..1dcef70a21095a07dbacf1635c54c184bf87ef1e 100755 (executable)
@@ -17,8 +17,8 @@ SUBSYSTEM!="mem", GOTO="test_end"
 KERNEL!="null", GOTO="test_end"
 
 OPTIONS="log_level=debug"
-PROGRAM=="/bin/touch /tmp/test-udev-marker"
-PROGRAM!="/bin/sleep 60", ENV{PROGRAM_RESULT}="KILLED"
+PROGRAM=="/usr/bin/touch /tmp/test-udev-marker"
+PROGRAM!="/usr/bin/sleep 60", ENV{PROGRAM_RESULT}="KILLED"
 
 LABEL="test_end"
 EOF
index 254cc0a2db07e649ca164a552b866b71e0600ecc..cb742082f54c8cf96c9ee3bf785388e6bafe599f 100755 (executable)
@@ -17,9 +17,9 @@ KERNEL!="null", GOTO="end"
 ACTION=="remove", GOTO="end"
 
 IMPORT{db}="INVOCATIONS"
-IMPORT{program}="/bin/bash -c 'systemctl show --property=InvocationID systemd-udevd.service'"
+IMPORT{program}="/usr/bin/bash -c 'systemctl show --property=InvocationID systemd-udevd.service'"
 ENV{INVOCATIONS}+="%E{ACTION}_%E{SEQNUM}_%E{InvocationID}"
-ACTION=="add", RUN+="/bin/bash -c ':> /tmp/marker'", RUN+="/usr/bin/sleep 10"
+ACTION=="add", RUN+="/usr/bin/bash -c ':> /tmp/marker'", RUN+="/usr/bin/sleep 10"
 
 LABEL="end"
 EOF
index f0c4f1a2a7f8c638909cfe422c34856f3cd64db0..8252b630d3538afbedb87e54f19d330cd3a223c8 100755 (executable)
@@ -160,13 +160,13 @@ echo "Failed to parse rules file $(pwd)/${rules}: No buffer space available" >"$
 assert_1 "${rules}"
 
 {
-    printf 'RUN+="/bin/true",%8174s\\\n' ' '
-    printf 'RUN+="/bin/false"%8174s\\\n' ' '
+    printf 'RUN+="/usr/bin/true",%8170s\\\n' ' '
+    printf 'RUN+="/usr/bin/false"%8170s\\\n' ' '
     echo
 } >"${rules}"
 assert_0 "${rules}"
 
-printf 'RUN+="/bin/true"%8176s\\\n #\n' ' ' ' ' >"${rules}"
+printf 'RUN+="/usr/bin/true"%8176s\\\n #\n' ' ' ' ' >"${rules}"
 echo >>"${rules}"
 cat >"${exp}" <<EOF
 $(pwd)/${rules}:1 Line is too long, ignored.
index 14a05648950a42bab7dad95388ed46d55d4905ba..c681d748407926036c94d9d2c3341b7340ac5c87 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 set -ex
 set -o pipefail
index cadefe26d5f4362773be60a75b8ac5f9d7bab85d..cde875e1cdb7e8f453fbe801f3f77e14983e6743 100755 (executable)
@@ -43,7 +43,7 @@ EOF
 testcase_iodevice_unitfile () {
     cat >/run/systemd/system/test1.service <<EOF
 [Service]
-ExecStart=/usr/bin/sleep inf
+ExecStart=sleep inf
 IOReadBandwidthMax=/dev/sda1 1M
 IOReadBandwidthMax=/dev/sda2 2M
 IOReadBandwidthMax=/dev/sda3 4M
index 2276b75d35573257f945c7e60a6a9889c5021e00..4159796dae3ce1cfcf93e6b21d2691de2147ae39 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # With "e" don't attempt to set permissions when file doesn't exist, see
index f191ae3ee7c27f6e831cb0f154fb1b957560bd2d..60d2c1156d53d45887d297d91dd8019fbd9d1909 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Basic tests for types creating directories
index d1584987551bd6fe2bbec9e12687bdd13f299aa2..d75294207aaffba1685d973f384b5dd7366332ec 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Basic tests for types creating/writing files
index 2c0ffe32ae08819d73d4c2199d6f899ece042888..d92a63474769cbd04ed3983c6a79db457d3391a8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Basic tests for types creating fifos
index d78e7ee8d229d65575c51624f92e2844dfd6af50..23bc786224e3cd50a95b13e37565d46285e2c9f3 100755 (executable)
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 set -eux
 set -o pipefail
index 45aea9c6b834f669a491f62a5cb06637287e4201..87db07b73c324acf62c38271dfba14b666b871bd 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Inspired by https://github.com/systemd/systemd/issues/9508
index de20d5ee900e55cba171940d9664f93054ad7f82..2683cf692eba581fc630dc2cb13df72b26ab791c 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Verifies the issues described by https://github.com/systemd/systemd/issues/10191
index 40fafd33bfe6c6be07a2490f8a4f57b4aeab54aa..058bc2bc23220ff25fc33d2d5b8433499352f3a0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Verify tmpfiles can run in a root directory under a path prefix that contains
index 33ef451f2a98eede8c480f194282d2a9a8322f0c..43f41df3d4f0ec17de71b60c8c781cd3da66782f 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Tests for configuration directory and file precedences
index 2132de7a323af7e112649bb102da0b56daddcbac..40cee89359e8347067f525305902e1c71d4f832e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Tests for the ":" uid/gid/mode modifier
index 6ee0e6379160b4a3e0a291ff071cc64470cb7ecf..14c26b829582289e531e8a5297a7437a51bb5ad8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Check specifier expansion in L lines.
index 3d3d0c88e7b6d7daa54f52359289937f1f70caba..97983421d3fff1880a32a4bc50a06255d46cdd3e 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Test for conditionalized execute bit ('X' bit)
index f43aba5ad9ecc178fa9d157b91470c50c6b807bd..4974798ca777f1c23e74e68813477b0e0f444dc0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Test for C-style escapes in file names and contents
index c81f6bd0ef5a7571b4d1fa18df5a5d102a4f4334..1a4378fb6d0e41ced0a48b8beb63084e5bd94579 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Tests for the --purge switch
index c5a09664143c08509767c4c7ce0b1daf984b04e8..803b3060d69615051f109a297dc0b37d8d4e0a2f 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 # SPDX-License-Identifier: LGPL-2.1-or-later
 #
 # Tests for character and block device creation
index d544ce6047c87e97c3c1db9d7104bfb241d0bbca..ae16871ffc1853834ed1f01371ea87cea680399a 100755 (executable)
@@ -15,7 +15,7 @@ echo "[#1] Failing ExecReload= should not kill the service"
 cat >"$SERVICE_PATH" <<EOF
 [Service]
 ExecStart=sleep infinity
-ExecReload=/bin/false
+ExecReload=false
 EOF
 
 systemctl daemon-reload
@@ -31,9 +31,9 @@ echo "[#2] Failing ExecReload= should not kill the service (multiple ExecReload=
 cat >"$SERVICE_PATH" <<EOF
 [Service]
 ExecStart=sleep infinity
-ExecReload=/bin/true
-ExecReload=/bin/false
-ExecReload=/bin/true
+ExecReload=true
+ExecReload=false
+ExecReload=true
 EOF
 
 systemctl daemon-reload
@@ -48,7 +48,7 @@ echo "[#3] Failing ExecReload=- should not affect reload's exit code"
 cat >"$SERVICE_PATH" <<EOF
 [Service]
 ExecStart=sleep infinity
-ExecReload=-/bin/false
+ExecReload=-false
 EOF
 
 systemctl daemon-reload
index aeaf3aa3829182a16d2abff88cd303f804b8aba8..8d9fa670fd542ab7a14dd3c45f42d21e9a889c1b 100755 (executable)
@@ -7,19 +7,19 @@ set -eux
 systemd-analyze log-level debug
 
 systemd-run --unit=simple1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=simple \
-    -p ExecStopPost='/bin/touch /run/simple1' true
+    -p ExecStopPost='touch /run/simple1' true
 test -f /run/simple1
 
 (! systemd-run --unit=simple2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=simple \
-    -p ExecStopPost='/bin/touch /run/simple2' false)
+    -p ExecStopPost='touch /run/simple2' false)
 test -f /run/simple2
 
 systemd-run --unit=exec1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=exec \
-    -p ExecStopPost='/bin/touch /run/exec1' sleep 1
+    -p ExecStopPost='touch /run/exec1' sleep 1
 test -f /run/exec1
 
 (! systemd-run --unit=exec2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=exec \
-   -p ExecStopPost='/bin/touch /run/exec2' sh -c 'sleep 1; false')
+   -p ExecStopPost='touch /run/exec2' sh -c 'sleep 1; false')
 test -f /run/exec2
 
 cat >/tmp/forking1.sh <<EOF
@@ -36,7 +36,7 @@ EOF
 chmod +x /tmp/forking1.sh
 
 systemd-run --unit=forking1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=forking -p NotifyAccess=exec \
-        -p ExecStopPost='/bin/touch /run/forking1' /tmp/forking1.sh
+        -p ExecStopPost='touch /run/forking1' /tmp/forking1.sh
 test -f /run/forking1
 
 cat >/tmp/forking2.sh <<EOF
@@ -53,29 +53,29 @@ EOF
 chmod +x /tmp/forking2.sh
 
 (! systemd-run --unit=forking2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=forking -p NotifyAccess=exec \
-    -p ExecStopPost='/bin/touch /run/forking2' /tmp/forking2.sh)
+    -p ExecStopPost='touch /run/forking2' /tmp/forking2.sh)
 test -f /run/forking2
 
 systemd-run --unit=oneshot1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=oneshot \
-    -p ExecStopPost='/bin/touch /run/oneshot1' true
+    -p ExecStopPost='touch /run/oneshot1' true
 test -f /run/oneshot1
 
 (! systemd-run --unit=oneshot2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=oneshot \
-    -p ExecStopPost='/bin/touch /run/oneshot2' false)
+    -p ExecStopPost='touch /run/oneshot2' false)
 test -f /run/oneshot2
 
 systemd-run --unit=dbus1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p BusName=systemd.test.ExecStopPost \
-    -p ExecStopPost='/bin/touch /run/dbus1' \
+    -p ExecStopPost='touch /run/dbus1' \
     busctl call org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus RequestName su systemd.test.ExecStopPost 4 || :
 test -f /run/dbus1
 
 systemd-run --unit=dbus2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p BusName=systemd.test.ExecStopPost \
-     -p ExecStopPost='/bin/touch /run/dbus2' true
+    -p ExecStopPost='touch /run/dbus2' true
 test -f /run/dbus2
 
 # https://github.com/systemd/systemd/issues/19920
 (! systemd-run --unit=dbus3.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus \
-    -p ExecStopPost='/bin/touch /run/dbus3' true)
+    -p ExecStopPost='touch /run/dbus3' true)
 
 cat >/tmp/notify1.sh <<EOF
 #!/usr/bin/env bash
@@ -87,18 +87,19 @@ EOF
 chmod +x /tmp/notify1.sh
 
 systemd-run --unit=notify1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=notify \
-    -p ExecStopPost='/bin/touch /run/notify1' /tmp/notify1.sh
+    -p ExecStopPost='touch /run/notify1' /tmp/notify1.sh
 test -f /run/notify1
 
 (! systemd-run --unit=notify2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=notify \
-    -p ExecStopPost='/bin/touch /run/notify2' true)
+    -p ExecStopPost='touch /run/notify2' true)
 test -f /run/notify2
 
-systemd-run --unit=idle1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=idle -p ExecStopPost='/bin/touch /run/idle1' true
+systemd-run --unit=idle1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=idle \
+    -p ExecStopPost='touch /run/idle1' true
 test -f /run/idle1
 
 (! systemd-run --unit=idle2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=idle \
-     -p ExecStopPost='/bin/touch /run/idle2' false)
+    -p ExecStopPost='touch /run/idle2' false)
 test -f /run/idle2
 
 systemd-analyze log-level info
index f8dceb1dcce47e630c55d6a1d9df3f49384879ff..756d24848bbe6d2c06be91f4b18e243fe27765da 100755 (executable)
@@ -20,16 +20,16 @@ property[7_seven]=ExecStopPost
 # These should all get upgraded to the corresponding Ex property as the non-Ex variant
 # does not support the ":" prefix (no-env-expand).
 for c in "${!property[@]}"; do
-    systemd-run --unit="$c" -r -p "Type=oneshot" -p "${property[$c]}=:/bin/echo \${$c}" true
-    systemctl show -p "${property[$c]}" "$c" | grep -F "path=/bin/echo ; argv[]=/bin/echo \${$c} ; ignore_errors=no"
-    systemctl show -p "${property[$c]}Ex" "$c" | grep -F "path=/bin/echo ; argv[]=/bin/echo \${$c} ; flags=no-env-expand"
+    systemd-run --unit="$c" -r -p "Type=oneshot" -p "${property[$c]}=:echo \${$c}" true
+    systemctl show -p "${property[$c]}" "$c" | grep -F "path=echo ; argv[]=echo \${$c} ; ignore_errors=no"
+    systemctl show -p "${property[$c]}Ex" "$c" | grep -F "path=echo ; argv[]=echo \${$c} ; flags=no-env-expand"
 done
 
 # Ex names on the commandline are supported for backward compat.
 for c in "${!property[@]}"; do
-    systemd-run --unit="${c}_ex" -r -p "Type=oneshot" -p "${property[$c]}Ex=:/bin/echo \${$c}" true
-    systemctl show -p "${property[$c]}" "$c" | grep -F "path=/bin/echo ; argv[]=/bin/echo \${$c} ; ignore_errors=no"
-    systemctl show -p "${property[$c]}Ex" "$c" | grep -F "path=/bin/echo ; argv[]=/bin/echo \${$c} ; flags=no-env-expand"
+    systemd-run --unit="${c}_ex" -r -p "Type=oneshot" -p "${property[$c]}Ex=:echo \${$c}" true
+    systemctl show -p "${property[$c]}" "$c" | grep -F "path=echo ; argv[]=echo \${$c} ; ignore_errors=no"
+    systemctl show -p "${property[$c]}Ex" "$c" | grep -F "path=echo ; argv[]=echo \${$c} ; flags=no-env-expand"
 done
 
 systemd-analyze log-level info
index b5a4d2d30a7c565395d969b01eabf75287cb1c5d..9d2760ee8b762593c312681bb678eca2493fedd2 100755 (executable)
@@ -14,7 +14,7 @@ MAX_SECS=60
 systemctl log-level debug
 
 # test one: Restart=on-failure should restart the service
-(! systemd-run --unit=oneshot-restart-one -p Type=oneshot -p Restart=on-failure /bin/bash -c "exit 1")
+(! systemd-run --unit=oneshot-restart-one -p Type=oneshot -p Restart=on-failure bash -c "exit 1")
 
 for ((secs = 0; secs < MAX_SECS; secs++)); do
     [[ "$(systemctl show oneshot-restart-one.service -P NRestarts)" -le 0 ]] || break
@@ -35,7 +35,7 @@ TMP_FILE="/tmp/test-23-oneshot-restart-test$RANDOM"
         -p StartLimitBurst=3 \
         -p Type=oneshot \
         -p Restart=on-failure \
-        -p ExecStart="/bin/bash -c 'printf a >>$TMP_FILE'" /bin/bash -c "exit 1")
+        -p ExecStart="bash -c 'printf a >>$TMP_FILE'" bash -c "exit 1")
 
 # wait for at least 3 restarts
 for ((secs = 0; secs < MAX_SECS; secs++)); do
index cc30f0a27df36c4ecaa33ac196370d35a649627c..f2b3adb0d25b27d9e6812356d13b55803fe30f3a 100755 (executable)
@@ -16,13 +16,13 @@ systemctl start user@0.service
 ( ! test -d "$HOME"/.local/state/foo)
 ( ! test -d "$HOME"/.config/foo)
 
-systemd-run --user -p StateDirectory=foo --wait /bin/true
+systemd-run --user -p StateDirectory=foo --wait true
 
 test -d "$HOME"/.local/state/foo
 ( ! test -L "$HOME"/.local/state/foo)
 ( ! test -d "$HOME"/.config/foo)
 
-systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait /bin/true
+systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait true
 
 test -d "$HOME"/.local/state/foo
 ( ! test -L "$HOME"/.local/state/foo)
@@ -30,7 +30,7 @@ test -d "$HOME"/.config/foo
 
 rmdir "$HOME"/.local/state/foo "$HOME"/.config/foo
 
-systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait /bin/true
+systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait true
 
 test -d "$HOME"/.local/state/foo
 ( ! test -L "$HOME"/.local/state/foo)
@@ -39,13 +39,13 @@ test -d "$HOME"/.config/foo
 rmdir "$HOME"/.local/state/foo "$HOME"/.config/foo
 
 # Now trigger an update scenario by creating a config dir first
-systemd-run --user -p ConfigurationDirectory=foo --wait /bin/true
+systemd-run --user -p ConfigurationDirectory=foo --wait true
 
 ( ! test -d "$HOME"/.local/state/foo)
 test -d "$HOME"/.config/foo
 
 # This will look like an update and result in a symlink
-systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait /bin/true
+systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait true
 
 test -d "$HOME"/.local/state/foo
 test -L "$HOME"/.local/state/foo
@@ -54,7 +54,7 @@ test -d "$HOME"/.config/foo
 test "$(readlink "$HOME"/.local/state/foo)" = ../../.config/foo
 
 # Check that this will work safely a second time
-systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait /bin/true
+systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait true
 
 ( ! systemd-run --user -p StateDirectory=foo::ro --wait sh -c "echo foo > $HOME/.local/state/foo/baz")
 ( ! systemd-run --user -p StateDirectory=foo:bar:ro --wait sh -c "echo foo > $HOME/.local/state/foo/baz")
index 87f32ccb586f6627b7c9d474276ff7c9a9885d74..d5497efff2ac35ba1a0bc34010a6c7fbb84776ab 100755 (executable)
@@ -12,16 +12,16 @@ touch /tmp/brokenbinary
 chmod +x /tmp/brokenbinary
 
 # These three commands should succeed.
-systemd-run --unit=exec-one -p Type=simple /bin/sleep infinity
-systemd-run --unit=exec-two -p Type=simple -p User=idontexist /bin/sleep infinity
+systemd-run --unit=exec-one -p Type=simple sleep infinity
+systemd-run --unit=exec-two -p Type=simple -p User=idontexist sleep infinity
 systemd-run --unit=exec-three -p Type=simple /tmp/brokenbinary
 
 # And now, do the same with Type=exec, where the latter two should fail
-systemd-run --unit=exec-four -p Type=exec /bin/sleep infinity
-(! systemd-run --unit=exec-five -p Type=exec -p User=idontexist /bin/sleep infinity)
+systemd-run --unit=exec-four -p Type=exec sleep infinity
+(! systemd-run --unit=exec-five -p Type=exec -p User=idontexist sleep infinity)
 (! systemd-run --unit=exec-six -p Type=exec /tmp/brokenbinary)
 
-systemd-run --unit=exec-seven -p KillSignal=SIGTERM -p RestartKillSignal=SIGINT -p Type=exec /bin/sleep infinity
+systemd-run --unit=exec-seven -p KillSignal=SIGTERM -p RestartKillSignal=SIGINT -p Type=exec sleep infinity
 # Both TERM and SIGINT happen to have the same number on all architectures
 test "$(systemctl show --value -p KillSignal exec-seven.service)" -eq 15
 test "$(systemctl show --value -p RestartKillSignal exec-seven.service)" -eq 2
@@ -37,7 +37,7 @@ busctl call \
     org.freedesktop.systemd1.Manager StartTransientUnit \
     "ssa(sv)a(sa(sv))" test-20933-ok.service replace 1 \
       ExecStart "a(sasb)" 1 \
-        /usr/bin/sleep 2 /usr/bin/sleep 1 true \
+        sleep 2 sleep 1 true \
     0
 
 # DBus call should fail but not crash systemd
@@ -46,7 +46,7 @@ busctl call \
     org.freedesktop.systemd1.Manager StartTransientUnit \
     "ssa(sv)a(sa(sv))" test-20933-bad.service replace 1 \
       ExecStart "a(sasb)" 1 \
-        /usr/bin/sleep 0 true \
+        sleep 0 true \
     0)
 
 # Same but with the empty argv in the middle
@@ -55,9 +55,9 @@ busctl call \
     org.freedesktop.systemd1.Manager StartTransientUnit \
     "ssa(sv)a(sa(sv))" test-20933-bad-middle.service replace 1 \
       ExecStart "a(sasb)" 3 \
-        /usr/bin/sleep 2 /usr/bin/sleep 1 true \
-        /usr/bin/sleep 0                  true \
-        /usr/bin/sleep 2 /usr/bin/sleep 1 true \
+        sleep 2 sleep 1 true \
+        sleep 0         true \
+        sleep 2 sleep 1 true \
     0)
 
 systemd-analyze log-level info
index cc6b84498957da35cb9e7be9d09fce856266f4b7..d5f9c02a03c7a9d25f31d43a30f7de185bb7bdc7 100755 (executable)
@@ -258,7 +258,7 @@ systemctl revert "$UNIT_NAME"
 (! grep -r "CPUQuota=" "/run/systemd/system.control/${UNIT_NAME}.d/")
 
 # Failed-unit related tests
-(! systemd-run --wait --unit "failed.service" /bin/false)
+(! systemd-run --wait --unit "failed.service" false)
 systemctl is-failed failed.service
 systemctl --state=failed | grep failed.service
 systemctl --failed | grep failed.service
@@ -405,7 +405,7 @@ if [[ -x /usr/lib/systemd/system-generators/systemd-sysv-generator ]]; then
 
     # invalid dependency
     cat >"${SYSVINIT_PATH:?}/issue-24990" <<\EOF
-#!/bin/bash
+#!/usr/bin/env bash
 
 ### BEGIN INIT INFO
 # Provides:test1 test2
@@ -459,7 +459,7 @@ EOF
 
     # valid dependency
     cat >"$SYSVINIT_PATH/issue-24990" <<\EOF
-#!/bin/bash
+#!/usr/bin/env bash
 
 ### BEGIN INIT INFO
 # Provides:test1 test2
index e5aee475af7b3d3a545e9b383319801eaf29dbd5..05d645c35efe81dc1c14a08fbaef6f1b92eaf251 100755 (executable)
@@ -180,7 +180,7 @@ PrivateUsers=yes
 TemporaryFileSystem=/run /var/opt /var/lib /vol
 UMask=0000
 StateDirectory=testidmapped:sampleservice
-ExecStart=/bin/bash -c ' \
+ExecStart=bash -c ' \
     set -eux; \
     set -o pipefail; \
     touch /var/lib/sampleservice/testfile; \
@@ -213,7 +213,7 @@ PrivateUsers=no
 TemporaryFileSystem=/run /var/opt /var/lib /vol
 UMask=0000
 StateDirectory=testidmapped:sampleservice
-ExecStart=/bin/bash -c ' \
+ExecStart=bash -c ' \
     set -eux; \
     set -o pipefail; \
     touch /var/lib/sampleservice/testfile; \
index 49ce59d5b9aead378f145618b9db1e3e4d2e127b..b714fce67aa68b953870fe84579df1a5277da96c 100755 (executable)
@@ -21,7 +21,7 @@ cleanup_test_user() (
 
 setup_test_user() {
     mkdir -p /var/spool/cron /var/spool/mail
-    useradd -m -s /bin/bash logind-test-user
+    useradd -m -s /usr/bin/bash logind-test-user
     trap cleanup_test_user EXIT
 }
 
@@ -351,7 +351,7 @@ create_session() {
 [Service]
 Type=simple
 ExecStart=
-ExecStart=-/usr/sbin/agetty --autologin logind-test-user --noclear %I $TERM
+ExecStart=-agetty --autologin logind-test-user --noclear %I $TERM
 Restart=no
 EOF
     systemctl daemon-reload
@@ -679,7 +679,7 @@ session required   pam_unix.so
 EOF
 
     cat > "$SCRIPT" <<'EOF'
-#!/bin/bash
+#!/usr/bin/env bash
 set -ex
 typeset -i AMB MASK
 AMB="0x$(grep 'CapAmb:' /proc/self/status | cut -d: -f2 | tr -d '[:space:]')"
index 5ce073d045cc75b9845060e11e3025f7f3a99a14..31f28c9ef12002d7f6f220d5770d344464fea13e 100755 (executable)
@@ -339,7 +339,7 @@ testcase_watchdog() {
     local unit="wd.service"
 
     systemd-run --collect --unit "$unit" --property WatchdogSec=4s --property Type=notify \
-        /bin/bash -c 'systemd-notify --ready; while true; do systemd-notify WATCHDOG=1; sleep 1; done'
+        bash -c 'systemd-notify --ready; while true; do systemd-notify WATCHDOG=1; sleep 1; done'
 
     systemctl freeze "$unit"
     check_freezer_state "$unit" "frozen"
index f8a2a624676a1065fa88c09da1cdb48fe75161a3..0805a5caf9449e018e5eb7def2c9285376fab312 100755 (executable)
@@ -93,7 +93,7 @@ runas testuser systemd-run --wait --user --unit=test-devices \
 # Same check as test/test-execute/exec-privatenetwork-yes.service
 runas testuser systemd-run --wait --user --unit=test-network \
     -p PrivateNetwork=yes \
-    /bin/sh -x -c '! ip link | grep -E "^[0-9]+: " | grep -Ev ": (lo|(erspan|gre|gretap|ip_vti|ip6_vti|ip6gre|ip6tnl|sit|tunl)0@.*):"'
+    sh -x -c '! ip link | grep -E "^[0-9]+: " | grep -Ev ": (lo|(erspan|gre|gretap|ip_vti|ip6_vti|ip6gre|ip6tnl|sit|tunl)0@.*):"'
 
 (! runas testuser systemd-run --wait --user --unit=test-hostname \
     -p ProtectHostname=yes \
index 8a6aa54fa19bc876cecff49065a6e18c19a1abb5..b18a6c11f87e98a324ebca487ab0885e84c5334e 100755 (executable)
@@ -519,14 +519,14 @@ userdbctl ssh-authorized-keys dropinuser | tee /tmp/authorized-keys
 grep "ssh-ed25519" /tmp/authorized-keys
 grep "ecdsa-sha2-nistp256" /tmp/authorized-keys
 echo "my-top-secret-key 🐱" >/tmp/my-top-secret-key
-userdbctl ssh-authorized-keys dropinuser --chain /bin/cat /tmp/my-top-secret-key | tee /tmp/authorized-keys
+userdbctl ssh-authorized-keys dropinuser --chain /usr/bin/cat /tmp/my-top-secret-key | tee /tmp/authorized-keys
 grep "ssh-ed25519" /tmp/authorized-keys
 grep "ecdsa-sha2-nistp256" /tmp/authorized-keys
 grep "my-top-secret-key 🐱" /tmp/authorized-keys
 (! userdbctl ssh-authorized-keys 🐱)
 (! userdbctl ssh-authorized-keys dropin-user --chain)
 (! userdbctl ssh-authorized-keys dropin-user --chain '')
-(! SYSTEMD_LOG_LEVEL=debug userdbctl ssh-authorized-keys dropin-user --chain /bin/false)
+(! SYSTEMD_LOG_LEVEL=debug userdbctl ssh-authorized-keys dropin-user --chain /usr/bin/false)
 
 (! userdbctl '')
 for opt in json multiplexer output synthesize with-dropin with-nss with-varlink; do
@@ -611,7 +611,7 @@ EOF
 
     cat >/run/systemd/system/mysshserver@.service <<EOF
 [Service]
-ExecStart=-/usr/sbin/sshd -i -d -e
+ExecStart=-sshd -i -d -e
 StandardInput=socket
 StandardOutput=socket
 StandardError=journal
index 9f8ecfc1b7804a049a48b8b9e6c11da13b314225..36624d2a11d16d03cd6e972be522866891e01c08 100755 (executable)
@@ -3,7 +3,7 @@
 set -eux
 set -o pipefail
 
-# Check that the /sbin/mount.ddi helper works
+# Check that the /usr/sbin/mount.ddi helper works
 dir="/tmp/mounthelper.$RANDOM"
 mount -t ddi "$MINIMAL_IMAGE.gpt" "$dir" -o ro,X-mount.mkdir,discard
 umount -R "$dir"
index e8521f4d1c053c4984999b61e6d199988e77feff..bd0ce438a0d8a05f998dc9745eb52278b9ec8d78 100755 (executable)
@@ -29,9 +29,9 @@ systemd-dissect "$MINIMAL_IMAGE.raw" | grep -q -F -f <(sed 's/"//g' "$OS_RELEASE
 
 systemd-dissect --list "$MINIMAL_IMAGE.raw" | grep -q '^etc/os-release$'
 systemd-dissect --mtree "$MINIMAL_IMAGE.raw" --mtree-hash yes | \
-    grep -qe "^./usr/bin/cat type=file mode=0755 uid=0 gid=0 size=[0-9]* sha256sum=[a-z0-9]*$"
+    grep -qE "^.(/usr|)/bin/cat type=file mode=0755 uid=0 gid=0 size=[0-9]* sha256sum=[a-z0-9]*$"
 systemd-dissect --mtree "$MINIMAL_IMAGE.raw" --mtree-hash no  | \
-    grep -qe "^./usr/bin/cat type=file mode=0755 uid=0 gid=0 size=[0-9]*$"
+    grep -qE "^.(/usr|)/bin/cat type=file mode=0755 uid=0 gid=0 size=[0-9]*$"
 
 read -r SHA256SUM1 _ < <(systemd-dissect --copy-from "$MINIMAL_IMAGE.raw" etc/os-release | sha256sum)
 test "$SHA256SUM1" != ""
@@ -879,7 +879,7 @@ echo "ID=_any" >/run/confexts/test/etc/extension-release.d/extension-release.tes
 echo "ARCHITECTURE=_any" >>/run/confexts/test/etc/extension-release.d/extension-release.test
 echo "MARKER_CONFEXT_123" >/run/confexts/test/etc/testfile
 cat <<EOF >/run/confexts/test/etc/testscript
-#!/bin/bash
+#!/usr/bin/env bash
 echo "This should not happen"
 EOF
 chmod +x /run/confexts/test/etc/testscript
index 7016aee85a3fcbbd0862cda52b938cf827c8dac1..d349b0f3e453ce81e56b6f9d325da2406f3d481e 100755 (executable)
@@ -24,7 +24,7 @@ run_with_cred_compare() (
 )
 
 test_mount_with_credential() {
-    local credfile tmpdir unit
+    local credfile tmpdir unit mount_path mount_test
     credfile="/tmp/mount-cred"
     tmpdir="/tmp/test-54-mount"
     unit=$(systemd-escape --suffix mount --path "$tmpdir")
@@ -42,14 +42,16 @@ LoadCredential=loadcred:$credfile
 EOF
 
     # Set up test mount type
-    cat >/usr/sbin/mount.thisisatest <<EOF
+    mount_path="$(command -v mount 2>/dev/null)"
+    mount_test="${mount_path/\/bin/\/sbin}.thisisatest"
+    cat >"$mount_test" <<EOF
 #!/usr/bin/env bash
 # Mount after verifying credential file content
 if [ \$(cat \${CREDENTIALS_DIRECTORY}/loadcred) = "foo" ]; then
     mount -t tmpfs \$1 \$2
 fi
 EOF
-    chmod +x /usr/sbin/mount.thisisatest
+    chmod +x "$mount_test"
 
     # Verify mount succeeds
     systemctl daemon-reload
@@ -62,7 +64,7 @@ EOF
 
     # Stop unit and delete files
     systemctl stop "$unit"
-    rm -f "$credfile" /run/systemd/system/"$unit" /usr/sbin/mount.thisisatest
+    rm -f "$credfile" /run/systemd/system/"$unit" "$mount_test"
     rm -rf "$tmpdir"
 }
 
index 70851cc553f5075d0ac975f62ce789ca33f64913..a28c6856a54bc747496740c3e87ebd730a26f45d 100755 (executable)
@@ -93,7 +93,7 @@ EOF
 else
     # Ensure that we can start services even with a very low hard memory cap without oom-kills, but skip
     # under sanitizers as they balloon memory usage.
-    systemd-run -t -p MemoryMax=10M -p MemorySwapMax=0 -p MemoryZSwapMax=0 /bin/true
+    systemd-run -t -p MemoryMax=10M -p MemorySwapMax=0 -p MemoryZSwapMax=0 true
 fi
 
 test_basic() {
@@ -302,7 +302,7 @@ testcase_reload() {
 
 testcase_kernel_oom() {
     cat >/tmp/script.sh <<"EOF"
-#!/bin/bash
+#!/usr/bin/env bash
 choom --adjust '+1000' -- bash -c 'echo f >/proc/sysrq-trigger && exec sleep infinity'
 choom --adjust '+1000' -p $$
 echo f >/proc/sysrq-trigger
@@ -325,7 +325,7 @@ EOF
     systemctl reset-failed
 
     cat >/tmp/script.sh <<"EOF"
-#!/bin/bash
+#!/usr/bin/env bash
 echo '+memory' >/sys/fs/cgroup/system.slice/oom-kill.service/cgroup.subtree_control
 mkdir /sys/fs/cgroup/system.slice/oom-kill.service/sub
 echo 1 >/sys/fs/cgroup/system.slice/oom-kill.service/sub/memory.oom.group
index 028ad7e3a21d71725661102291d3d108813c821c..d91e22225e17b94726a78cda9bb0fd17df7b2811 100755 (executable)
@@ -68,7 +68,7 @@ testcase_issue_23796() {
     mount_path="$(command -v mount 2>/dev/null)"
     mount_mytmpfs="${mount_path/\/bin/\/sbin}.mytmpfs"
     cat >"$mount_mytmpfs" <<EOF
-#!/bin/bash
+#!/usr/bin/env bash
 sleep ".\$RANDOM"
 exec -- $mount_path -t tmpfs tmpfs "\$2"
 EOF
index 0c5b538cc9bb93187ae1b1b49a1a4827edf492aa..233b79951a13b670678c19ee307ce3b56650644c 100755 (executable)
@@ -1133,7 +1133,7 @@ Description=Test unit for systemd-analyze unit-shell
 [Service]
 Type=notify
 NotifyAccess=all
-ExecStart=/bin/sh -c "echo 'Hello from test unit' >/tmp/testfile; systemd-notify --ready; sleep infinity"
+ExecStart=sh -c "echo 'Hello from test unit' >/tmp/testfile; systemd-notify --ready; sleep infinity"
 PrivateTmp=disconnected
 EOF
 # Start the service
index d717ce5a557d1a8e0cc1e08e59bbb3acf9120801..70743b78df15f4de640d2ef3661b7877bf4395d4 100755 (executable)
@@ -69,7 +69,7 @@ EOF
 # Script to check that when an OnSuccess= dependency fires, the correct
 # MONITOR* env variables are passed.
 cat >/tmp/check_on_success.sh <<"EOF"
-#!/bin/sh
+#!/usr/bin/env bash
 
 set -ex
 env | sort
@@ -126,7 +126,7 @@ EOF
 # Script to check that when an OnFailure= dependency fires, the correct
 # MONITOR* env variables are passed.
 cat >/tmp/check_on_failure.sh <<"EOF"
-#!/bin/sh
+#!/usr/bin/env bash
 
 set -ex
 env | sort
index 4e554702abbcc5e6c6284d6f11f1732339a877b7..51569bf51ef3494aa4055468bc06c959bebd3646 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
 # SPDX-License-Identifier: LGPL-2.1-or-later
 # pylint: disable=broad-except
 
index 1ae1df1142e9623386cabce6d72b33cd9c7af4f5..421ebb74b784114cddcde33cbbfb52c504892746 100755 (executable)
@@ -19,6 +19,6 @@ systemd-tty-ask-password-agent --list
 varlinkctl introspect /run/systemd/io.systemd.AskPassword
 
 # Spawn an agent that always replies all ask password requests with "waldo"
-systemd-run -u waldo-ask-pw-agent.service -p Environment=SYSTEMD_ASK_PASSWORD_AGENT_PASSWORD=waldo -p Type=notify /usr/bin/systemd-tty-ask-password-agent --watch --console=/dev/console
+systemd-run -u waldo-ask-pw-agent.service -p Environment=SYSTEMD_ASK_PASSWORD_AGENT_PASSWORD=waldo -p Type=notify systemd-tty-ask-password-agent --watch --console=/dev/console
 assert_eq "$(systemd-ask-password --no-tty)" "waldo"
 assert_eq "$(varlinkctl call /usr/bin/systemd-ask-password io.systemd.AskPassword.Ask '{"message":"foobar"}' | jq '.passwords[0]')" "\"waldo\""
index e7b5c8774707cb62fe04e00d98d4165033589e89..06f6a1ca6e2ca45ddb180d030c7129c90a0230b3 100755 (executable)
@@ -36,7 +36,7 @@ busctl -C foobar
 
 systemctl -C foobar
 
-systemd-run -C foobar -u sleepinfinity /bin/sleep infinity
+systemd-run -C foobar -u sleepinfinity sleep infinity
 
 systemctl -C foobar status sleepinfinity
 
index dabe2347093539e964feeae8342d33b7cedfa94f..15f5df05572d9af6a3656e9a57afed6d447581c4 100755 (executable)
@@ -29,7 +29,7 @@ systemctl mask delta-test-unit-masked.service
 # Overridden unit
 cp -fv /run/systemd/system/delta-test-unit-extended.service /run/systemd/system/delta-test-unit-overridden.service
 cp -fv /run/systemd/system/delta-test-unit-overridden.service /etc/systemd/system/delta-test-unit-overridden.service
-echo "ExecStartPost=/bin/true" >>/etc/systemd/system/delta-test-unit-overridden.service
+echo "ExecStartPost=true" >>/etc/systemd/system/delta-test-unit-overridden.service
 # Overridden but equivalent unit
 ln -srfv /run/systemd/system/delta-test-unit-extended.service /run/systemd/system/delta-test-unit-equivalent.service
 ln -sfv /run/systemd/system/delta-test-unit-extended.service /etc/systemd/system/delta-test-unit-equivalent.service
index deb493526281ed663d2a263a2b55b8e58c6fb079..6d35802ee3f5af62b52f5648906b68920fd0669c 100755 (executable)
@@ -7,7 +7,7 @@ systemd-pty-forward --background 41 --title test echo foobar
 
 # Test that signals are forwarded to the systemd-pty-forward child process.
 cat >/tmp/child <<\EOF
-#!/usr/bin/bash
+#!/usr/bin/env bash
 set -x
 
 trap 'touch /tmp/int' INT
index 19b4f113bb4df26bb71a7670d11cca6d58ff581b..c7ca8ce61533a3bee41dd36715fb369d6991d633 100755 (executable)
@@ -126,7 +126,7 @@ systemd-run --remain-after-exit \
             true
 systemctl cat "$UNIT.service" "$UNIT.timer"
 grep -q "^OnUnitInactiveSec=16h$" "/run/systemd/transient/$UNIT.timer"
-grep -qE "^ExecStart=.*/bin/true.*$" "/run/systemd/transient/$UNIT.service"
+grep -qE "^ExecStart=.*true.*$" "/run/systemd/transient/$UNIT.service"
 systemctl stop "$UNIT.timer" "$UNIT.service" || :
 
 UNIT="timer-1-$RANDOM"
@@ -162,7 +162,7 @@ grep -q "^OnTimezoneChange=yes$" "/run/systemd/transient/$UNIT.timer"
 grep -q "^After=systemd-journald.service$" "/run/systemd/transient/$UNIT.timer"
 grep -q "^Description=My Fancy Timer$" "/run/systemd/transient/$UNIT.service"
 grep -q "^RemainAfterExit=yes$" "/run/systemd/transient/$UNIT.service"
-grep -qE "^ExecStart=.*/bin/true.*$" "/run/systemd/transient/$UNIT.service"
+grep -qE "^ExecStart=.*true.*$" "/run/systemd/transient/$UNIT.service"
 (! grep -q "^After=systemd-journald.service$" "/run/systemd/transient/$UNIT.service")
 systemctl stop "$UNIT.timer" "$UNIT.service" || :
 
@@ -180,7 +180,7 @@ systemd-analyze verify --recursive-errors=no "/run/systemd/transient/$UNIT.path"
 grep -q "^PathExists=/tmp$" "/run/systemd/transient/$UNIT.path"
 grep -q "^PathExists=/tmp/foo$" "/run/systemd/transient/$UNIT.path"
 grep -q "^PathChanged=/root/bar$" "/run/systemd/transient/$UNIT.path"
-grep -qE "^ExecStart=.*/bin/true.*$" "/run/systemd/transient/$UNIT.service"
+grep -qE "^ExecStart=.*true.*$" "/run/systemd/transient/$UNIT.service"
 systemctl stop "$UNIT.path" "$UNIT.service" || :
 
 : "Transient socket unit"
@@ -197,7 +197,7 @@ systemd-analyze verify --recursive-errors=no "/run/systemd/transient/$UNIT.socke
 grep -q "^ListenFIFO=/tmp/socket.fifo$" "/run/systemd/transient/$UNIT.socket"
 grep -q "^SocketMode=0666$" "/run/systemd/transient/$UNIT.socket"
 grep -q "^SocketMode=0644$" "/run/systemd/transient/$UNIT.socket"
-grep -qE "^ExecStart=.*/bin/true.*$" "/run/systemd/transient/$UNIT.service"
+grep -qE "^ExecStart=.*true.*$" "/run/systemd/transient/$UNIT.service"
 systemctl stop "$UNIT.socket" "$UNIT.service" || :
 
 : "Job mode"
@@ -215,8 +215,8 @@ SHELL=/bin/true systemd-run --shell
 SHELL=/bin/true systemd-run --scope --shell
 systemd-run --wait --pty true
 systemd-run --wait --machine=.host --pty true
-systemd-run --json=short /bin/true | jq . >/dev/null
-systemd-run --json=pretty /bin/true | jq . >/dev/null
+systemd-run --json=short true | jq . >/dev/null
+systemd-run --json=pretty true | jq . >/dev/null
 (! SHELL=/bin/false systemd-run --quiet --shell)
 
 (! systemd-run)
index d00d2e65d83dabe3d0b466c571feb230dc8518ae..49d0a171e500a1e72a1360d4466d0049e4aae804 100755 (executable)
@@ -53,7 +53,6 @@ fi
 IDL_FILE="$(mktemp)"
 varlinkctl introspect /run/systemd/journal/io.systemd.journal io.systemd.Journal | tee "${IDL_FILE:?}"
 varlinkctl validate-idl "$IDL_FILE"
-varlinkctl validate-idl "$IDL_FILE"
 cat /bin/sh >"$IDL_FILE"
 (! varlinkctl validate-idl "$IDL_FILE")
 
@@ -91,7 +90,7 @@ trap rm_rf_sshbindir EXIT
 
 # Create a fake "ssh" binary that validates everything works as expected if invoked for the "ssh-unix:" Varlink transport
 cat > "$SSHBINDIR"/ssh <<'EOF'
-#!/bin/sh
+#!/usr/bin/env bash
 
 set -xe
 
@@ -107,7 +106,7 @@ SYSTEMD_SSH="$SSHBINDIR/ssh" varlinkctl info ssh-unix:foobar:/run/systemd/journa
 
 # Now build another fake "ssh" binary that does the same for "ssh-exec:"
 cat > "$SSHBINDIR"/ssh <<'EOF'
-#!/bin/sh
+#!/usr/bin/env bash
 
 set -xe
 
index 400097ffeb75d5cec9fdbbe308cda0cf798d958e..4c78b91002cf4a8e82679cf26a058feae7658a1f 100755 (executable)
@@ -98,19 +98,19 @@ ls -l /var/lib/machines/testroot.v
 
 test "$(systemd-vpick /var/lib/machines/testroot.v)" = /var/lib/machines/testroot.v/testroot_34/
 test "$(systemd-vpick --resolve=yes /var/lib/machines/testroot.v)" = /var/lib/machines/testroot.v/testroot_34/
-(! systemd-run --wait -p RootDirectory=/var/lib/machines/testroot.v /bin/true)
+(! systemd-run --wait -p RootDirectory=/var/lib/machines/testroot.v true)
 
 find /var/lib/machines/testroot.v/testroot_34
 rm -rf /var/lib/machines/testroot.v/testroot_34
 test "$(systemd-vpick /var/lib/machines/testroot.v)" = /var/lib/machines/testroot.v/testroot_33/
 test "$(systemd-vpick --resolve=yes /var/lib/machines/testroot.v)" = /tmp/dotvroot/
-systemd-run --wait -p RootDirectory=/var/lib/machines/testroot.v /bin/true
+systemd-run --wait -p RootDirectory=/var/lib/machines/testroot.v true
 
 rm /var/lib/machines/testroot.v/testroot_33
 test "$(systemd-vpick /var/lib/machines/testroot.v)" = /var/lib/machines/testroot.v/testroot_32/
 test "$(systemd-vpick --resolve=yes /var/lib/machines/testroot.v)" = /var/lib/machines/testroot.v/testroot_32/
-(! systemd-run --wait -p RootDirectory=/var/lib/machines/testroot.v /bin/true)
+(! systemd-run --wait -p RootDirectory=/var/lib/machines/testroot.v true)
 
 rm -rf /var/lib/machines/testroot.v/testroot_32
 (! systemd-vpick /var/lib/machines/testroot.v)
-(! systemd-run --wait -p RootDirectory=/var/lib/machines/testroot.v /bin/true)
+(! systemd-run --wait -p RootDirectory=/var/lib/machines/testroot.v true)
index 39cd4c717d5d1684e5fadedda9a24c67695c59bb..5e4fa0647166c8b1fc00f98b28cf4a1a8f605670 100755 (executable)
@@ -970,7 +970,7 @@ testcase_11_nft() {
     } >/run/systemd/system/test-nft.socket
     {
         echo "[Service]"
-        echo "ExecStart=/usr/bin/sleep 10000"
+        echo "ExecStart=sleep 10000"
     } >/run/systemd/system/test-nft.service
     systemctl daemon-reload
     systemctl start test-nft.socket
index 2b1de204f7b35f7debd22bf52893ecefe3372a18..0cf5c37416ee33c936138b2ceee75493c33a3e13 100755 (executable)
@@ -28,7 +28,7 @@ UNIT="test-mempress-$RANDOM.service"
 SCRIPT="/tmp/mempress-$RANDOM.sh"
 
 cat >"$SCRIPT" <<'EOF'
-#!/bin/bash
+#!/usr/bin/env bash
 
 set -ex
 
index 9bd74efbaff50ed20e0041bca22898be560ed009..314c1fe7a797965d992de3fb9b9d0cfe6d85de9d 100755 (executable)
@@ -54,9 +54,9 @@ ARGS=(
     "systemd.run_success_action="
     "systemd.run_failure_action="
 
-    "systemd.run=/bin/false"
+    "systemd.run=false"
     "systemd.run="
-    "systemd.run=/bin/true"
+    "systemd.run=true"
     "systemd.run='echo this is a long string'"
 
     "systemd.run_success_action=reboot"
@@ -70,7 +70,7 @@ cat "$UNIT"
 systemd-analyze verify --man=no --recursive-errors=no "$UNIT"
 grep -qE "^SuccessAction=reboot$" "$UNIT"
 grep -qE "^FailureAction=poweroff-force$" "$UNIT"
-grep -qE "^ExecStart=/bin/false$" "$UNIT"
+grep -qE "^ExecStart=false$" "$UNIT"
 grep -qE "^ExecStart=$" "$UNIT"
-grep -qE "^ExecStart=/bin/true$" "$UNIT"
+grep -qE "^ExecStart=true$" "$UNIT"
 grep -qE "^ExecStart=echo this is a long string$" "$UNIT"
index 65d0e030b869b75c0143130c7401cd341a49f092..9d6a93f8e8e45e3cac90f7aa5609159a3963c892 100755 (executable)
@@ -32,7 +32,7 @@ KERNEL!="null", GOTO="end"
 ACTION=="remove", GOTO="end"
 
 IMPORT{db}="HISTORY"
-IMPORT{program}="/bin/bash -c 'systemctl show --property=SoftRebootsCount'"
+IMPORT{program}="/usr/bin/systemctl show --property=SoftRebootsCount"
 ENV{HISTORY}+="%E{ACTION}_%E{SEQNUM}_%E{SoftRebootsCount}"
 
 LABEL="end"
@@ -242,7 +242,7 @@ else
 
     survive_sigterm="/dev/shm/survive-sigterm-$RANDOM.sh"
     cat >"$survive_sigterm" <<EOF
-#!/bin/bash
+#!/usr/bin/env bash
 trap "" TERM
 systemd-notify --ready
 rm "$survive_sigterm"
@@ -252,7 +252,7 @@ EOF
 
     survive_argv="/dev/shm/survive-argv-$RANDOM.sh"
     cat >"$survive_argv" <<EOF
-#!/bin/bash
+#!/usr/bin/env bash
 systemd-notify --ready
 rm "$survive_argv"
 exec -a @sleep sleep infinity
index 97911e70d8426fe8885031e0750915d978e8f4b2..0ea1a0260f74a5e02685980101420817d721ffcf 100755 (executable)
@@ -37,7 +37,8 @@ cp -vf /bin/sleep "${CORE_TEST_UNPRIV_BIN:?}"
 # Simple script that spawns given "fake" binary and then kills it with
 # given signal
 cat >"${MAKE_DUMP_SCRIPT:?}" <<\EOF
-#!/bin/bash -ex
+#!/usr/bin/env bash
+set -ex
 
 bin="${1:?}"
 sig="${2:?}"
@@ -98,12 +99,12 @@ EOF
     machinectl start "$CONTAINER"
     timeout "$TIMEOUT" bash -xec "until systemd-run -M '$CONTAINER' -q --wait --pipe true; do sleep .5; done"
 
-    [[ "$(systemd-run -M "$CONTAINER" -q --wait --pipe coredumpctl list -q --no-legend /usr/bin/sleep | wc -l)" -eq 0 ]]
+    [[ "$(systemd-run -M "$CONTAINER" -q --wait --pipe coredumpctl list -q --no-legend sleep | wc -l)" -eq 0 ]]
     machinectl copy-to "$CONTAINER" "$MAKE_DUMP_SCRIPT"
-    systemd-run -M "$CONTAINER" -q --wait --pipe "$MAKE_DUMP_SCRIPT" "/usr/bin/sleep" "SIGABRT"
-    systemd-run -M "$CONTAINER" -q --wait --pipe "$MAKE_DUMP_SCRIPT" "/usr/bin/sleep" "SIGTRAP"
+    systemd-run -M "$CONTAINER" -q --wait --pipe "$MAKE_DUMP_SCRIPT" "sleep" "SIGABRT"
+    systemd-run -M "$CONTAINER" -q --wait --pipe "$MAKE_DUMP_SCRIPT" "sleep" "SIGTRAP"
     # Wait a bit for the coredumps to get processed
-    timeout 30 bash -c "while [[ \$(systemd-run -M $CONTAINER -q --wait --pipe coredumpctl list -q --no-legend /usr/bin/sleep | wc -l) -lt 2 ]]; do sleep 1; done"
+    timeout 30 bash -c "while [[ \$(systemd-run -M $CONTAINER -q --wait --pipe coredumpctl list -q --no-legend sleep | wc -l) -lt 2 ]]; do sleep 1; done"
 
     machinectl stop "$CONTAINER"
     rm -rf "/var/lib/machines/$CONTAINER"
@@ -253,7 +254,7 @@ systemd-run -t --property CoredumpFilter=default ls /tmp
 if pkgconf --atleast-version 0.192 libdw ; then
     # dwfl_set_sysroot() is supported only in libdw-0.192 or newer.
     cat >"$MAKE_STACKTRACE_DUMP" <<END
-#!/bin/bash
+#!/usr/bin/env bash
 mount -t tmpfs tmpfs /tmp
 gcc -xc -O0 -g -o $CORE_STACKTRACE_TEST_BIN - <<EOF
 void baz(void) { int *x = 0; *x = 42; }
@@ -268,11 +269,11 @@ END
     mkdir -p /run/systemd/coredump.conf.d/
     printf '[Coredump]\nEnterNamespace=no' >/run/systemd/coredump.conf.d/99-enter-namespace.conf
 
-    unshare --pid --fork --mount-proc --mount --uts --ipc --net /bin/bash -c "$MAKE_STACKTRACE_DUMP" || :
+    unshare --pid --fork --mount-proc --mount --uts --ipc --net bash -c "$MAKE_STACKTRACE_DUMP" || :
     timeout 30 bash -c "until coredumpctl -1 info $CORE_STACKTRACE_TEST_BIN | grep -zvqE 'baz.*bar.*foo'; do sleep .2; done"
 
     printf '[Coredump]\nEnterNamespace=yes' >/run/systemd/coredump.conf.d/99-enter-namespace.conf
-    unshare --pid --fork --mount-proc --mount --uts --ipc --net /bin/bash -c "$MAKE_STACKTRACE_DUMP" || :
+    unshare --pid --fork --mount-proc --mount --uts --ipc --net bash -c "$MAKE_STACKTRACE_DUMP" || :
     timeout 30 bash -c "until coredumpctl -1 info $CORE_STACKTRACE_TEST_BIN | grep -zqE 'baz.*bar.*foo'; do sleep .2; done"
 else
     echo "libdw doesn't not support setting sysroot, skipping EnterNamespace= test"
index 65f2d0b2e31c74e76d40e074e1fc8e692ce2c753..ea60abb92ee479e86b4728541752cf425b20638a 100755 (executable)
@@ -304,7 +304,7 @@ StateDirectory=app0
 RuntimeDirectory=app0
 EOF
         cat >"$initdir/opt/script0.sh" <<EOF
-#!/bin/bash
+#!/usr/bin/env bash
 set -e
 test -e /usr/lib/os-release
 echo bar >\${STATE_DIRECTORY}/foo
@@ -347,7 +347,7 @@ StateDirectory=app1
 RuntimeDirectory=app1
 EOF
         cat >"$initdir/opt/script1.sh" <<EOF
-#!/bin/bash
+#!/usr/bin/env bash
 set -e
 test -e /usr/lib/os-release
 echo baz >\${STATE_DIRECTORY}/foo