From: Yu Watanabe Date: Tue, 17 Dec 2024 06:09:47 +0000 (+0900) Subject: TEST-50-DISSECT: notify message cannot be sent by ncat X-Git-Tag: v258-rc1~1819 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=67e5622bfe037603e47f38cf02e58d522b3c18f7;p=thirdparty%2Fsystemd.git TEST-50-DISSECT: notify message cannot be sent by ncat Follow-up for d0a63cf0412ccb9b4edd1f6048e25aa7f68b0133. The command ncat may be already dead when the service manager receives the notify message. Hence, the service cannot be found by the sender PID, and the notify message will be ignored. ``` Dec 17 03:26:49 systemd[1]: Cannot find unit for notify message of PID 1159, ignoring. Dec 17 03:26:49 systemd[1]: Received SIGCHLD from PID 1152 (bash). Dec 17 03:26:49 systemd[1]: Child 1152 (bash) died (code=exited, status=0/SUCCESS) Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Child 1152 belongs to run-p1151-i1451.service. Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Main process exited, code=exited, status=0/SUCCESS (success) Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Failed with result 'protocol'. Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Service will not restart (restart setting) Dec 17 03:26:49 systemd[1]: run-p1151-i1451.service: Changed start -> failed ``` This also drops unnecessary --pipe option and redundant check by 'env' command. --- diff --git a/test/units/TEST-50-DISSECT.dissect.sh b/test/units/TEST-50-DISSECT.dissect.sh index 2ca07453ec0..a7122855d9c 100755 --- a/test/units/TEST-50-DISSECT.dissect.sh +++ b/test/units/TEST-50-DISSECT.dissect.sh @@ -85,31 +85,25 @@ systemd-run \ --wait \ -p RootImage="$MINIMAL_IMAGE.raw" \ -p NotifyAccess=all \ - --service-type=notify \ - --pipe \ bash -xec \ ' - printf MAINPID=$$$$\\nREADY=1 | ncat --unixsock --udp $NOTIFY_SOCKET --source /run/notify [[ "$$NOTIFY_SOCKET" == "/run/host/notify" ]] - [[ "$$(env)" =~ "NOTIFY_SOCKET=/run/host/notify" ]] test -S /run/host/notify ' if [[ "$(findmnt -n -o FSTYPE /)" == btrfs ]]; then [[ -d /test-dissect-btrfs-snapshot ]] && btrfs subvolume delete /test-dissect-btrfs-snapshot btrfs subvolume snapshot / /test-dissect-btrfs-snapshot - # Same test with systemd-notify and RootDirectory= + # Same test with RootDirectory=, also try to send READY=1, as we can use systemd-notify. systemd-run \ --wait \ -p RootDirectory=/test-dissect-btrfs-snapshot \ -p NotifyAccess=all \ --service-type=notify \ - --pipe \ bash -xec \ ' systemd-notify --pid=auto --ready [[ "$$NOTIFY_SOCKET" == "/run/host/notify" ]] - [[ "$(env)" =~ "NOTIFY_SOCKET=/run/host/notify" ]] test -S /run/host/notify '