1
0
mirror of https://github.com/systemd/systemd synced 2026-03-26 16:54:53 +01:00

Compare commits

..

18 Commits

Author SHA1 Message Date
Yu Watanabe
80cfe9abf2
test: several fixlets/workarounds for supporting postmarketOS (#39905) 2025-12-07 10:16:58 +09:00
Morgan
97887d09a8
logind: fix initial button state is not fetched when device is registered late (#39978)
If buttons that are not initialized from manager_startup() due to still
being processed by udev, the initial state is not checked. (commit
405be62f05d76f1845f347737b5972158c79dd3e)

This caused a problem which initial "close" state being not recognized
if lid switch of some system getting initialized later.
2025-12-07 09:48:49 +09:00
Luca Boccassi
e2fbcee030
test-network: fix invalid captive portal URL with dnsmasq 2.92 (#40011)
dnsmasq 2.92 started converting binary content to ascii so the previous
invalid URL is no longer invalid as it's escaped.

So the test started failing: https://bugs.debian.org/1122015

Use a '|' character instead, which is not a valid URL character but it's
also not escaped by dnsmasq.

Follow-up for 1219391c9fa74568e4c60ee6b495e74887ab448f
2025-12-07 09:43:47 +09:00
Yu Watanabe
e7e3c23bbb test-execute: support case that the games user in multiple groups
On Alpine/postmarketOS,
```
$ id -nG games
games users
```
2025-12-07 09:10:32 +09:00
Yu Watanabe
d5932060ed integration-test: skip several test cases when nss module is not supported 2025-12-07 09:10:29 +09:00
Yu Watanabe
f117629f28 test: skip several test cases when built with musl 2025-12-07 09:09:03 +09:00
Yu Watanabe
9fafe89bcc integration-test: skip several test cases on Alpine/postmarketOS 2025-12-07 09:09:03 +09:00
Yu Watanabe
355bcc243c test: support coreutils built with --enable-single-binary=symlinks
Alpine/postmarketOS build coreutils with --enable-single-binary=symlinks.
In that case, all commands provided by coreutils are symlink to
/usr/bin/coreutils, and it calls prctl(PR_SET_NAME, argv[0]), hence the comm
will be the path to the symlink.

This also makes not kill sleep command with SIGKILL in TEST-17-UDEV, that is
totally unnecessary.
2025-12-07 09:09:03 +09:00
Yu Watanabe
8374085f22 test-network: IPv4-mapped-IPv6 addresses may be shown as pure IPv6 address
It seems ip command built with musl always shows IPv6 addresses in the same way.
2025-12-07 09:09:03 +09:00
Yu Watanabe
193626bd8b test-network: also stop nftables.service
It is a firewall service used in postmarketOS.
When it is active, then e.g. DHCP packets are filtered, and many
tests will be failed.
2025-12-07 09:09:03 +09:00
Yu Watanabe
43588dd63d TEST-75-RESOLVED: move test cases for NFTSet= to TEST-07-PID1
The test cases are not related to systemd-resolved.

While moving the test cases, now userdbctl is used for obtaining UID/GID
for the dynamic user, as musl does not support nss module, hence getent
does not provide information about the dynamic user.
2025-12-07 09:09:03 +09:00
Yu Watanabe
f5f96d44fd TEST-46-HOMED: split into small testcases
This also replace long IDENTITY= line with pretty json string.
2025-12-07 09:09:03 +09:00
Yu Watanabe
ae2ccf9d6e TEST-35-LOGIN: fix bus path when the session does not have corresponding audit session
If there is no corresponding audit session, then the session ID is
prefixed with 'c', and in that case the session ID should be used as is
in bus path.
2025-12-07 09:09:03 +09:00
Yu Watanabe
4722619c4b TEST-35-LOGIN: show remaining sessions in cleanup_session()
Otherwise it is hard to see which session is still active.
2025-12-07 09:09:03 +09:00
Yu Watanabe
45014d97dd TEST-13-NSPAWN: the host kernel may not support /proc/kcore 2025-12-07 09:09:03 +09:00
Yu Watanabe
3672e24e75 test-seccomp: do not fail when already MemoryDenyWriteExecute= is enabled 2025-12-07 09:09:03 +09:00
Yu Watanabe
b49a4696c4 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.
2025-12-07 09:09:03 +09:00
Yu Watanabe
a5d0e0ebb2 ci: pass --no-stdsplit to meson test
Hopefully, we will get more informative logs on failure.
2025-12-07 09:09:03 +09:00
218 changed files with 1387 additions and 1064 deletions

View File

@ -47,7 +47,7 @@ for phase in "${PHASES[@]}"; do
# correctly detect the environment.
env \
SYSTEMD_IN_CHROOT=yes \
meson test -C build --print-errorlogs
meson test -C build --print-errorlogs --no-stdsplit
;;
CLEANUP)
info "Cleanup phase"

View File

@ -109,7 +109,7 @@ for phase in "${PHASES[@]}"; do
run_meson -Dnobody-group=nogroup --werror -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true "${MESON_ARGS[@]}" build
ninja -C build -v
# Ensure setting a timezone (like the reproducible build tests do) does not break time/date unit tests
TZ=GMT+12 meson test "${MESON_TEST_ARGS[@]}" -C build --print-errorlogs
TZ=GMT+12 meson test "${MESON_TEST_ARGS[@]}" -C build --print-errorlogs --no-stdsplit
;;
RUN_ASAN_UBSAN|RUN_GCC_ASAN_UBSAN|RUN_CLANG_ASAN_UBSAN|RUN_CLANG_ASAN_UBSAN_NO_DEPS)
# TODO: drop after we switch to ubuntu 26.04
@ -151,7 +151,7 @@ for phase in "${PHASES[@]}"; do
# during debugging, wonderful), so let's at least keep a workaround
# here to make the builds stable for the time being.
(set +x; while :; do echo -ne "\n[WATCHDOG] $(date)\n"; sleep 30; done) &
meson test --timeout-multiplier=3 -C build --print-errorlogs
meson test --timeout-multiplier=3 -C build --print-errorlogs --no-stdsplit
;;
CLEANUP)
info "Cleanup phase"

View File

@ -244,11 +244,14 @@ int manager_add_inhibitor(Manager *m, const char* id, Inhibitor **ret) {
int manager_add_button(Manager *m, const char *name, Button **ret_button) {
Button *b;
bool is_new;
assert(m);
assert(name);
b = hashmap_get(m->buttons, name);
is_new = !b;
if (!b) {
b = button_new(m, name);
if (!b)
@ -258,7 +261,7 @@ int manager_add_button(Manager *m, const char *name, Button **ret_button) {
if (ret_button)
*ret_button = b;
return 0;
return is_new;
}
int manager_process_seat_device(Manager *m, sd_device *d) {
@ -328,7 +331,7 @@ int manager_process_seat_device(Manager *m, sd_device *d) {
return 0;
}
int manager_process_button_device(Manager *m, sd_device *d) {
int manager_process_button_device(Manager *m, sd_device *d, Button **ret_button) {
const char *sysname;
Button *b;
int r;
@ -340,29 +343,40 @@ int manager_process_button_device(Manager *m, sd_device *d) {
return r;
if (device_for_action(d, SD_DEVICE_REMOVE) ||
sd_device_has_current_tag(d, "power-switch") <= 0)
sd_device_has_current_tag(d, "power-switch") <= 0) {
button_free(hashmap_get(m->buttons, sysname));
else {
const char *sn;
r = manager_add_button(m, sysname, &b);
if (r < 0)
return r;
r = device_get_seat(d, &sn);
if (r < 0)
return r;
button_set_seat(b, sn);
r = button_open(b);
if (r < 0) /* event device doesn't have any keys or switches relevant to us? (or any other error
* opening the device?) let's close the button again. */
button_free(b);
b = hashmap_get(m->buttons, sysname);
goto unwatch;
}
r = manager_add_button(m, sysname, &b);
if (r < 0)
return r;
bool is_new = r > 0;
const char *sn;
r = device_get_seat(d, &sn);
if (r < 0)
return r;
button_set_seat(b, sn);
r = button_open(b);
if (r < 0) /* event device doesn't have any keys or switches relevant to us? (or any other error
* opening the device?) let's close the button again. */
goto unwatch;
if (ret_button)
*ret_button = b;
return is_new;
unwatch:
button_free(b);
if (ret_button)
*ret_button = NULL;
return 0;
}

View File

@ -236,7 +236,7 @@ static int manager_enumerate_buttons(Manager *m) {
FOREACH_DEVICE(e, d) {
if (device_is_processed(d) <= 0)
continue;
RET_GATHER(r, manager_process_button_device(m, d));
RET_GATHER(r, manager_process_button_device(m, d, /* ret_button= */ NULL));
}
return r;
@ -739,10 +739,13 @@ static int manager_dispatch_vcsa_udev(sd_device_monitor *monitor, sd_device *dev
static int manager_dispatch_button_udev(sd_device_monitor *monitor, sd_device *device, void *userdata) {
Manager *m = ASSERT_PTR(userdata);
Button *b;
assert(device);
manager_process_button_device(m, device);
if (manager_process_button_device(m, device, &b) > 0)
(void) button_check_switches(b);
return 0;
}

View File

@ -153,7 +153,7 @@ int manager_add_user_by_uid(Manager *m, uid_t uid, User **ret_user);
int manager_add_inhibitor(Manager *m, const char* id, Inhibitor **ret_inhibitor);
int manager_process_seat_device(Manager *m, sd_device *d);
int manager_process_button_device(Manager *m, sd_device *d);
int manager_process_button_device(Manager *m, sd_device *d, Button **ret_button);
int manager_spawn_autovt(Manager *m, unsigned vtnr);

View File

@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fnmatch.h>
#include <gnu/libc-version.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
@ -368,6 +369,12 @@ static void test_exec_workingdirectory(Manager *m) {
}
static void test_exec_execsearchpath(Manager *m) {
int r;
ASSERT_OK(r = is_symlink("/bin/ls"));
if (r > 0)
return (void) log_tests_skipped("/bin/ls is a symlink, maybe coreutils is built with --enable-single-binary=symlinks");
ASSERT_OK(mkdir_p("/tmp/test-exec_execsearchpath", 0755));
ASSERT_OK(copy_file("/bin/ls", "/tmp/test-exec_execsearchpath/ls_temp", 0, 0777, COPY_REPLACE));
@ -1170,6 +1177,9 @@ static void test_exec_capabilityboundingset(Manager *m) {
}
static void test_exec_basic(Manager *m) {
if (isempty(gnu_get_libc_version()))
return (void) log_tests_skipped("ConditionVersion=glibc will not pass under musl");
if (MANAGER_IS_SYSTEM(m) || have_userns_privileges())
test(m, "exec-basic.service", can_unshare || MANAGER_IS_SYSTEM(m) ? 0 : EXIT_NAMESPACE, CLD_EXITED);
else

View File

@ -611,7 +611,10 @@ TEST(memory_deny_write_execute_shmat) {
void *p;
p = shmat(shmid, NULL, 0);
assert_se(p != MAP_FAILED);
if (p == MAP_FAILED) {
log_tests_skipped_errno(errno, "shmat() is already disabled");
_exit(EXIT_SUCCESS);
}
assert_se(shmdt(p) == 0);
p = shmat(shmid, NULL, SHM_EXEC);

View File

@ -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'

View File

@ -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'

View File

@ -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'

View File

@ -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',
},

View File

@ -4,6 +4,6 @@ integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'vm' : true,
'coredump-exclude-regex' : '/(sleep|udevadm)$',
'coredump-exclude-regex' : '/(coreutils|sleep|udevadm)$',
},
]

View File

@ -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'

View File

@ -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'

View File

@ -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

View File

@ -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]

View File

@ -3,6 +3,6 @@
integration_tests += [
integration_test_template + {
'name' : fs.name(meson.current_source_dir()),
'coredump-exclude-regex' : '/(sleep|bash|systemd-notify)$',
'coredump-exclude-regex' : '/(coreutils|sleep|bash|systemd-notify)$',
},
]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

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

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

View File

@ -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

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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'

View File

@ -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'

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

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

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

View File

@ -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"'

View File

@ -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

View File

@ -2,12 +2,13 @@
[Unit]
Description=Test DynamicUser with static User= whose uid and gid are different
# On Ubuntu or Debian, user games has uid==5 and gid==60.
# On Alpine/postmarketOS, the user 'games' in the 'games' and 'users' groups.
[Service]
Type=oneshot
ExecStart=sh -x -c 'test "$$(id -nG)" = "games" && test "$$(id -ng)" = "games" && test "$$(id -nu)" = "games"'
ExecStart=bash -x -c '[[ "$$(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 '[[ "$$(id -nG)" =~ "games" ]] && test "$$(id -ng)" = "games" && test "$$(id -nu)" = "games"'
DynamicUser=yes
User=games
ReadWritePaths=-/coverage

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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=

View File

@ -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"

View File

@ -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"

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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"'

View File

@ -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

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

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

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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

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