2 # Ensure that rm works even when run from a directory
3 # for which the user has no access at all.
5 # Copyright (C) 2004, 2006-2008 Free Software Foundation, Inc.
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 if test "$VERBOSE" = yes; then
27 # Skip this test if your system has neither the openat-style functions
28 # nor /proc/self/fd support with which to emulate them.
30 grep '^#define HAVE_OPENAT' $CONFIG_HEADER > /dev
/null
&& skip
=no
31 test -d /proc
/self
/fd
&& skip
=no
32 if test $skip = yes; then
33 skip_test_
'this system lacks openat support'
39 mkdir abs1 abs2 no-access || framework_failure
44 (cd no-access
; chmod 0 .
&& rm -r "$p/abs1" rel
"$p/abs2") 2> out
&& fail
=1
45 test -d "$p/abs1" && fail
=1
46 test -d "$p/abs2" && fail
=1
48 cat <<\EOF
> exp || fail
=1
49 rm: cannot remove
`rel': Permission denied
52 # AIX 4.3.3 fails with a different diagnostic.
53 # Transform their diagnostic
54 # ...: The file access permissions do not allow the specified action.
55 # to the expected one:
56 sed 's/: The file access permissions.*/: Permission denied/'<out>o1;mv o1 out
58 compare out exp || fail=1