]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Use $srcdir/../priv-check, create a temporary
authorJim Meyering <jim@meyering.net>
Fri, 18 Jul 2003 09:12:23 +0000 (09:12 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 18 Jul 2003 09:12:23 +0000 (09:12 +0000)
directory, and remove Perl-coded `you may not run as root' test.

tests/rm/fail-eperm

index 2e4d64cb3e5c195fb412a8114884593a618b27c5..6e6feb6417f5b3746c293519a4cfd5658ec64ec0 100755 (executable)
@@ -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.