ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
36e8a3
From bf7631e7c0a7d1cac2f071ce998d5c669aa5abd7 Mon Sep 17 00:00:00 2001
36e8a3
From: Frantisek Sumsal <frantisek@sumsal.cz>
36e8a3
Date: Tue, 29 Jan 2019 19:33:15 +0100
36e8a3
Subject: [PATCH] test: replace echo with socat
36e8a3
36e8a3
The original version of the test used netcat along with a standard
36e8a3
AF_UNIX socket, which caused issues across different netcat
36e8a3
implementations. The AF_UNIX socket was then replaced by a FIFO with a
36e8a3
simple echo, which, however, suffers from the same issue (some echo
36e8a3
implementations don't check if the write() was successful).
36e8a3
36e8a3
Let's revert back to the AF_UNIX socket, but replace netcat with socat,
36e8a3
which, hopefully, resolves the main issue.
36e8a3
36e8a3
Relevant commit: 9b45c2bf02a43e3e1b42de1ab0c3fe29c64dc5f5
36e8a3
36e8a3
(cherry picked from commit b35d6d828b3216d022e565820d9971cb0f7746c1)
36e8a3
---
36e8a3
 test/TEST-10-ISSUE-2467/test.sh | 6 +++---
36e8a3
 1 file changed, 3 insertions(+), 3 deletions(-)
36e8a3
36e8a3
diff --git a/test/TEST-10-ISSUE-2467/test.sh b/test/TEST-10-ISSUE-2467/test.sh
36e8a3
index e61f5acd3..0e6123668 100755
36e8a3
--- a/test/TEST-10-ISSUE-2467/test.sh
36e8a3
+++ b/test/TEST-10-ISSUE-2467/test.sh
36e8a3
@@ -17,7 +17,7 @@ test_setup() {
36e8a3
         eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
36e8a3
 
36e8a3
         setup_basic_environment
36e8a3
-        dracut_install true rm
36e8a3
+        dracut_install true rm socat
36e8a3
 
36e8a3
         # setup the testsuite service
36e8a3
         cat >$initdir/etc/systemd/system/testsuite.service <<'EOF'
36e8a3
@@ -29,13 +29,13 @@ After=multi-user.target
36e8a3
 Type=oneshot
36e8a3
 StandardOutput=tty
36e8a3
 StandardError=tty
36e8a3
-ExecStart=/bin/sh -e -x -c 'rm -f /tmp/nonexistent; systemctl start test.socket; echo > /run/test.ctl; >/testok'
36e8a3
+ExecStart=/bin/sh -e -x -c 'rm -f /tmp/nonexistent; systemctl start test.socket; printf x > test.file; socat -t20 OPEN:test.file UNIX-CONNECT:/run/test.ctl; >/testok'
36e8a3
 TimeoutStartSec=10s
36e8a3
 EOF
36e8a3
 
36e8a3
 	cat  >$initdir/etc/systemd/system/test.socket <<'EOF'
36e8a3
 [Socket]
36e8a3
-ListenFIFO=/run/test.ctl
36e8a3
+ListenStream=/run/test.ctl
36e8a3
 EOF
36e8a3
 
36e8a3
 	cat > $initdir/etc/systemd/system/test.service <<'EOF'