]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: tests: avoid EPERM specific handling
authorPádraig Brady <P@draigBrady.com>
Sat, 14 Feb 2026 12:15:15 +0000 (12:15 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 18 Feb 2026 18:31:49 +0000 (18:31 +0000)
* tests/dd/fail-ftruncate-fstat.sh: Use $EPERM rather than
mapping specific strings to the Linux $EPERM.
* tests/mkdir/smack-no-root.sh: Use $EPERM rather than hardcoding.

tests/dd/fail-ftruncate-fstat.sh
tests/mkdir/smack-no-root.sh

index e438eb721f1b2a28ea0a2fd3e69ca7e146d77d00..219273bbc2174830eb46d5fcf922f1b78d854151 100755 (executable)
@@ -19,6 +19,7 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ dd
 require_gcc_shared_
+getlimits_
 
 cat > k.c <<'EOF' || framework_failure_
 #include <sys/stat.h>
@@ -58,20 +59,14 @@ yes | head -n 2048 | tr -d '\n' > out || framework_failure_
 cp out exp-out || framework_failure_
 
 LD_PRELOAD=$LD_PRELOAD:./k.so dd if=/dev/zero of=out count=1 \
-                              seek=1 status=none 2>errt
+                              seek=1 status=none 2>err
 ret=$?
 
 test -f x && test -f y \
   || skip_ "internal test failure: maybe LD_PRELOAD doesn't work?"
 
-# EPERM='Not owner'               on Solaris 11.4.0.15.0 (2018)
-# EPERM='Insufficient privileges' on Solaris 11.4.89.207 (2026)
-sed -e 's/Insufficient privileges/Operation not permitted/' \
-    -e 's/Not owner/Operation not permitted/' \
-    < errt > err || framework_failure_
-
 # After ftruncate fails, we use fstat to get the file type.
-echo "dd: cannot fstat 'out': Operation not permitted" > exp
+echo "dd: cannot fstat 'out': $EPERM" > exp
 compare exp err || fail=1
 
 # coreutils 9.1 to 9.9 would mistakenly continue copying after ftruncate
index b0179a2ede548f961f8ad416b5b6d5350c5cddbe..5a16c4e20ad4f2bd90630bf4f3e309ff594e7000 100755 (executable)
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ mkdir mkfifo mknod
-
 require_smack_
+getlimits_
 
 c=arbitrary-smack-label
-msg="failed to set default file creation context to '$c':"
+msg="failed to set default file creation context to '$c': $EPERM"
 
 for cmd in 'mkdir dir' 'mknod b p' 'mkfifo f'; do
   $cmd --context="$c" 2> out && fail=1
   set -- $cmd
   echo "$1: $msg" > exp || framework_failure_
 
-  sed -e 's/ Operation not permitted$//' out > k || framework_failure_
-  mv k out || fail=1
   compare exp out || fail=1
 done