From: Pádraig Brady
Date: Wed, 1 Jul 2026 23:52:01 +0000 (+0100) Subject: tests: avoid false failure where mknod() can't create sockets X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e45a3f6a19b444feebe91dea116b709643f153b5;p=thirdparty%2Fcoreutils.git tests: avoid false failure where mknod() can't create sockets * 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. --- diff --git a/tests/mv/mv-special-1.sh b/tests/mv/mv-special-1.sh index 44f78fe59f..465e670e36 100755 --- a/tests/mv/mv-special-1.sh +++ b/tests/mv/mv-special-1.sh @@ -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 diff --git a/tests/mv/mv-special-2.sh b/tests/mv/mv-special-2.sh index 9ecea4e97e..b588d2880c 100755 --- a/tests/mv/mv-special-2.sh +++ b/tests/mv/mv-special-2.sh @@ -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