* tests/Coreutils.pm: Remove associated comment.
* tests/mv/sticky-to-xpart.sh: Use $EACCES and $EPERM.
* tests/rm/fail-2eperm.sh: Likewise.
* tests/touch/not-owner.sh: Likewise.
---
 tests/Coreutils.pm          |  2 --
 tests/mv/sticky-to-xpart.sh | 11 +++++------
 tests/rm/fail-2eperm.sh     |  9 ++++-----
 tests/touch/not-owner.sh    |  6 ++----
 4 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/tests/Coreutils.pm b/tests/Coreutils.pm
index 376609d73..e396d93a4 100644
--- a/tests/Coreutils.pm
+++ b/tests/Coreutils.pm
@@ -80,8 +80,6 @@ defined $ENV{TERM}
 # {ERR_SUBST => 's/variable_output/expected_output/'}
 #   Transform actual stderr output before comparing it against expected.
 #   This is useful when verifying that we get a meaningful diagnostic.
-#   For example, in rm/fail-2eperm, we have to account for three different
-#   diagnostics: Operation not permitted, Not owner, and Permission denied.
 # {EXIT => N} expect exit status of cmd to be N
 # {ENV => 'VAR=val ...'}
 #   Prepend 'VAR=val ...' to the command that we execute via 'system'.
diff --git a/tests/mv/sticky-to-xpart.sh b/tests/mv/sticky-to-xpart.sh
index d7a5db455..8b3f7029d 100755
--- a/tests/mv/sticky-to-xpart.sh
+++ b/tests/mv/sticky-to-xpart.sh
@@ -22,6 +22,7 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ mv
 require_root_
+getlimits_
 
 cleanup_() { rm -rf "$other_partition_tmpdir"; }
 . "$abs_srcdir/tests/other-fs-tmpdir"
@@ -54,21 +55,19 @@ esac
 chroot --skip-chdir --user=$NON_ROOT_USERNAME / env PATH="$PATH" \
   mv t/root-owned "$other_partition_tmpdir" 2> out-t && fail=1
 
-# On some systems, we get 'Not owner'.  Convert it.
-# On other systems (HPUX), we get 'Permission denied'.  Convert it, too.
-onp='Operation not permitted'
-sed "s/Not owner/$onp/;s/Permission denied/$onp/" out-t > out
+# On some systems (HPUX), we get 'Permission denied'.  Convert it.
+sed "s/$EACCES/$EPERM/;" out-t > out
 
 # On some systems (OpenBSD 7.5), the initial rename fails with EPERM,
 # which is arguably better than the Linux kernel's EXDEV.
 cat <<EOF >exp1 || framework_failure_
-mv: cannot move 't/root-owned' to '$other_partition_tmpdir/root-owned': $onp
+mv: cannot move 't/root-owned' to '$other_partition_tmpdir/root-owned': $EPERM
 EOF
 
 compare exp1 out >/dev/null || {
 
   cat <<EOF >exp || framework_failure_
-mv: cannot remove 't/root-owned': $onp
+mv: cannot remove 't/root-owned': $EPERM
 EOF
 
   compare exp out || fail=1
diff --git a/tests/rm/fail-2eperm.sh b/tests/rm/fail-2eperm.sh
index 2040128b5..49dbbb48e 100755
--- a/tests/rm/fail-2eperm.sh
+++ b/tests/rm/fail-2eperm.sh
@@ -20,6 +20,7 @@
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ rm
 require_root_
+getlimits_
 
 # The containing directory must be owned by the user who eventually runs rm.
 chown $NON_ROOT_USERNAME .
@@ -49,12 +50,10 @@ for file in 'a/b' 'a'; do
   returns_ 1 chroot --skip-chdir --user=$NON_ROOT_USERNAME / \
    env PATH="$PATH" rm $recurse -f "$file" 2> out-t || fail=1
 
-  # On some systems, we get 'Not owner'.  Convert it.
-  # On other systems (HPUX), we get 'Permission denied'.  Convert it, too.
-  onp='Operation not permitted'
-  sed "s/Not owner/$onp/;s/Permission denied/$onp/" out-t > out
+  # On some systems (HPUX), we get 'Permission denied'.  Convert it.
+  sed "s/$EACCES/$EPERM/" out-t > out
 
-  echo "rm: cannot remove 'a/b': Operation not permitted" > exp
+  echo "rm: cannot remove 'a/b': $EPERM" > exp
   compare exp out || fail=1
 done
 
diff --git a/tests/touch/not-owner.sh b/tests/touch/not-owner.sh
index 948e16fe9..9e3a23d09 100755
--- a/tests/touch/not-owner.sh
+++ b/tests/touch/not-owner.sh
@@ -19,6 +19,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ touch
+getlimits_
 
 if env -- test -w /; then
   skip_ you have write access to /.
@@ -36,12 +37,9 @@ skip_if_root_
 # touch: creating '/': Is a directory
 touch / > out 2>&1 && fail=1
 
-# On SunOS4, EPERM is 'Not owner'.
-# On some *BSD systems it's 'Operation not permitted'.
 # On a system where root file system is mounted read-only
 # it's 'Read-only file system'.
-for msg in 'Not owner' 'Operation not permitted' 'Permission denied' \
-           'Read-only file system'; do
+for msg in "$EACCES" "$EPERM" "$EROFS"; do
   cat > exp <<EOF
 touch: setting times of '/': $msg
 EOF
-- 
2.52.0


Reply via email to