3 # Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006 Free Software
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 if test "$VERBOSE" = yes; then
26 . $srcdir/../lang-default
27 PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
30 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
31 trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
32 trap '(exit $?); exit' 1 2 13 15
35 mkdir -p $tmp || framework_failure=1
36 cd $tmp || framework_failure=1
38 mkdir D D/D || framework_failure=1
39 touch D/a || framework_failure=1
40 chmod 0 D/a || framework_failure=1
41 chmod u=rx,go=,-st D || framework_failure=1
43 if test $framework_failure = 1; then
44 echo 'failure in testing framework'
50 # This is expected to exit non-zero, because it can't read D/a.
51 cp -pR D DD > /dev/null 2>&1 && fail=1
53 # Permissions on DD must be `dr-x------'
57 test "$1" = dr-x------ || fail=1
63 cp: accessing `symlink': Permission denied
66 cp F symlink 2> out && fail=1
67 # HPUX appears to fail with EACCES rather than EPERM.
68 # Transform their diagnostic
69 # ...: The file access permissions do not allow the specified action.
70 # to the expected one:
71 sed 's/: The file access permissions.*/: Permission denied/'<out>o1;mv o1 out
72 cmp out exp || { (diff -c out exp) 2> /dev/null; fail=1; }
74 cp --target-directory=symlink F 2> out && fail=1
75 sed 's/: The file access permissions.*/: Permission denied/'<out>o1;mv o1 out
76 cmp out exp || { (diff -c out exp) 2> /dev/null; fail=1; }
80 (exit $fail); exit $fail