2 # Like fail-eperm, but the failure must be for a file encountered
3 # while trying to remove the containing directory with the sticky bit set.
5 if test "$VERBOSE" = yes; then
10 . $srcdir/../lang-default
11 PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
14 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
15 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
16 trap '(exit $?); exit $?' 1 2 13 15
19 mkdir -p $tmp || framework_failure=1
20 cd $tmp || framework_failure=1
22 # The containing directory must be owned by the user who eventually runs rm.
23 chown $NON_ROOT_USERNAME .
25 mkdir a || framework_failure=1
26 chmod 1777 a || framework_failure=1
27 touch a/b || framework_failure=1
29 if test $framework_failure = 1; then
30 echo "$0: failure in testing framework" 1>&2
36 # Try to ensure that $NON_ROOT_USERNAME can access
37 # the required version of rm.
38 rm_version=`setuidgid $NON_ROOT_USERNAME rm --version|sed -n '1s/.* //p'`
41 *) echo "$0: cannot access required version ($PACKAGE_VERSION) of rm" 1>&2
44 setuidgid $NON_ROOT_USERNAME rm -rf a 2> out-t && fail=1
46 # On some systems, we get `Not owner'. Convert it.
47 # On other systems (HPUX), we get `Permission denied'. Convert it, too.
48 onp='Operation not permitted'
49 sed "s/Not owner/$onp/;s/Permission denied/$onp/" out-t > out
52 rm: cannot remove `a/b': Operation not permitted
56 test $fail = 1 && diff out exp 2> /dev/null
58 (exit $fail); exit $fail