* 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.
require_membership_in_two_groups_
skip_if_root_
require_local_dir_
+getlimits_
set _ $groups; shift
g1=$1
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
. "${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_
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
. "${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_
# /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
. "${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_
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
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ nohup
-
+getlimits_
nohup sh -c 'echo stdout; echo stderr 1>&2' 2>err || fail=1
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
. "${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"
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
. "${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
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ rm
skip_if_root_
+getlimits_
ok=0
mkdir d &&
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
. "${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_
# 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 || {
. "${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_
# 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 \
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ rm
skip_if_root_
+getlimits_
mkdir -p a/b || framework_failure_
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
use strict;
+my $limits = getlimits ();
+
(my $program_name = $0) =~ s|.*/||;
# Turn off localization of executable's output.
['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"}} ],
);