diff options
Diffstat (limited to 'tests/rm')
-rwxr-xr-x | tests/rm/fail-eperm | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/rm/fail-eperm b/tests/rm/fail-eperm index 2e4d64cb3..6e6feb641 100755 --- a/tests/rm/fail-eperm +++ b/tests/rm/fail-eperm @@ -3,6 +3,27 @@ # Ensure that rm gives the expected diagnostic when failing to remove a file # owned by some other user in a directory with the sticky bit set. +if test "$VERBOSE" = yes; then + set -x + rm --version +fi + +PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check + +pwd=`pwd` +t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$ +trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0 +trap '(exit $?); exit $?' 1 2 13 15 + +framework_failure=0 +mkdir -p $tmp || framework_failure=1 +cd $tmp || framework_failure=1 + +if test $framework_failure = 1; then + echo "$0: failure in testing framework" 1>&2 + (exit 1); exit 1 +fi + : ${PERL=perl} : ${srcdir=.} @@ -28,13 +49,6 @@ $verbose # Ensure that the diagnostics are in English. $ENV{LC_ALL} = 'C'; -# Ensure that the effective UID is not 0. -if ($> == 0) - { - warn "$ME: you may not run this test as root; skipping it.\n"; - exit 77; - } - my @dir_list = qw(/tmp /var/tmp /usr/tmp); # Find a directory with the sticky bit set. |