]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid false failure where mknod() can't create sockets
authorPádraig Brady <P@draigBrady.com>
Wed, 1 Jul 2026 23:52:01 +0000 (00:52 +0100)
committerPádraig Brady <P@draigBrady.com>
Wed, 1 Jul 2026 23:58:18 +0000 (00:58 +0100)
* tests/mv/mv-special-1.sh: Adjust the python probe to more
closely match how copy.c creates sockets, as otherwise we
get a false failure on systems where mknod() fails with S_IFSOCK,
which was seen on Solaris and FreeBSD at least.
* tests/mv/mv-special-2.sh: Adjust similarly as this
was a latent issue on this root only test.
Reported by Bruno Haible.

tests/mv/mv-special-1.sh
tests/mv/mv-special-2.sh

index 44f78fe59fca9bc6aeca84973e7c14beb192ea09..465e670e3695080ff45186901167ca787fd6c2c3 100755 (executable)
@@ -84,9 +84,10 @@ compare exp out2 || fail=1
 # must replace that destination, not unlink it first and then fail,
 # leaving the user with neither file.
 source=mv-sock
-if python -c "import socket as s; \
-              s.socket(s.AF_UNIX).bind('$source'); \
-              s.socket(s.AF_UNIX).bind('$other_partition_tmpdir/test.sock') \
+if python -c "import os, stat; \
+              os.mknod('$source', stat.S_IFSOCK | 0o600); \
+              os.mknod('$other_partition_tmpdir/test.sock', \
+                       stat.S_IFSOCK | 0o600) \
               " &&
  test -S "$source" && test -S "$other_partition_tmpdir/test.sock"; then
 
index 9ecea4e97ec21232b544065205bd9f64913a96a2..b588d2880c42fcce8153a2e20545f581df44d25f 100755 (executable)
@@ -65,8 +65,9 @@ mv --verbose broken_symlink xdev &&
 returns_ 1 test -L broken_symlink &&
 test -L xdev/broken_symlink || fail=1
 
-if python -c "import socket as s; s.socket(s.AF_UNIX).bind('test.sock')" &&
-   test -S 'test.sock'; then
+if python -c "import os, stat; \
+              os.mknod('test.sock', stat.S_IFSOCK | 0o600); \
+              " && test -S 'test.sock'; then
   mv --verbose test.sock xdev &&
   returns_ 1 test -S test.sock &&
   test -S xdev/test.sock || fail=1