From: Pádraig Brady
Date: Sat, 14 Feb 2026 12:23:00 +0000 (+0000)
Subject: maint: tests: avoid EPERM/EACCES specific handling
X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c03cc2dca6fb66a0c2055fe0d6c2039bc2a9f042;p=thirdparty%2Fcoreutils.git
maint: tests: avoid EPERM/EACCES specific handling
* 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.
---
diff --git a/tests/Coreutils.pm b/tests/Coreutils.pm
index 376609d731..e396d93a4b 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 d7a5db4558..8b3f7029d9 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 <