2 # Copyright (C) 2011-2012 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,
27 chmod a-w d || skip "cannot make directories unwritable"
29 # On Solaris 10, if '/bin/rm' is run with the '-f' option, it doesn't
30 # print any error message when failing to remove a file (due to e.g.,
31 # "Permission denied"). Yikes. We'll cater to this incompatibility
32 # by relaxing a test below if a faulty 'rm' is detected.
33 st=0; rm -f d/f 2>stderr || st=$?
35 test $st -gt 0 || skip_ "can delete files from unwritable directories"
36 if grep 'rm:' stderr; then
37 rm_f_is_silent_on_error=no
39 rm_f_is_silent_on_error=yes
42 cat >> configure.ac << 'END'
46 cat > Makefile.am << 'END'
47 data_DATA = foobar.txt
56 # Make it harder to experience false postives when grepping error messages.
59 ./configure --prefix="$(pwd)/$inst"
61 mkdir $inst $inst/share
62 : > $inst/share/foobar.txt
65 $MAKE uninstall >output 2>&1 && { cat output; exit 1; }
67 if test $rm_f_is_silent_on_error = yes; then
68 : "rm -f" is silent on errors, skip the grepping of make output
70 grep "rm: .*foobar\.txt" output
73 chmod a-rwx $inst/share
74 (cd $inst/share) && skip_ "cannot make directories fully unreadable"
76 $MAKE uninstall >output 2>&1 && { cat output; exit 1; }
79 # Some shells, like Solaris 10 /bin/sh and /bin/ksh, do not report
80 # the name of the 'cd' builtin upon a chdir error:
82 # $ /bin/sh -c 'cd /none'
83 # /bin/sh: /none: does not exist
85 # In addition, some shells, like Solaris 10 /usr/xpg4/bin/sh, also print
86 # a line number in the error message *if the command contains newlines*:
88 # $ /usr/xpg4/bin/sh -c 'cd unreadable'
89 # /usr/xpg4/bin/sh: unreadable: permission denied
90 # $ /usr/xpg4/bin/sh -c '\
93 # /usr/xpg4/bin/sh[3]: unreadable: permission denied
95 $EGREP "(cd|sh)(\[[0-9]*[0-9]\])?: .*$inst/share" output