tests: avoid panic-tests failure on multiple systems

* testsuite/panic-tests.sh: Test explicitly and skip if we can
still write to a directory that's been subject to "chmod a-w".
This struck on CentOS 7, Alma Linux, Alpine Linux and Cygwin.
Reported by Bruno Haible in
https://lists.gnu.org/r/sed-devel/2026-04/msg00008.html
This commit is contained in:
Jim Meyering committed 2026-04-18 22:21:48 -07:00
1 parent feb70156f4
commit a3f33e43ad
1 file changed
+4 -6
+4 -6
View File
@@ -27,12 +27,10 @@ mkdir a || framework_failure_
touch a/a || framework_failure_
chmod a-w a || framework_failure_
# skip the test when running as root or when running in Cygwin
# (because in these cases, the directory is still actually writable)
test `id -u` != 0 || skip_ 'running as root'
case `uname -s` in
CYGWIN*) skip_ 'running in cygwin' ;;
esac
# Skip if the directory is still writable, in spite of chmod a-w,
# as happens with root, Cygwin (where owner trumps a-w) and ACLs
# and capabilities.
touch a/t 2>/dev/null && skip_ 'directory is still writable'
# Expected error message, with actual filename/errno trimmed
cat <<\EOF >exp-err-temp || framework_failure_