From ca5ecaae7a8f75e18ba85b29839752da76e3b7b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 16 Sep 2024 20:20:44 +0200 Subject: Merging upstream version 256.4. Signed-off-by: Daniel Baumann --- test/units/TEST-07-PID1.exec-context.sh | 20 ++++++++-------- test/units/TEST-07-PID1.issue-2467.sh | 2 +- test/units/TEST-07-PID1.issue-3171.sh | 8 +++---- test/units/TEST-07-PID1.issue-33672.sh | 40 +++++++++++++++++++++++++++++++ test/units/TEST-13-NSPAWN.nspawn.sh | 12 +++++++--- test/units/TEST-29-PORTABLE.sh | 15 ++++++------ test/units/TEST-55-OOMD-testbloat.service | 4 ++-- test/units/TEST-55-OOMD-testmunch.service | 2 +- test/units/TEST-55-OOMD.sh | 8 ------- test/units/TEST-73-LOCALE.sh | 23 ++++++++++++++++++ 10 files changed, 98 insertions(+), 36 deletions(-) create mode 100755 test/units/TEST-07-PID1.issue-33672.sh (limited to 'test/units') diff --git a/test/units/TEST-07-PID1.exec-context.sh b/test/units/TEST-07-PID1.exec-context.sh index a3379ef..cf39af0 100755 --- a/test/units/TEST-07-PID1.exec-context.sh +++ b/test/units/TEST-07-PID1.exec-context.sh @@ -186,27 +186,27 @@ if ! systemd-detect-virt -cq; then ) # We should fail with EPERM when trying to bind to a socket not on the allow list - # (nc exits with 2 in that case) + # (ncat exits with 2 in that case) systemd-run --wait -p SuccessExitStatus="1 2" --pipe "${ARGUMENTS[@]}" \ - bash -xec 'timeout 1s nc -l 127.0.0.1 9999; exit 42' + bash -xec 'timeout 1s ncat -l 127.0.0.1 9999; exit 42' systemd-run --wait -p SuccessExitStatus="1 2" --pipe "${ARGUMENTS[@]}" \ - bash -xec 'timeout 1s nc -l ::1 9999; exit 42' + bash -xec 'timeout 1s ncat -l ::1 9999; exit 42' systemd-run --wait -p SuccessExitStatus="1 2" --pipe "${ARGUMENTS[@]}" \ - bash -xec 'timeout 1s nc -6 -u -l ::1 9999; exit 42' + bash -xec 'timeout 1s ncat -6 -u -l ::1 9999; exit 42' systemd-run --wait -p SuccessExitStatus="1 2" --pipe "${ARGUMENTS[@]}" \ - bash -xec 'timeout 1s nc -4 -l 127.0.0.1 6666; exit 42' + bash -xec 'timeout 1s ncat -4 -l 127.0.0.1 6666; exit 42' systemd-run --wait -p SuccessExitStatus="1 2" --pipe -p SocketBindDeny=any \ - bash -xec 'timeout 1s nc -l 127.0.0.1 9999; exit 42' + bash -xec 'timeout 1s ncat -l 127.0.0.1 9999; exit 42' # Consequently, we should succeed when binding to a socket on the allow list # and keep listening on it until we're killed by `timeout` (EC 124) systemd-run --wait --pipe -p SuccessExitStatus=124 "${ARGUMENTS[@]}" \ - bash -xec 'timeout 1s nc -4 -l 127.0.0.1 1234; exit 1' + bash -xec 'timeout 1s ncat -4 -l 127.0.0.1 1234; exit 1' systemd-run --wait --pipe -p SuccessExitStatus=124 "${ARGUMENTS[@]}" \ - bash -xec 'timeout 1s nc -4 -u -l 127.0.0.1 5678; exit 1' + bash -xec 'timeout 1s ncat -4 -u -l 127.0.0.1 5678; exit 1' systemd-run --wait --pipe -p SuccessExitStatus=124 "${ARGUMENTS[@]}" \ - bash -xec 'timeout 1s nc -6 -l ::1 1234; exit 1' + bash -xec 'timeout 1s ncat -6 -l ::1 1234; exit 1' systemd-run --wait --pipe -p SuccessExitStatus=124 "${ARGUMENTS[@]}" \ - bash -xec 'timeout 1s nc -6 -l ::1 6666; exit 1' + bash -xec 'timeout 1s ncat -6 -l ::1 6666; exit 1' fi losetup -d "$LODEV" diff --git a/test/units/TEST-07-PID1.issue-2467.sh b/test/units/TEST-07-PID1.issue-2467.sh index de0577b..083a1e7 100755 --- a/test/units/TEST-07-PID1.issue-2467.sh +++ b/test/units/TEST-07-PID1.issue-2467.sh @@ -8,7 +8,7 @@ set -o pipefail rm -f /tmp/nonexistent systemctl start issue2467.socket -nc -i20 -w20 -U /run/test.ctl || : +ncat -i20 -w20 -U /run/test.ctl || : # TriggerLimitIntervalSec= by default is set to 2s. A "sleep 10" should give # systemd enough time even on slower machines, to reach the trigger limit. diff --git a/test/units/TEST-07-PID1.issue-3171.sh b/test/units/TEST-07-PID1.issue-3171.sh index 374df54..e1a4b64 100755 --- a/test/units/TEST-07-PID1.issue-3171.sh +++ b/test/units/TEST-07-PID1.issue-3171.sh @@ -30,21 +30,21 @@ EOF systemctl start issue-3171.socket systemctl is-active issue-3171.socket [[ "$(stat --format='%G' /run/issue-3171.socket)" == adm ]] -echo A | nc -w1 -U /run/issue-3171.socket +echo A | ncat -w1 -U /run/issue-3171.socket mv $U ${U}.disabled systemctl daemon-reload systemctl is-active issue-3171.socket [[ "$(stat --format='%G' /run/issue-3171.socket)" == adm ]] -echo B | nc -w1 -U /run/issue-3171.socket && exit 1 +echo B | ncat -w1 -U /run/issue-3171.socket && exit 1 mv ${U}.disabled $U systemctl daemon-reload systemctl is-active issue-3171.socket -echo C | nc -w1 -U /run/issue-3171.socket && exit 1 +echo C | ncat -w1 -U /run/issue-3171.socket && exit 1 [[ "$(stat --format='%G' /run/issue-3171.socket)" == adm ]] systemctl restart issue-3171.socket systemctl is-active issue-3171.socket -echo D | nc -w1 -U /run/issue-3171.socket +echo D | ncat -w1 -U /run/issue-3171.socket [[ "$(stat --format='%G' /run/issue-3171.socket)" == adm ]] diff --git a/test/units/TEST-07-PID1.issue-33672.sh b/test/units/TEST-07-PID1.issue-33672.sh new file mode 100755 index 0000000..370497c --- /dev/null +++ b/test/units/TEST-07-PID1.issue-33672.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +set -eux +set -o pipefail + +# shellcheck source=test/units/util.sh +. "$(dirname "$0")"/util.sh + +# systemctl status always shows daemon-reload warning for a masked service with drop-ins +# Issue: https://github.com/systemd/systemd/issues/33672 + +UNIT=test-23-NeedDaemonReload.service + +cleanup() { + rm -rf /run/systemd/system/"$UNIT" /run/systemd/system/"$UNIT".d + systemctl daemon-reload +} + +trap cleanup EXIT + +cat > /run/systemd/system/"$UNIT" < /run/systemd/system/"$UNIT".d/desc.conf < /tmp/wrongext/usr/lib/systemd/system/app0.service -touch /tmp/wrongext/usr/lib/extension-release.d/extension-release.wrongext_somethingwrong.txt -cp /tmp/rootdir/usr/lib/os-release /tmp/wrongext/usr/lib/extension-release.d/extension-release.app0 -setfattr -n user.extension-release.strict -v "false" /tmp/wrongext/usr/lib/extension-release.d/extension-release.app0 -portablectl "${ARGS[@]}" attach --runtime --extension /tmp/wrongext /tmp/rootdir app0 +trap 'rm -rf /var/cache/wrongext' EXIT +mkdir -p /var/cache/wrongext/usr/lib/extension-release.d /var/cache/wrongext/usr/lib/systemd/system/ +echo "[Service]" > /var/cache/wrongext/usr/lib/systemd/system/app0.service +touch /var/cache/wrongext/usr/lib/extension-release.d/extension-release.wrongext_somethingwrong.txt +cp /tmp/rootdir/usr/lib/os-release /var/cache/wrongext/usr/lib/extension-release.d/extension-release.app0 +setfattr -n user.extension-release.strict -v "false" /var/cache/wrongext/usr/lib/extension-release.d/extension-release.app0 +portablectl "${ARGS[@]}" attach --runtime --extension /var/cache/wrongext /tmp/rootdir app0 status="$(portablectl is-attached --extension wrongext rootdir)" [[ "${status}" == "attached-runtime" ]] -portablectl detach --runtime --extension /tmp/wrongext /tmp/rootdir app0 +portablectl detach --runtime --extension /var/cache/wrongext /tmp/rootdir app0 umount /tmp/rootdir umount /tmp/app0 diff --git a/test/units/TEST-55-OOMD-testbloat.service b/test/units/TEST-55-OOMD-testbloat.service index ba4f2bc..70c8772 100644 --- a/test/units/TEST-55-OOMD-testbloat.service +++ b/test/units/TEST-55-OOMD-testbloat.service @@ -3,8 +3,8 @@ Description=Create a lot of memory pressure [Service] -# A VERY small memory.high will cause the 'stress' (trying to use a lot of memory) +# A VERY small memory.high will cause the 'stress-ng' (trying to use a lot of memory) # to throttle and be put under heavy pressure. MemoryHigh=3M Slice=TEST-55-OOMD-workload.slice -ExecStart=stress --timeout 3m --vm 10 --vm-bytes 200M --vm-keep --vm-stride 1 +ExecStart=stress-ng --timeout 3m --vm 10 --vm-bytes 200M --vm-keep diff --git a/test/units/TEST-55-OOMD-testmunch.service b/test/units/TEST-55-OOMD-testmunch.service index 5659906..79bd018 100644 --- a/test/units/TEST-55-OOMD-testmunch.service +++ b/test/units/TEST-55-OOMD-testmunch.service @@ -5,4 +5,4 @@ Description=Create some memory pressure [Service] MemoryHigh=12M Slice=TEST-55-OOMD-workload.slice -ExecStart=stress --timeout 3m --vm 10 --vm-bytes 200M --vm-keep --vm-stride 1 +ExecStart=stress-ng --timeout 3m --vm 10 --vm-bytes 200M --vm-keep diff --git a/test/units/TEST-55-OOMD.sh b/test/units/TEST-55-OOMD.sh index b04ebca..944067c 100755 --- a/test/units/TEST-55-OOMD.sh +++ b/test/units/TEST-55-OOMD.sh @@ -6,14 +6,6 @@ set -o pipefail # shellcheck source=test/units/util.sh . "$(dirname "$0")"/util.sh -. /etc/os-release -# OpenSUSE does not have the stress tool packaged. It does have stress-ng but the stress-ng does not support -# --vm-stride which this test uses. -if [[ "$ID" =~ "opensuse" ]]; then - echo "Skipping due to missing stress package in OpenSUSE" >>/skipped - exit 77 -fi - systemd-analyze log-level debug # Ensure that the init.scope.d drop-in is applied on boot diff --git a/test/units/TEST-73-LOCALE.sh b/test/units/TEST-73-LOCALE.sh index 18539b8..06c8c56 100755 --- a/test/units/TEST-73-LOCALE.sh +++ b/test/units/TEST-73-LOCALE.sh @@ -657,6 +657,29 @@ testcase_locale_gen_leading_space() { # running on. export SYSTEMD_KBD_MODEL_MAP=/usr/lib/systemd/tests/testdata/test-keymap-util/kbd-model-map +# On Debian and derivatives writing calls to localed are blocked as other tools are used to change settings, +# override that policy +mkdir -p /etc/dbus-1/system.d/ +cat >/etc/dbus-1/system.d/systemd-localed-read-only.conf < + + + + + + + + + + + + + +EOF +trap 'rm -f /etc/dbus-1/system.d/systemd-localed-read-only.conf' EXIT +systemctl reload dbus.service + enable_debug run_testcases -- cgit v1.2.3