2 # Copyright (C) 2011 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # "make uninstall" complains and errors out on failures.
19 # FIXME: this test only deal with DATA primary; maybe we need sister
20 # tests for other primaries too? E.g., SCRIPTS, PROGRAMS, LISP, PYTHON,
29 chmod a-w d || skip
"cannot make directories unwritable"
31 # On Solaris 10, if `/bin/rm' is run with the `-f' option, it doesn't
32 # print any error message when failing to remove a file (due to e.g.,
33 # "Permission denied"). Yikes. We'll cater to this incompatibility
34 # by relaxing a test below if a faulty `rm' is detected.
35 st
=0; rm -f d
/f
2>stderr || st
=$?
37 test $st -gt 0 || skip_
"can delete files from unwritable directories"
38 if grep 'rm:' stderr
; then
39 rm_f_is_silent_on_error
=no
41 rm_f_is_silent_on_error
=yes
44 cat >> configure.
in << 'END'
48 cat > Makefile.am
<< 'END'
49 data_DATA
= foobar.txt
60 .
/configure
--prefix="`pwd`/$inst"
62 mkdir
$inst $inst/share
63 : > $inst/share
/foobar.txt
66 $MAKE uninstall
>output
2>&1 && { cat output
; Exit
1; }
68 if test $rm_f_is_silent_on_error = yes; then
69 : "rm -f" is silent on errors
, skip the grepping of
make output
71 grep "rm: .*foobar\.txt" output
74 chmod a-rwx
$inst/share
75 (cd $inst/share
) && skip_
"cannot make directories fully unreadable"
77 $MAKE uninstall
>output
2>&1 && { cat output
; Exit
1; }
80 # Some shells, like Solaris 10 /bin/sh and /bin/ksh, do not report
81 # the name of the `cd' builtin upon a chdir error:
83 # $ /bin/sh -c 'cd /none'
84 # /bin/sh: /none: does not exist
86 # In addition, some shells, like Solaris 10 /usr/xpg4/bin/sh, also print
87 # a line number in the error message *if the command contains newlines*:
89 # $ /usr/xpg4/bin/sh -c 'cd unreadable'
90 # /usr/xpg4/bin/sh: unreadable: permission denied
91 # $ /usr/xpg4/bin/sh -c '\
94 # /usr/xpg4/bin/sh[3]: unreadable: permission denied
96 $EGREP "(cd|sh)(\[[0-9]*[0-9]\])?: .*$inst/share" output