* 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.
# {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'.
. "${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"
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
. "${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 .
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
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ touch
+getlimits_
if env -- test -w /; then
skip_ you have write access to /.
# 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