test: always use bash

If sh is not bash, some builtin command behave slightly differently.
E.g. if sh is provided by busybox, its builtin test command does not check if
the path is a mount point or not, and 'test -w' only checks the access mode of
the inode. So, even if a readonly filesystem is mounted on a directory,
the test command may succeed.

To avoid such confusion, let's unconditionally use bash.
This commit is contained in:
Yu Watanabe
2025-12-07 09:09:03 +09:00
parent a5d0e0ebb2
commit b49a4696c4
193 changed files with 364 additions and 364 deletions
@@ -4,4 +4,4 @@ Description=ForeverPrintHola service
[Service]
Type=exec
ExecStart=sh -x -c 'while :; do printf "Hola\n" || touch /tmp/i-lose-my-logs; sleep 1; done'
ExecStart=bash -x -c 'while :; do printf "Hola\n" || touch /tmp/i-lose-my-logs; sleep 1; done'
@@ -3,4 +3,4 @@ Description=Test for DeferReactivation=yes (service)
[Service]
Type=simple
ExecStart=sh -c 'date +%%s >>/tmp/defer-reactivation.log; sleep 5'
ExecStart=bash -c 'date +%%s >>/tmp/defer-reactivation.log; sleep 5'
@@ -4,4 +4,4 @@ Description=This unit should not remain active once the shell process exits
[Service]
Type=oneshot
ExecStart=sh -c 'sleep infinity & exit 0'
ExecStart=bash -c 'sleep infinity & exit 0'
@@ -7,7 +7,7 @@ integration_tests += [
'service' : integration_test_template['configuration']['service'] + {
'NotifyAccess' : 'all',
# Issue: https://github.com/systemd/systemd/issues/2691
'ExecStop' : 'sh -c \'kill -SEGV $$$$\'',
'ExecStop' : 'bash -c \'kill -SEGV $$$$\'',
'RemainAfterExit' : 'yes',
'TimeoutStopSec' : '270s',
},
@@ -10,4 +10,4 @@ PrivateTmp=yes
BindPaths=/run/TEST-23-UNIT-FILE-marker-fixed:/tmp/testfile-marker-fixed
InaccessiblePaths=/run/inaccessible
ExecStartPre=grep -q -F MARKER_FIXED /tmp/testfile-marker-fixed
ExecStart=sh -c 'systemd-notify --ready; until grep -q -F MARKER_RUNTIME /tmp/testfile-marker-runtime; do sleep 0.1; done; test ! -f /run/inaccessible/testfile-marker-fixed'
ExecStart=bash -c 'systemd-notify --ready; until grep -q -F MARKER_RUNTIME /tmp/testfile-marker-runtime; do sleep 0.1; done; test ! -f /run/inaccessible/testfile-marker-fixed'
@@ -3,4 +3,4 @@
RuntimeMaxSec=5
Type=notify
RemainAfterExit=yes
ExecStart=sh -c 'systemd-notify --ready; until grep -q -F MARKER_RUNTIME /tmp/testfile-marker-runtime; do sleep 0.1; done; exit 0'
ExecStart=bash -c 'systemd-notify --ready; until grep -q -F MARKER_RUNTIME /tmp/testfile-marker-runtime; do sleep 0.1; done; exit 0'
@@ -5,5 +5,5 @@ Description=Failed Dependency Unit
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=sh -c "if [ -f /tmp/TEST-23-UNIT-FILE-retry-fail ]; then exit 0; else exit 1; fi"
ExecStart=bash -c "if [ -f /tmp/TEST-23-UNIT-FILE-retry-fail ]; then exit 0; else exit 1; fi"
Restart=no
@@ -5,7 +5,7 @@ After=multi-user.target
[Service]
ExecStart=/usr/lib/systemd/tests/testdata/TEST-52-HONORFIRSTSHUTDOWN.units/%N.sh
ExecStop=sh -c 'kill -KILL $MAINPID'
ExecStop=bash -c 'kill -KILL $MAINPID'
FailureAction=reboot
[Install]
@@ -2,8 +2,8 @@
[Unit]
Description=TEST-62-RESTRICT-IFACES-all-pings-work
[Service]
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'
ExecStart=bash -c 'ping -c 1 -W 0.2 192.168.113.1'
ExecStart=bash -c 'ping -c 1 -W 0.2 192.168.113.5'
ExecStart=bash -c 'ping -c 1 -W 0.2 192.168.113.9'
RestrictNetworkInterfaces=
Type=oneshot
@@ -2,9 +2,9 @@
[Unit]
Description=TEST-62-RESTRICT-IFACES-allow-list
[Service]
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'
ExecStart=bash -c 'ping -c 1 -W 0.2 192.168.113.1'
ExecStart=bash -c 'ping -c 1 -W 0.2 192.168.113.5'
ExecStart=bash -c '! ping -c 1 -W 0.2 192.168.113.9'
RestrictNetworkInterfaces=veth0
RestrictNetworkInterfaces=veth1
Type=oneshot
@@ -2,9 +2,9 @@
[Unit]
Description=TEST-62-RESTRICT-IFACES-deny-list
[Service]
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'
ExecStart=bash -c '! ping -c 1 -W 0.2 192.168.113.1'
ExecStart=bash -c '! ping -c 1 -W 0.2 192.168.113.5'
ExecStart=bash -c 'ping -c 1 -W 0.2 192.168.113.9'
RestrictNetworkInterfaces=~veth0
RestrictNetworkInterfaces=~veth1
Type=oneshot
@@ -2,9 +2,9 @@
[Unit]
Description=TEST-62-RESTRICT-IFACES-empty-assignment
[Service]
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'
ExecStart=bash -c 'ping -c 1 -W 0.2 192.168.113.1'
ExecStart=bash -c 'ping -c 1 -W 0.2 192.168.113.5'
ExecStart=bash -c 'ping -c 1 -W 0.2 192.168.113.9'
RestrictNetworkInterfaces=veth0
RestrictNetworkInterfaces=
Type=oneshot
@@ -2,9 +2,9 @@
[Unit]
Description=TEST-62-RESTRICT-IFACES-invert-assignment
[Service]
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'
ExecStart=bash -c '! ping -c 1 -W 0.2 192.168.113.1'
ExecStart=bash -c 'ping -c 1 -W 0.2 192.168.113.5'
ExecStart=bash -c '! ping -c 1 -W 0.2 192.168.113.9'
RestrictNetworkInterfaces=veth0
RestrictNetworkInterfaces=veth0 veth1
RestrictNetworkInterfaces=~veth0
@@ -2,9 +2,9 @@
[Unit]
Description=TEST-62-RESTRICT-IFACES-altname
[Service]
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'
ExecStart=bash -c 'ping -c 1 -W 0.2 192.168.113.1'
ExecStart=bash -c 'ping -c 1 -W 0.2 192.168.113.5'
ExecStart=bash -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
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Service]
ExecStartPre=sh -c 'test "$TRIGGER_PATH" = /tmp/test63-glob-foo'
ExecStartPre=sh -c 'test "$TRIGGER_UNIT" = test63-glob.path'
ExecStartPre=bash -c 'test "$TRIGGER_PATH" = /tmp/test63-glob-foo'
ExecStartPre=bash -c 'test "$TRIGGER_UNIT" = test63-glob.path'
ExecStart=systemd-notify --ready
RemainAfterExit=yes
Type=notify
@@ -3,6 +3,6 @@
ConditionPathExists=/tmp/nonexistent
[Service]
ExecStartPre=sh -c 'test "$TRIGGER_PATH" = /tmp/test63'
ExecStartPre=sh -c 'test "$TRIGGER_UNIT" = test63.path'
ExecStartPre=bash -c 'test "$TRIGGER_PATH" = /tmp/test63'
ExecStartPre=bash -c 'test "$TRIGGER_UNIT" = test63.path'
ExecStart=true
@@ -3,7 +3,7 @@
Description=Test for AmbientCapabilities (dynamic user)
[Service]
ExecStart=sh -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002081"'
ExecStart=bash -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002081"'
Type=oneshot
AmbientCapabilities=CAP_CHOWN CAP_SETUID CAP_NET_RAW
DynamicUser=yes
@@ -3,7 +3,7 @@
Description=Test for AmbientCapabilities
[Service]
ExecStart=sh -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002001"'
ExecStart=bash -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002001"'
Type=oneshot
User=nfsnobody
AmbientCapabilities=CAP_CHOWN
@@ -3,7 +3,7 @@
Description=Test for AmbientCapabilities
[Service]
ExecStart=sh -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002001"'
ExecStart=bash -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002001"'
Type=oneshot
User=nobody
AmbientCapabilities=CAP_CHOWN
@@ -3,7 +3,7 @@
Description=Test for AmbientCapabilities (daemon)
[Service]
ExecStart=sh -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002001"'
ExecStart=bash -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002001"'
Type=oneshot
User=daemon
AmbientCapabilities=CAP_CHOWN
@@ -3,7 +3,7 @@
Description=Test for AmbientCapabilities
[Service]
ExecStart=sh -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002001"'
ExecStart=bash -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002001"'
Type=oneshot
User=nfsnobody
AmbientCapabilities=CAP_CHOWN CAP_NET_RAW
@@ -3,7 +3,7 @@
Description=Test for AmbientCapabilities
[Service]
ExecStart=sh -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002001"'
ExecStart=bash -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002001"'
Type=oneshot
User=nobody
AmbientCapabilities=CAP_CHOWN CAP_NET_RAW
@@ -3,7 +3,7 @@
Description=Test for AmbientCapabilities (daemon)
[Service]
ExecStart=sh -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002001"'
ExecStart=bash -x -c 'c=$$(grep "CapAmb:" /proc/self/status); test "$$c" = "CapAmb: 0000000000002001"'
Type=oneshot
User=daemon
AmbientCapabilities=CAP_CHOWN CAP_NET_RAW
+1 -1
View File
@@ -27,7 +27,7 @@ ConditionVersion=glibc " >= 2" " <= 9000 " "!= 1"
ConditionVersion=glibc " >= 2" " * "
[Service]
ExecStart=touch /tmp/a ; /bin/sh -c 'touch /tmp/b' ; touch /tmp/c
ExecStart=touch /tmp/a ; bash -c 'touch /tmp/b' ; touch /tmp/c
ExecStart=test -f /tmp/a
ExecStart=!test -f /tmp/b
ExecStart=!!test -f /tmp/c
+1 -1
View File
@@ -11,7 +11,7 @@ ExecStart=test -f /tmp/thisisasimpletest
# Also, through /tmp/test-exec-bindreadonlypaths
ExecStart=test -f /tmp/test-exec-bindreadonlypaths/thisisasimpletest
# The file cannot modify through /tmp/test-exec-bindreadonlypaths
ExecStart=sh -x -c '! touch /tmp/test-exec-bindreadonlypaths/thisisasimpletest'
ExecStart=bash -x -c '! touch /tmp/test-exec-bindreadonlypaths/thisisasimpletest'
# Cleanup
ExecStart=rm /tmp/thisisasimpletest
BindPaths=/tmp:/tmp/test-exec-bindpaths
@@ -4,6 +4,6 @@ Description=Test for CapabilityBoundingSet
[Service]
# sed: remove dropped (cap_xxx-[epi]) and IAB capabilities from the output
ExecStart=sh -x -c '! capsh --print | sed -re "s/[^ ]+?\-[epi]+//g" -e '/IAB/d' | grep "^Bounding set .*cap_chown"'
ExecStart=bash -x -c '! capsh --print | sed -re "s/[^ ]+?\-[epi]+//g" -e '/IAB/d' | grep "^Bounding set .*cap_chown"'
Type=oneshot
CapabilityBoundingSet=~CAP_CHOWN
@@ -3,7 +3,7 @@
Description=Test for CapabilityBoundingSet
[Service]
ExecStart=sh -x -c 'c=$$(capsh --print | grep "Bounding set "); test "$$c" = "Bounding set =cap_chown,cap_fowner,cap_kill"'
ExecStart=bash -x -c 'c=$$(capsh --print | grep "Bounding set "); test "$$c" = "Bounding set =cap_chown,cap_fowner,cap_kill"'
Type=oneshot
CapabilityBoundingSet=CAP_FOWNER
CapabilityBoundingSet=CAP_KILL CAP_CHOWN
@@ -3,7 +3,7 @@
Description=Test for CapabilityBoundingSet
[Service]
ExecStart=sh -x -c 'c=$$(capsh --print | grep "Bounding set "); test "$$c" = "Bounding set ="'
ExecStart=bash -x -c 'c=$$(capsh --print | grep "Bounding set "); test "$$c" = "Bounding set ="'
Type=oneshot
CapabilityBoundingSet=CAP_FOWNER CAP_KILL
CapabilityBoundingSet=
@@ -3,6 +3,6 @@
Description=Test for CapabilityBoundingSet
[Service]
ExecStart=sh -x -c 'c=$$(capsh --print | grep "Bounding set "); test "$$c" = "Bounding set =cap_fowner,cap_kill"'
ExecStart=bash -x -c 'c=$$(capsh --print | grep "Bounding set "); test "$$c" = "Bounding set =cap_fowner,cap_kill"'
Type=oneshot
CapabilityBoundingSet=CAP_FOWNER CAP_KILL
@@ -6,7 +6,7 @@ Description=Test for exec condition that fails the unit
Type=oneshot
# exit 255 will fail the unit
ExecCondition=/bin/sh -c 'exit 255'
ExecCondition=bash -c 'exit 255'
# This should not get run
ExecStart=sh -c 'true'
ExecStart=bash -c 'true'
@@ -6,11 +6,11 @@ Description=Test for exec condition that triggers skipping
Type=oneshot
# exit codes [1, 254] will result in skipping the rest of execution
ExecCondition=/bin/sh -c 'exit 0'
ExecCondition=/bin/sh -c 'exit 254'
ExecCondition=bash -c 'exit 0'
ExecCondition=bash -c 'exit 254'
# This would normally fail the unit but will not get run due to the skip above
ExecCondition=/bin/sh -c 'exit 255'
ExecCondition=bash -c 'exit 255'
# This should not get run
ExecStart=sh -c 'true'
ExecStart=bash -c 'true'
+1 -1
View File
@@ -3,5 +3,5 @@
Description=Test for CPUAffinity (simple)
[Service]
ExecStart=sh -c 'test $$(cat /proc/self/status | grep Cpus_allowed: | rev | cut -c 1) = 1'
ExecStart=bash -c 'test $$(cat /proc/self/status | grep Cpus_allowed: | rev | cut -c 1) = 1'
CPUAffinity=0
+1 -1
View File
@@ -3,7 +3,7 @@
Description=Test for CPUAffinity (reset)
[Service]
ExecStart=sh -c 'test $$(cat /proc/self/status | grep Cpus_allowed: | rev | cut -c 1) = 1'
ExecStart=bash -c 'test $$(cat /proc/self/status | grep Cpus_allowed: | rev | cut -c 1) = 1'
CPUAffinity=0-1 3
CPUAffinity=
CPUAffinity=0
+1 -1
View File
@@ -3,6 +3,6 @@
Description=Test for CPUAffinity (merge)
[Service]
ExecStart=sh -c 'test $$(cat /proc/self/status | grep Cpus_allowed: | rev | cut -c 1) = 7'
ExecStart=bash -c 'test $$(cat /proc/self/status | grep Cpus_allowed: | rev | cut -c 1) = 7'
CPUAffinity=0,1
CPUAffinity=1-2
@@ -9,10 +9,10 @@ Environment=TOP_SECRET=%d/very_top_secret
ExecStart=test %d/very_top_secret = "${CREDENTIALS_DIRECTORY}/very_top_secret"
LoadCredential=very_top_secret
ExecStart=test %d/very_top_secret = "${CREDENTIALS_DIRECTORY}/very_top_secret"
ExecStart=sh -c 'test %d/very_top_secret = "$TOP_SECRET"'
ExecStart=bash -c 'test %d/very_top_secret = "$TOP_SECRET"'
ExecStartPost=test %d/very_top_secret = "${CREDENTIALS_DIRECTORY}/very_top_secret"
ExecStartPost=sh -c 'test %d/very_top_secret = "$TOP_SECRET"'
ExecStartPost=bash -c 'test %d/very_top_secret = "$TOP_SECRET"'
ExecStop=test %d/very_top_secret = "${CREDENTIALS_DIRECTORY}/very_top_secret"
ExecStop=sh -c 'test %d/very_top_secret = "$TOP_SECRET"'
ExecStop=bash -c 'test %d/very_top_secret = "$TOP_SECRET"'
ExecStopPost=test %d/very_top_secret = "${CREDENTIALS_DIRECTORY}/very_top_secret"
ExecStopPost=sh -c 'test %d/very_top_secret = "$TOP_SECRET"'
ExecStopPost=bash -c 'test %d/very_top_secret = "$TOP_SECRET"'
@@ -5,9 +5,9 @@ Description=Test DynamicUser with static User= whose uid and gid are different
[Service]
Type=oneshot
ExecStart=sh -x -c 'test "$$(id -nG)" = "adm" && test "$$(id -ng)" = "adm" && test "$$(id -nu)" = "adm"'
ExecStart=bash -x -c 'test "$$(id -nG)" = "adm" && test "$$(id -ng)" = "adm" && test "$$(id -nu)" = "adm"'
# Multiple ExecStart= lines causes the issue #9702.
ExecStart=sh -x -c 'test "$$(id -nG)" = "adm" && test "$$(id -ng)" = "adm" && test "$$(id -nu)" = "adm"'
ExecStart=bash -x -c 'test "$$(id -nG)" = "adm" && test "$$(id -ng)" = "adm" && test "$$(id -nu)" = "adm"'
DynamicUser=yes
User=adm
ReadWritePaths=-/coverage
@@ -5,9 +5,9 @@ Description=Test DynamicUser with static User= whose uid and gid are different
[Service]
Type=oneshot
ExecStart=sh -x -c 'test "$$(id -nG)" = "games" && test "$$(id -ng)" = "games" && test "$$(id -nu)" = "games"'
ExecStart=bash -x -c 'test "$$(id -nG)" = "games" && test "$$(id -ng)" = "games" && test "$$(id -nu)" = "games"'
# Multiple ExecStart= lines causes the issue #9702.
ExecStart=sh -x -c 'test "$$(id -nG)" = "games" && test "$$(id -ng)" = "games" && test "$$(id -nu)" = "games"'
ExecStart=bash -x -c 'test "$$(id -nG)" = "games" && test "$$(id -ng)" = "games" && test "$$(id -nu)" = "games"'
DynamicUser=yes
User=games
ReadWritePaths=-/coverage
@@ -3,8 +3,8 @@
Description=Test DynamicUser with User= and SupplementaryGroups=
[Service]
ExecStart=sh -x -c 'for g in $$(id -G); do test "$$g" = "1" && exit 0; done; exit 1'
ExecStart=sh -x -c 'test "$$(id -g)" = "1" && test "$$(id -u)" = "1"'
ExecStart=bash -x -c 'for g in $$(id -G); do test "$$g" = "1" && exit 0; done; exit 1'
ExecStart=bash -x -c 'test "$$(id -g)" = "1" && test "$$(id -u)" = "1"'
Type=oneshot
User=1
DynamicUser=yes
@@ -3,8 +3,8 @@
Description=Test DynamicUser with User=
[Service]
ExecStart=sh -x -c 'for g in $$(id -G); do test "$$g" = "1" && exit 0; done; exit 1'
ExecStart=sh -x -c 'test "$$(id -g)" = "1" && test "$$(id -u)" = "1"'
ExecStart=bash -x -c 'for g in $$(id -G); do test "$$g" = "1" && exit 0; done; exit 1'
ExecStart=bash -x -c 'test "$$(id -g)" = "1" && test "$$(id -u)" = "1"'
Type=oneshot
User=1
DynamicUser=yes
@@ -3,9 +3,9 @@
Description=Test for RuntimeDirectory with RuntimeDirectoryPreserve=yes and DynamicUser=yes
[Service]
ExecStart=sh -x -c 'test -d %t/test-exec_runtimedirectorypreserve'
ExecStart=sh -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectorypreserve"'
ExecStart=sh -x -c 'touch $$RUNTIME_DIRECTORY/test'
ExecStart=bash -x -c 'test -d %t/test-exec_runtimedirectorypreserve'
ExecStart=bash -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectorypreserve"'
ExecStart=bash -x -c 'touch $$RUNTIME_DIRECTORY/test'
Type=oneshot
RuntimeDirectory=test-exec_runtimedirectorypreserve
RuntimeDirectoryPreserve=yes
@@ -3,10 +3,10 @@
Description=Test for RuntimeDirectory with RuntimeDirectoryPreserve=yes and DynamicUser=yes 2nd trial
[Service]
ExecStart=sh -x -c 'test -d %t/test-exec_runtimedirectorypreserve'
ExecStart=sh -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectorypreserve"'
ExecStart=sh -x -c 'test -f $$RUNTIME_DIRECTORY/test'
ExecStart=sh -x -c 'touch $$RUNTIME_DIRECTORY/test'
ExecStart=bash -x -c 'test -d %t/test-exec_runtimedirectorypreserve'
ExecStart=bash -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectorypreserve"'
ExecStart=bash -x -c 'test -f $$RUNTIME_DIRECTORY/test'
ExecStart=bash -x -c 'touch $$RUNTIME_DIRECTORY/test'
Type=oneshot
RuntimeDirectory=test-exec_runtimedirectorypreserve
RuntimeDirectoryPreserve=yes
@@ -3,10 +3,10 @@
Description=Test for RuntimeDirectory with DynamicUser=yes migrated from RuntimeDirectoryPreserve=yes
[Service]
ExecStart=sh -x -c 'test -d %t/test-exec_runtimedirectorypreserve'
ExecStart=sh -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectorypreserve"'
ExecStart=sh -x -c 'test -f $$RUNTIME_DIRECTORY/test'
ExecStart=sh -x -c 'touch $$RUNTIME_DIRECTORY/test'
ExecStart=bash -x -c 'test -d %t/test-exec_runtimedirectorypreserve'
ExecStart=bash -x -c 'test "$$RUNTIME_DIRECTORY" = "%t/test-exec_runtimedirectorypreserve"'
ExecStart=bash -x -c 'test -f $$RUNTIME_DIRECTORY/test'
ExecStart=bash -x -c 'touch $$RUNTIME_DIRECTORY/test'
Type=oneshot
RuntimeDirectory=test-exec_runtimedirectorypreserve
DynamicUser=yes
@@ -11,7 +11,7 @@ ExecStart=test -d %S/test-dynamicuser-migrate
ExecStart=test -d %S/test-dynamicuser-migrate2/hoge
ExecStart=touch %S/test-dynamicuser-migrate/yay
ExecStart=touch %S/test-dynamicuser-migrate2/hoge/yayyay
ExecStart=sh -x -c 'test "$$STATE_DIRECTORY" = "%S/test-dynamicuser-migrate:%S/test-dynamicuser-migrate2/hoge"'
ExecStart=bash -x -c 'test "$$STATE_DIRECTORY" = "%S/test-dynamicuser-migrate:%S/test-dynamicuser-migrate2/hoge"'
Type=oneshot
DynamicUser=no
@@ -19,7 +19,7 @@ ExecStart=touch %S/test-dynamicuser-migrate/yay
ExecStart=touch %S/test-dynamicuser-migrate2/hoge/yayyay
ExecStart=touch %S/private/test-dynamicuser-migrate/yay
ExecStart=touch %S/private/test-dynamicuser-migrate2/hoge/yayyay
ExecStart=sh -x -c 'test "$$STATE_DIRECTORY" = "%S/test-dynamicuser-migrate:%S/test-dynamicuser-migrate2/hoge"'
ExecStart=bash -x -c 'test "$$STATE_DIRECTORY" = "%S/test-dynamicuser-migrate:%S/test-dynamicuser-migrate2/hoge"'
Type=oneshot
DynamicUser=yes
@@ -78,7 +78,7 @@ ExecStart=test -f %S/private/xxx/foo
ExecStart=test -f %S/private/xxx/yyy/foo
ExecStart=test -f %S/private/xxx/zzz/foo
ExecStart=sh -x -c 'test "$$STATE_DIRECTORY" = "%S/aaa:%S/aaa/bbb:%S/aaa/ccc:%S/abc:%S/quux/pief:%S/waldo:%S/xxx:%S/xxx/yyy:%S/xxx/zzz"'
ExecStart=bash -x -c 'test "$$STATE_DIRECTORY" = "%S/aaa:%S/aaa/bbb:%S/aaa/ccc:%S/abc:%S/quux/pief:%S/waldo:%S/xxx:%S/xxx/yyy:%S/xxx/zzz"'
Type=oneshot
DynamicUser=yes
@@ -3,8 +3,8 @@
Description=Test DynamicUser with SupplementaryGroups=
[Service]
ExecStart=sh -x -c 'for g in $$(id -G); do test "$$g" = "1" && exit 0; done; exit 1'
ExecStart=sh -x -c 'for g in $$(id -G); do test "$$g" = "2" && exit 0; done; exit 1'
ExecStart=bash -x -c 'for g in $$(id -G); do test "$$g" = "1" && exit 0; done; exit 1'
ExecStart=bash -x -c 'for g in $$(id -G); do test "$$g" = "2" && exit 0; done; exit 1'
Type=oneshot
DynamicUser=yes
SupplementaryGroups=1 2
@@ -3,7 +3,7 @@
Description=Test for Environment
[Service]
ExecStart=sh -x -c 'test "$${VAR1-unset}" = "unset" && test "$${VAR2-unset}" = "unset" && test "$${VAR3-unset}" = "unset"'
ExecStart=bash -x -c 'test "$${VAR1-unset}" = "unset" && test "$${VAR2-unset}" = "unset" && test "$${VAR3-unset}" = "unset"'
Type=oneshot
Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"
Environment=
@@ -3,7 +3,7 @@
Description=Test for Environment
[Service]
ExecStart=sh -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = foobar'
ExecStart=bash -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = foobar'
Type=oneshot
Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"
Environment="VAR3=foobar"
@@ -3,7 +3,7 @@
Description=Test for No Environment Variable Substitution
[Service]
ExecStart=sh -x -c 'test "$${VAR1-unset}" = "unset" && test "$${VAR2}" = "word3" && test "$${VAR3-unset}" = \'$word 5 6\''
ExecStart=:/bin/sh -x -c 'test "$${VAR1-unset}" != "unset" && test "$${VAR2}" != "word3" && test "$${VAR3-unset}" != \'$word 5 6\''
ExecStart=bash -x -c 'test "$${VAR1-unset}" = "unset" && test "$${VAR2}" = "word3" && test "$${VAR3-unset}" = \'$word 5 6\''
ExecStart=:bash -x -c 'test "$${VAR1-unset}" != "unset" && test "$${VAR2}" != "word3" && test "$${VAR3-unset}" != \'$word 5 6\''
Type=oneshot
Environment="VAR2=word3" "VAR3=$word 5 6"
+1 -1
View File
@@ -3,6 +3,6 @@
Description=Test for Environment
[Service]
ExecStart=sh -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6"'
ExecStart=bash -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6"'
Type=oneshot
Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"
@@ -3,6 +3,6 @@
Description=Test for EnvironmentFile
[Service]
ExecStart=sh -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes'
ExecStart=bash -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes'
Type=oneshot
EnvironmentFile=/tmp/test-exec_environmentfile.conf
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Service]
ExecStart=sh -x -c 'test "$$PATH" = "/usr" && test "$$VAR1" = word3 && test "$$VAR2" = "\\$$word 5 6"'
ExecStart=bash -x -c 'test "$$PATH" = "/usr" && test "$$VAR1" = word3 && test "$$VAR2" = "\\$$word 5 6"'
Type=oneshot
ExecSearchPath=/tmp:/bin
Environment="PATH=/usr" VAR1=word3 "VAR2=$word 5 6"
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Service]
ExecStart=sh -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$PATH" = "/tmp:/bin"'
ExecStart=bash -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$PATH" = "/tmp:/bin"'
Type=oneshot
ExecSearchPath=/tmp:/bin
Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"
@@ -3,7 +3,7 @@
Description=Test for ExecSearchPath with EnvironmentFile where EnvironmentFile sets PATH
[Service]
ExecStart=sh -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes && test "$$PATH" = /usr'
ExecStart=bash -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes && test "$$PATH" = /usr'
Type=oneshot
EnvironmentFile=/tmp/test-exec_execsearchpath_environmentfile-set.conf
ExecSearchPath=/tmp:/bin
@@ -3,7 +3,7 @@
Description=Test for ExecSearchPath with EnvironmentFile where EnvironmentFile does not set PATH
[Service]
ExecStart=sh -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes && test "$$PATH" = "/tmp:/bin"'
ExecStart=bash -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes && test "$$PATH" = "/tmp:/bin"'
Type=oneshot
ExecSearchPath=/tmp:/bin
EnvironmentFile=/tmp/test-exec_execsearchpath_environmentfile.conf
@@ -3,7 +3,7 @@
Description=Test for PassEnvironment with ExecSearchPath with PATH set by user
[Service]
ExecStart=sh -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes && test "$$PATH" = "/usr"'
ExecStart=bash -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes && test "$$PATH" = "/usr"'
Type=oneshot
PassEnvironment=VAR1 VAR2 VAR3 VAR4 VAR5 PATH
ExecSearchPath=/tmp:/bin
@@ -3,7 +3,7 @@
Description=Test for PassEnvironment with ExecSearchPath with PATH not set by user
[Service]
ExecStart=sh -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes && test "$$PATH" = "/tmp:/bin"'
ExecStart=bash -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes && test "$$PATH" = "/tmp:/bin"'
Type=oneshot
PassEnvironment=VAR1 VAR2 VAR3 VAR4 VAR5
ExecSearchPath=/tmp:/bin
@@ -5,4 +5,4 @@ Description=Test for specifiers with exec search path
[Service]
Type=oneshot
ExecSearchPath=/tmp:/bin:/usr/bin:%V
ExecStart=sh -x -c 'test %V = /var/tmp && test "$$PATH" = "/tmp:/bin:/usr/bin:/var/tmp"'
ExecStart=bash -x -c 'test %V = /var/tmp && test "$$PATH" = "/tmp:/bin:/usr/bin:/var/tmp"'
@@ -3,6 +3,6 @@
Description=Test for Group
[Service]
ExecStart=sh -x -c 'test "$$(id -n -g)" = "nfsnobody"'
ExecStart=bash -x -c 'test "$$(id -n -g)" = "nfsnobody"'
Type=oneshot
Group=nfsnobody
+1 -1
View File
@@ -3,6 +3,6 @@
Description=Test for Group
[Service]
ExecStart=sh -x -c 'test "$$(id -n -g)" = "nobody"'
ExecStart=bash -x -c 'test "$$(id -n -g)" = "nobody"'
Type=oneshot
Group=nobody
+1 -1
View File
@@ -3,6 +3,6 @@
Description=Test for Group
[Service]
ExecStart=sh -x -c 'test "$$(id -n -g)" = "nogroup"'
ExecStart=bash -x -c 'test "$$(id -n -g)" = "nogroup"'
Type=oneshot
Group=nogroup
+1 -1
View File
@@ -3,6 +3,6 @@
Description=Test for Group (daemon)
[Service]
ExecStart=sh -x -c 'test "$$(id -n -g)" = "daemon"'
ExecStart=bash -x -c 'test "$$(id -n -g)" = "daemon"'
Type=oneshot
Group=daemon
@@ -3,6 +3,6 @@
Description=Test for IgnoreSIGPIPE=no
[Service]
ExecStart=sh -x -c 'kill -PIPE 0'
ExecStart=bash -x -c 'kill -PIPE 0'
Type=oneshot
IgnoreSIGPIPE=no
@@ -3,6 +3,6 @@
Description=Test for IgnoreSIGPIPE=yes
[Service]
ExecStart=sh -x -c 'kill -PIPE 0'
ExecStart=bash -x -c 'kill -PIPE 0'
Type=oneshot
IgnoreSIGPIPE=yes
@@ -4,5 +4,5 @@ Description=Test to make sure that InaccessiblePaths= disconnect mount propagati
[Service]
InaccessiblePaths=-/i-dont-exist
ExecStart=sh -x -c 'd=$$(mktemp -d -p /tmp); trap "umount \'$$d\' && rmdir \'$$d\'" EXIT; mount -t tmpfs tmpfs "$$d"; grep "$$d" /proc/self/mountinfo && ! grep "$$d" /proc/$${PPID}/mountinfo && ! grep "$$d" /proc/1/mountinfo'
ExecStart=bash -x -c 'd=$$(mktemp -d -p /tmp); trap "umount \'$$d\' && rmdir \'$$d\'" EXIT; mount -t tmpfs tmpfs "$$d"; grep "$$d" /proc/self/mountinfo && ! grep "$$d" /proc/$${PPID}/mountinfo && ! grep "$$d" /proc/1/mountinfo'
Type=oneshot
@@ -4,5 +4,5 @@ Description=Test to make sure that mount namespace setup works properly with the
[Service]
InaccessiblePaths=/sys
ExecStart=sh -x -c 'test "$$(stat -c %%a /sys)" = "0"'
ExecStart=bash -x -c 'test "$$(stat -c %%a /sys)" = "0"'
Type=oneshot
@@ -3,6 +3,6 @@
Description=Test for IOSchedulingClass=best-effort
[Service]
ExecStart=sh -x -c 'c=$$(LC_ALL=C ionice); test "$${c%%:*}" = "best-effort"'
ExecStart=bash -x -c 'c=$$(LC_ALL=C ionice); test "$${c%%:*}" = "best-effort"'
Type=oneshot
IOSchedulingClass=best-effort
@@ -3,6 +3,6 @@
Description=Test for IOSchedulingClass=idle
[Service]
ExecStart=sh -x -c 'c=$$(LC_ALL=C ionice); test "$${c%%:*}" = "idle"'
ExecStart=bash -x -c 'c=$$(LC_ALL=C ionice); test "$${c%%:*}" = "idle"'
Type=oneshot
IOSchedulingClass=idle
@@ -4,6 +4,6 @@ Description=Test for IOSchedulingClass=none
[Service]
# Old kernels might report "none" here, new kernels "best-effort".
ExecStart=sh -x -c 'c=$$(LC_ALL=C ionice); test "$${c%%:*}" = "none" -o "$${c%%:*}" = "best-effort"'
ExecStart=bash -x -c 'c=$$(LC_ALL=C ionice); test "$${c%%:*}" = "none" -o "$${c%%:*}" = "best-effort"'
Type=oneshot
IOSchedulingClass=none
@@ -3,6 +3,6 @@
Description=Test for IOSchedulingClass=realtime
[Service]
ExecStart=sh -x -c 'c=$$(LC_ALL=C ionice); test "$${c%%:*}" = "realtime"'
ExecStart=bash -x -c 'c=$$(LC_ALL=C ionice); test "$${c%%:*}" = "realtime"'
Type=oneshot
IOSchedulingClass=realtime
@@ -3,9 +3,9 @@
Description=Test for LoadCredential=
[Service]
ExecStart=sh -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
ExecStartPost=sh -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
ExecStop=sh -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
ExecStopPost=sh -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
ExecStart=bash -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
ExecStartPost=bash -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
ExecStop=bash -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
ExecStopPost=bash -x -c 'test "$$(cat %d/test-execute.load-credential)" = "foo"'
Type=oneshot
LoadCredential=test-execute.load-credential
@@ -3,14 +3,14 @@
Description=Test for NetworkNamespacePath= without mount namespacing
[Service]
ExecStart=sh -x -c '! ip link show dummy-test-exec'
ExecStart=sh -x -c 'test ! -e /proc/sys/net/ipv4/conf/dummy-test-exec'
ExecStart=bash -x -c '! ip link show dummy-test-exec'
ExecStart=bash -x -c 'test ! -e /proc/sys/net/ipv4/conf/dummy-test-exec'
# Without mount namespacing, we can access the dummy-test-exec interface through sysfs.
ExecStart=sh -x -c 'test -e /sys/class/net/dummy-test-exec'
ExecStart=sh -x -c 'ip link show dummy-test-ns'
ExecStart=sh -x -c 'test -e /proc/sys/net/ipv4/conf/dummy-test-ns'
ExecStart=bash -x -c 'test -e /sys/class/net/dummy-test-exec'
ExecStart=bash -x -c 'ip link show dummy-test-ns'
ExecStart=bash -x -c 'test -e /proc/sys/net/ipv4/conf/dummy-test-ns'
# Without mount namespacing, we cannot access the dummy-test-ns interface through sysfs.
ExecStart=sh -x -c 'test ! -e /sys/class/net/dummy-test-ns'
ExecStart=bash -x -c 'test ! -e /sys/class/net/dummy-test-ns'
Type=oneshot
NetworkNamespacePath=/run/netns/test-execute-netns
PrivateMounts=no
@@ -3,14 +3,14 @@
Description=Test for NetworkNamespacePath= with mount namespacing
[Service]
ExecStart=sh -x -c '! ip link show dummy-test-exec'
ExecStart=sh -x -c 'test ! -e /proc/sys/net/ipv4/conf/dummy-test-exec'
ExecStart=bash -x -c '! ip link show dummy-test-exec'
ExecStart=bash -x -c 'test ! -e /proc/sys/net/ipv4/conf/dummy-test-exec'
# With mount namespacing, we cannot access the dummy-test-exec interface through sysfs.
ExecStart=sh -x -c 'test ! -e /sys/class/net/dummy-test-exec'
ExecStart=sh -x -c 'ip link show dummy-test-ns'
ExecStart=sh -x -c 'test -e /proc/sys/net/ipv4/conf/dummy-test-ns'
ExecStart=bash -x -c 'test ! -e /sys/class/net/dummy-test-exec'
ExecStart=bash -x -c 'ip link show dummy-test-ns'
ExecStart=bash -x -c 'test -e /proc/sys/net/ipv4/conf/dummy-test-ns'
# With mount namespacing, we can access the dummy-test-ns interface through sysfs.
ExecStart=sh -x -c 'test -e /sys/class/net/dummy-test-ns'
ExecStart=bash -x -c 'test -e /sys/class/net/dummy-test-ns'
Type=oneshot
NetworkNamespacePath=/run/netns/test-execute-netns
# NetworkNamespacePath= implies PrivateMounts=yes
@@ -5,7 +5,7 @@ Description=Test for NoExecPaths=
[Service]
Type=oneshot
# This should work, as we explicitly disable the effect of NoExecPaths=
ExecStart=+/bin/sh -c '/bin/cat /dev/null'
ExecStart=+bash -c '/bin/cat /dev/null'
# This should also work, as we do not disable the effect of NoExecPaths= but invert the exit code
ExecStart=sh -x -c '! /bin/cat /dev/null'
ExecStart=bash -x -c '! /bin/cat /dev/null'
NoExecPaths=/bin/cat
@@ -3,6 +3,6 @@
Description=Test for OOMScoreAdjust
[Service]
ExecStart=sh -x -c 'c=$$(cat /proc/self/oom_score_adj); test "$$c" -eq -100'
ExecStart=bash -x -c 'c=$$(cat /proc/self/oom_score_adj); test "$$c" -eq -100'
Type=oneshot
OOMScoreAdjust=-100
@@ -3,6 +3,6 @@
Description=Test for OOMScoreAdjust
[Service]
ExecStart=sh -x -c 'c=$$(cat /proc/self/oom_score_adj); test "$$c" -eq 100'
ExecStart=bash -x -c 'c=$$(cat /proc/self/oom_score_adj); test "$$c" -eq 100'
Type=oneshot
OOMScoreAdjust=100
@@ -3,6 +3,6 @@
Description=Test for PassEnvironment with variables absent from the execution environment
[Service]
ExecStart=sh -x -c 'test "$${VAR1-unset}" = "unset" && test "$${VAR2-unset}" = "unset" && test "$${VAR3-unset}" = "unset" && test "$${VAR4-unset}" = "unset" && test "$${VAR5-unset}" = "unset"'
ExecStart=bash -x -c 'test "$${VAR1-unset}" = "unset" && test "$${VAR2-unset}" = "unset" && test "$${VAR3-unset}" = "unset" && test "$${VAR4-unset}" = "unset" && test "$${VAR5-unset}" = "unset"'
Type=oneshot
PassEnvironment=VAR1 VAR2 VAR3 VAR4 VAR5
@@ -3,7 +3,7 @@
Description=Test for PassEnvironment and erasing the variable list
[Service]
ExecStart=sh -x -c 'test "$${VAR1-unset}" = "unset" && test "$${VAR2-unset}" = "unset" && test "$${VAR3-unset}" = "unset" && test "$${VAR4-unset}" = "unset" && test "$${VAR5-unset}" = "unset"'
ExecStart=bash -x -c 'test "$${VAR1-unset}" = "unset" && test "$${VAR2-unset}" = "unset" && test "$${VAR3-unset}" = "unset" && test "$${VAR4-unset}" = "unset" && test "$${VAR5-unset}" = "unset"'
Type=oneshot
PassEnvironment=VAR1 VAR2 VAR3 VAR4 VAR5
PassEnvironment=
@@ -3,7 +3,7 @@
Description=Test for PassEnvironment with a variable name repeated
[Service]
ExecStart=sh -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes'
ExecStart=bash -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes'
Type=oneshot
PassEnvironment=VAR1 VAR2
PassEnvironment=VAR1 VAR3
@@ -3,6 +3,6 @@
Description=Test for PassEnvironment
[Service]
ExecStart=sh -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes'
ExecStart=bash -x -c 'test "$$VAR1" = "word1 word2" && test "$$VAR2" = word3 && test "$$VAR3" = "\\$$word 5 6" && test "$$VAR4" = "new\nline" && test "$$VAR5" = passwordwithbackslashes'
Type=oneshot
PassEnvironment=VAR1 VAR2 VAR3 VAR4 VAR5
@@ -3,6 +3,6 @@
Description=Test for Personality=aarch64
[Service]
ExecStart=sh -c 'echo $(uname -m); exit $(test $(uname -m) = "aarch64")'
ExecStart=bash -c 'echo $(uname -m); exit $(test $(uname -m) = "aarch64")'
Type=oneshot
Personality=aarch64
@@ -2,6 +2,6 @@
Description=Test for Personality=loongarch64
[Service]
ExecStart=sh -c 'echo $(uname -m); exit $(test $(uname -m) = "loongarch64")'
ExecStart=bash -c 'echo $(uname -m); exit $(test $(uname -m) = "loongarch64")'
Type=oneshot
Personality=loongarch64
@@ -3,6 +3,6 @@
Description=Test for Personality=ppc64
[Service]
ExecStart=sh -c 'echo $(uname -m); exit $(test $(uname -m) = "ppc64")'
ExecStart=bash -c 'echo $(uname -m); exit $(test $(uname -m) = "ppc64")'
Type=oneshot
Personality=ppc64
@@ -3,6 +3,6 @@
Description=Test for Personality=ppc64le
[Service]
ExecStart=sh -c 'echo $(uname -m); exit $(test $(uname -m) = "ppc64le")'
ExecStart=bash -c 'echo $(uname -m); exit $(test $(uname -m) = "ppc64le")'
Type=oneshot
Personality=ppc64le
@@ -3,6 +3,6 @@
Description=Test for Personality=s390
[Service]
ExecStart=sh -x -c 'c=$$(uname -m); test "$$c" = "s390"'
ExecStart=bash -x -c 'c=$$(uname -m); test "$$c" = "s390"'
Type=oneshot
Personality=s390
@@ -3,6 +3,6 @@
Description=Test for Personality=s390x
[Service]
ExecStart=sh -x -c 'c=$$(uname -m); test "$$c" = "s390x"'
ExecStart=bash -x -c 'c=$$(uname -m); test "$$c" = "s390x"'
Type=oneshot
Personality=s390x
@@ -3,6 +3,6 @@
Description=Test for Personality=x86-64
[Service]
ExecStart=sh -x -c 'c=$$(uname -m); test "$$c" = "x86_64"'
ExecStart=bash -x -c 'c=$$(uname -m); test "$$c" = "x86_64"'
Type=oneshot
Personality=x86-64
@@ -3,6 +3,6 @@
Description=Test for Personality=x86
[Service]
ExecStart=sh -x -c 'c=$$(uname -m); test "$$c" = "i686" -o "$$c" = "x86_64"'
ExecStart=bash -x -c 'c=$$(uname -m); test "$$c" = "i686" -o "$$c" = "x86_64"'
Type=oneshot
Personality=x86
@@ -3,8 +3,8 @@
Description=Test for PrivateDevices=yes with a bind mounted device
[Service]
ExecStart=sh -c 'test -c /dev/kmsg'
ExecStart=sh -c 'test ! -w /dev/'
ExecStart=bash -c 'test -c /dev/kmsg'
ExecStart=bash -c 'test ! -w /dev/'
Type=oneshot
PrivateDevices=yes
BindPaths=/dev/kmsg
@@ -3,7 +3,7 @@
Description=Test for PrivateDevices=yes with prefix
[Service]
ExecStart=sh -x -c '! test -c /dev/kmsg'
ExecStart=+/bin/sh -x -c 'test -c /dev/kmsg'
ExecStart=bash -x -c '! test -c /dev/kmsg'
ExecStart=+bash -x -c 'test -c /dev/kmsg'
Type=oneshot
PrivateDevices=yes
@@ -5,5 +5,5 @@ Description=Test CAP_MKNOD capability for PrivateDevices=no
[Service]
PrivateDevices=no
# sed: remove dropped (cap_xxx-[epi]) and IAB capabilities from the output
ExecStart=sh -x -c 'capsh --print | sed -re "s/[^ ]+?\-[epi]+//g" -e '/IAB/d' | grep cap_mknod'
ExecStart=bash -x -c 'capsh --print | sed -re "s/[^ ]+?\-[epi]+//g" -e '/IAB/d' | grep cap_mknod'
Type=oneshot
@@ -5,5 +5,5 @@ Description=Test CAP_SYS_RAWIO capability for PrivateDevices=no
[Service]
PrivateDevices=no
# sed: remove dropped (cap_xxx-[epi]) and IAB capabilities from the output
ExecStart=sh -x -c 'capsh --print | sed -re "s/[^ ]+?\-[epi]+//g" -e '/IAB/d' | grep cap_sys_rawio'
ExecStart=bash -x -c 'capsh --print | sed -re "s/[^ ]+?\-[epi]+//g" -e '/IAB/d' | grep cap_sys_rawio'
Type=oneshot
@@ -3,6 +3,6 @@
Description=Test for PrivateDevices=no
[Service]
ExecStart=sh -x -c 'test -c /dev/kmsg'
ExecStart=bash -x -c 'test -c /dev/kmsg'
Type=oneshot
PrivateDevices=no
@@ -5,5 +5,5 @@ Description=Test CAP_MKNOD capability for PrivateDevices=yes
[Service]
PrivateDevices=yes
# sed: remove dropped (cap_xxx-[epi]) and IAB capabilities from the output
ExecStart=sh -x -c '! capsh --print | sed -re "s/[^ ]+?\-[epi]+//g" -e '/IAB/d' | grep cap_mknod'
ExecStart=bash -x -c '! capsh --print | sed -re "s/[^ ]+?\-[epi]+//g" -e '/IAB/d' | grep cap_mknod'
Type=oneshot
@@ -5,5 +5,5 @@ Description=Test CAP_SYS_RAWIO capability for PrivateDevices=yes
[Service]
PrivateDevices=yes
# sed: remove dropped (cap_xxx-[epi]) and IAB capabilities from the output
ExecStart=sh -x -c '! capsh --print | sed -re "s/[^ ]+?\-[epi]+//g" -e '/IAB/d' | grep cap_sys_rawio'
ExecStart=bash -x -c '! capsh --print | sed -re "s/[^ ]+?\-[epi]+//g" -e '/IAB/d' | grep cap_sys_rawio'
Type=oneshot
@@ -8,10 +8,10 @@ Group=daemon
Type=oneshot
# Check the group applied
ExecStart=sh -x -c 'test "$$(id -n -g)" = "daemon"'
ExecStart=bash -x -c 'test "$$(id -n -g)" = "daemon"'
# Check that the namespace applied
ExecStart=sh -c 'test ! -c /dev/kmsg'
ExecStart=bash -c 'test ! -c /dev/kmsg'
# Check that the owning group of a node is not daemon (should be the host root)
ExecStart=sh -x -c 'test ! "$$(stat -c %%G /dev/stderr)" = "daemon"'
ExecStart=bash -x -c 'test ! "$$(stat -c %%G /dev/stderr)" = "daemon"'
@@ -3,6 +3,6 @@
Description=Test for PrivateDevices=yes
[Service]
ExecStart=sh -c 'test ! -c /dev/kmsg'
ExecStart=bash -c 'test ! -c /dev/kmsg'
Type=oneshot
PrivateDevices=yes
@@ -3,10 +3,10 @@
Description=Test for PrivateNetwork= without mount namespacing
[Service]
ExecStart=sh -x -c '! ip link show dummy-test-exec'
ExecStart=sh -x -c 'test ! -e /proc/sys/net/ipv4/conf/dummy-test-exec'
ExecStart=bash -x -c '! ip link show dummy-test-exec'
ExecStart=bash -x -c 'test ! -e /proc/sys/net/ipv4/conf/dummy-test-exec'
# Without mount namespacing, we can access the dummy-test-exec interface through sysfs
ExecStart=sh -x -c 'test -d /sys/class/net/dummy-test-exec'
ExecStart=bash -x -c 'test -d /sys/class/net/dummy-test-exec'
Type=oneshot
PrivateNetwork=yes
PrivateMounts=no
@@ -3,10 +3,10 @@
Description=Test for PrivateNetwork= with mount namespacing
[Service]
ExecStart=sh -x -c '! ip link show dummy-test-exec'
ExecStart=sh -x -c 'test ! -e /proc/sys/net/ipv4/conf/dummy-test-exec'
ExecStart=bash -x -c '! ip link show dummy-test-exec'
ExecStart=bash -x -c 'test ! -e /proc/sys/net/ipv4/conf/dummy-test-exec'
# With mount namespacing, we cannot access the dummy-test-exec interface through sysfs.
ExecStart=sh -x -c 'test ! -e /sys/class/net/dummy-test-exec'
ExecStart=bash -x -c 'test ! -e /sys/class/net/dummy-test-exec'
Type=oneshot
PrivateNetwork=yes
# PrivateNetwork=yes implies PrivateMounts=yes
@@ -3,7 +3,7 @@
Description=Test for PrivateTmp=yes with prefix
[Service]
ExecStart=sh -x -c 'test ! -f /tmp/test-exec_privatetmp'
ExecStart=+/bin/sh -x -c 'test -f /tmp/test-exec_privatetmp'
ExecStart=bash -x -c 'test ! -f /tmp/test-exec_privatetmp'
ExecStart=+bash -x -c 'test -f /tmp/test-exec_privatetmp'
Type=oneshot
PrivateTmp=yes

Some files were not shown because too many files have changed in this diff Show More