From 051ea718f26dffe60c6864e6314068ab25062a9c Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Wed, 17 Nov 2021 08:13:04 +0100 Subject: [PATCH] TEST-10: don't attempt to write a byte to the socket Writing a byte to test10.socket is actually the root cause of issue #19154: depending on the timing, it's possible that PID1 closes the socket before socat (or nc, it doesn't matter which tool is actually used) tries to write that one byte to the socket. In this case writing to the socket returns EPIPE, which causes socat to exit(1) and subsequently make the test fail. Since we're only interested in connecting to the socket and triggering the rate limit of the socket, this patch removes the parts that write the single byte to the socket, which should remove the race for good. Since it shouldn't matter whether the test uses socat or nc, let's switch back to nc and hence remove the sole user of socat. The exit status of nc is however ignored because some versions might choke when the socket is closed unexpectedly. --- test/test-functions | 1 - test/units/testsuite-10.service | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/test/test-functions b/test/test-functions index 5e3eadd37fc..7b9467cfc1c 100644 --- a/test/test-functions +++ b/test/test-functions @@ -175,7 +175,6 @@ BASICTOOLS=( sfdisk sh sleep - socat stat su sulogin diff --git a/test/units/testsuite-10.service b/test/units/testsuite-10.service index 10407632768..f33c1b646ab 100644 --- a/test/units/testsuite-10.service +++ b/test/units/testsuite-10.service @@ -7,8 +7,7 @@ ExecStartPre=rm -f /failed /testok Type=oneshot ExecStart=rm -f /tmp/nonexistent ExecStart=systemctl start test10.socket -ExecStart=sh -x -c 'printf x >test.file' -ExecStart=-socat -T20 OPEN:test.file UNIX-CONNECT:/run/test.ctl +ExecStart=-nc -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. ExecStart=sleep 10 -- 2.47.3