* tests/chgrp/no-x.sh: Don't harcode "Permission denied".
* tests/chmod/no-x.sh: Likewise.
* tests/du/inacc-dest.sh: Likewise.
* tests/du/no-x.sh: Likewise.
* tests/misc/nohup.sh: Likewise.
* tests/mv/part-fail.sh: Likewise.
* tests/mv/perm-1.sh: Likewise.
* tests/rm/fail-eacces.sh: Likewise.
* tests/rm/rm1.sh: Likewise.
* tests/rm/rm2.sh: Likewise.
* tests/rm/unread2.sh: Likewise.
* tests/rm/unreadable.pl: Likewise.
---
tests/chgrp/no-x.sh | 3 ++-
tests/chmod/no-x.sh | 3 ++-
tests/du/inacc-dest.sh | 5 +++--
tests/du/no-x.sh | 3 ++-
tests/misc/nohup.sh | 6 +++---
tests/mv/part-fail.sh | 8 +++++---
tests/mv/perm-1.sh | 5 +++--
tests/rm/fail-eacces.sh | 9 +++++----
tests/rm/rm1.sh | 9 +++++----
tests/rm/rm2.sh | 13 +++++++------
tests/rm/unread2.sh | 5 +++--
tests/rm/unreadable.pl | 4 +++-
12 files changed, 43 insertions(+), 30 deletions(-)
diff --git a/tests/chgrp/no-x.sh b/tests/chgrp/no-x.sh
index b20b92562..8d160957f 100755
--- a/tests/chgrp/no-x.sh
+++ b/tests/chgrp/no-x.sh
@@ -22,6 +22,7 @@ print_ver_ chgrp
require_membership_in_two_groups_
skip_if_root_
require_local_dir_
+getlimits_
set _ $groups; shift
g1=$1
@@ -47,7 +48,7 @@ sed "s/^$prog: cannot read directory /$prog: /" out > t && mv
t out
sed 's,d/no-x/y,d/no-x,' out > t && mv t out
cat <<EOF > exp
-$prog: 'd/no-x': Permission denied
+$prog: 'd/no-x': $EACCES
EOF
compare exp out || fail=1
diff --git a/tests/chmod/no-x.sh b/tests/chmod/no-x.sh
index 8a44836bf..bbf00375d 100755
--- a/tests/chmod/no-x.sh
+++ b/tests/chmod/no-x.sh
@@ -20,6 +20,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ chmod
skip_if_root_
+getlimits_
mkdir -p d/no-x/y a/b || framework_failure_
chmod u=rw d/no-x || framework_failure_
@@ -41,7 +42,7 @@ sed "s/^$prog: cannot read directory /$prog: /" out > t && mv
t out
sed 's,d/no-x/y,d/no-x,' out > t && mv t out
cat <<EOF > exp
-$prog: 'd/no-x': Permission denied
+$prog: 'd/no-x': $EACCES
EOF
compare exp out || fail=1
diff --git a/tests/du/inacc-dest.sh b/tests/du/inacc-dest.sh
index fc8e86817..b578d76f1 100755
--- a/tests/du/inacc-dest.sh
+++ b/tests/du/inacc-dest.sh
@@ -20,6 +20,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ du
skip_if_root_
+getlimits_
mkdir f && cd f && mkdir a b c d e && touch c/j && chmod a-x c \
|| framework_failure_
@@ -33,14 +34,14 @@ du > ../t 2>&1 && fail=1
# /proc support, nor native openat support.
sed 's/^[0-9][0-9]* //' ../t | sort -u > out
-cat <<\EOF > exp || framework_failure_
+cat <<EOF > exp || framework_failure_
.
./a
./b
./c
./d
./e
-du: cannot read directory './c': Permission denied
+du: cannot read directory './c': $EACCES
EOF
# Map a diagnostic like this
diff --git a/tests/du/no-x.sh b/tests/du/no-x.sh
index f47e4ca5c..238b5d022 100755
--- a/tests/du/no-x.sh
+++ b/tests/du/no-x.sh
@@ -20,6 +20,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ du
skip_if_root_
+getlimits_
mkdir -p d/no-x/y || framework_failure_
chmod u=rw d/no-x || framework_failure_
@@ -41,7 +42,7 @@ sed "s/^$prog: cannot read directory /$prog: /" out > t && mv
t out
sed 's,d/no-x/y,d/no-x,' out > t && mv t out
cat <<EOF > exp
-$prog: 'd/no-x': Permission denied
+$prog: 'd/no-x': $EACCES
EOF
compare exp out || fail=1
diff --git a/tests/misc/nohup.sh b/tests/misc/nohup.sh
index 08a486e01..5c9c96606 100755
--- a/tests/misc/nohup.sh
+++ b/tests/misc/nohup.sh
@@ -18,7 +18,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ nohup
-
+getlimits_
nohup sh -c 'echo stdout; echo stderr 1>&2' 2>err || fail=1
@@ -108,9 +108,9 @@ if test -t 1; then
compare /dev/null nohup.out || fail=1
fi
-cat <<\EOF > exp || framework_failure_
+cat <<EOF > exp || framework_failure_
nohup: appending output to 'nohup.out'
-nohup: cannot run command './k': Permission denied
+nohup: cannot run command './k': $EACCES
EOF
# Disable these comparisons. Too much variation in 2nd line.
# compare exp err || fail=1
diff --git a/tests/mv/part-fail.sh b/tests/mv/part-fail.sh
index 024eb9009..d3145bcb6 100755
--- a/tests/mv/part-fail.sh
+++ b/tests/mv/part-fail.sh
@@ -22,6 +22,8 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ mv
skip_if_root_
+getlimits_
+
cleanup_() { t=$other_partition_tmpdir; chmod -R 700 "$t"; rm -rf "$t"; }
. "$abs_srcdir/tests/other-fs-tmpdir"
@@ -32,13 +34,13 @@ chmod u-w "$other_partition_tmpdir" || framework_failure_
mv -f k "$other_partition_tmpdir" 2> out && fail=1
printf \
"mv: inter-device move failed: '%s' to '%s';"\
-' unable to remove target: Permission denied\n' \
- k "$other_partition_tmpdir/k" >exp
+' unable to remove target: %s\n' \
+ k "$other_partition_tmpdir/k" "$EACCES" >exp
# On some (less-compliant) systems, we get EPERM in this case.
# Accept either diagnostic.
cat <<EOF > exp2
-mv: cannot move 'k' to '$other_partition_tmpdir/k': Permission denied
+mv: cannot move 'k' to '$other_partition_tmpdir/k': $EACCES
EOF
if cmp out exp >/dev/null 2>&1; then
diff --git a/tests/mv/perm-1.sh b/tests/mv/perm-1.sh
index d06677f94..6d99f8557 100755
--- a/tests/mv/perm-1.sh
+++ b/tests/mv/perm-1.sh
@@ -20,14 +20,15 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ mv
skip_if_root_
+getlimits_
mkdir -p no-write/dir || framework_failure_
chmod ug-w no-write || framework_failure_
mv no-write/dir . > out 2>&1 && fail=1
-cat <<\EOF > exp
-mv: cannot move 'no-write/dir' to './dir': Permission denied
+cat <<EOF > exp
+mv: cannot move 'no-write/dir' to './dir': $EACCES
EOF
compare exp out || fail=1
diff --git a/tests/rm/fail-eacces.sh b/tests/rm/fail-eacces.sh
index 69238e9e4..e2d47e31f 100755
--- a/tests/rm/fail-eacces.sh
+++ b/tests/rm/fail-eacces.sh
@@ -22,6 +22,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ rm
skip_if_root_
+getlimits_
ok=0
mkdir d &&
@@ -39,15 +40,15 @@ test $ok = 1 || framework_failure_
rm -rf d/f 2> out && fail=1
-cat <<\EOF > exp
-rm: cannot remove 'd/f': Permission denied
+cat <<EOF > exp
+rm: cannot remove 'd/f': $EACCES
EOF
compare exp out || fail=1
# This used to fail with ELOOP.
rm -rf e 2> out && fail=1
-cat <<\EOF > exp
-rm: cannot remove 'e/slink': Permission denied
+cat <<EOF > exp
+rm: cannot remove 'e/slink': $EACCES
EOF
compare exp out || fail=1
diff --git a/tests/rm/rm1.sh b/tests/rm/rm1.sh
index 025c5341a..5a9b6c436 100755
--- a/tests/rm/rm1.sh
+++ b/tests/rm/rm1.sh
@@ -19,6 +19,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ rm
skip_if_root_
+getlimits_
mkdir -p b/a/p b/c b/d || framework_failure_
chmod ug-w b/a || framework_failure_
@@ -26,14 +27,14 @@ chmod ug-w b/a || framework_failure_
# This should fail.
rm -rf b > out 2>&1 && fail=1
-cat <<\EOF > exp
-rm: cannot remove directory 'b/a/p': Permission denied
+cat <<EOF > exp
+rm: cannot remove directory 'b/a/p': $EACCES
EOF
# On some systems, rm doesn't have enough information to
# say it's a directory.
-cat <<\EOF > exp2
-rm: cannot remove 'b/a/p': Permission denied
+cat <<EOF > exp2
+rm: cannot remove 'b/a/p': $EACCES
EOF
cmp out exp > /dev/null 2>&1 || {
diff --git a/tests/rm/rm2.sh b/tests/rm/rm2.sh
index e14b77609..ee4df1852 100755
--- a/tests/rm/rm2.sh
+++ b/tests/rm/rm2.sh
@@ -19,6 +19,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ rm
skip_if_root_
+getlimits_
mkdir -p a/0 || framework_failure_
mkdir -p a/1/2 b/3 || framework_failure_
@@ -30,14 +31,14 @@ chmod u-x a/1 b || framework_failure_
# in the same sort of diagnostic.
# Both of these should fail.
rm -rf a b > out 2>&1 && fail=1
-cat <<\EOF > exp
-rm: cannot remove 'a/1': Permission denied
-rm: cannot remove 'b': Permission denied
+cat <<EOF > exp
+rm: cannot remove 'a/1': $EACCES
+rm: cannot remove 'b': $EACCES
EOF
-cat <<\EOF > exp-solaris
-rm: cannot remove 'a/1/2': Permission denied
-rm: cannot remove 'b/3': Permission denied
+cat <<EOF > exp-solaris
+rm: cannot remove 'a/1/2': $EACCES
+rm: cannot remove 'b/3': $EACCES
EOF
cmp out exp > /dev/null 2>&1 \
diff --git a/tests/rm/unread2.sh b/tests/rm/unread2.sh
index 1e9e7f658..84b2fa9e3 100755
--- a/tests/rm/unread2.sh
+++ b/tests/rm/unread2.sh
@@ -19,6 +19,7 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ rm
skip_if_root_
+getlimits_
mkdir -p a/b || framework_failure_
chmod u-r a
@@ -26,8 +27,8 @@ chmod u-r a
# This should fail.
rm -rf a > out 2>&1 && fail=1
-cat <<\EOF > exp
-rm: cannot remove 'a': Permission denied
+cat <<EOF > exp
+rm: cannot remove 'a': $EACCES
EOF
compare exp out || fail=1
diff --git a/tests/rm/unreadable.pl b/tests/rm/unreadable.pl
index 1cba4c2c0..7c65d39e3 100755
--- a/tests/rm/unreadable.pl
+++ b/tests/rm/unreadable.pl
@@ -18,6 +18,8 @@
use strict;
+my $limits = getlimits ();
+
(my $program_name = $0) =~ s|.*/||;
# Turn off localization of executable's output.
@@ -38,7 +40,7 @@ my @Tests =
['unreadable-2', '-rf', $d,
{EXIT => $uid == 0 ? 0 : 1},
{ERR => $uid == 0 ? ''
- : "$prog: cannot remove '$d': Permission denied\n"},
+ : "$prog: cannot remove '$d': $limits->{EACCES}\n"},
{PRE => sub { (mkdir $d,0700 and mkdir "$d/x",0700 and chmod 0100,$d)
or die "$d: $!\n"}} ],
);
--
2.52.0