1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-31 14:50:15 +03:00

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.
This commit is contained in:
Franck Bui 2021-11-17 08:13:04 +01:00 committed by Yu Watanabe
parent 7285145dfc
commit 051ea718f2
2 changed files with 1 additions and 3 deletions

View File

@ -175,7 +175,6 @@ BASICTOOLS=(
sfdisk
sh
sleep
socat
stat
su
sulogin

View File

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