2 # cp -R --parents dir-specified-with-trailing-slash/ other-dir
3 # would get a failed assertion.
5 # Copyright (C) 2000, 2002, 2004, 2005 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 2 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, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 if test "$VERBOSE" = yes; then
30 t0=`echo "$0"|sed 's,.*/,,'`.tmp;tmp=$t0/$$
31 trap 'status=$?; cd $pwd; exec 1>&2; rm -rf $t0 && exit $status' 0
32 trap '(exit $?); exit' 1 2 13 15
36 # Record absolute path of srcdir and cd back to current dir.
37 cd $srcdir || framework_failure=1
39 cd $pwd || framework_failure=1
41 . $srcdir/../envvar-check
42 . $srcdir/../umask-check
44 mkdir -p $tmp || framework_failure=1
45 cd $tmp || framework_failure=1
47 . $abs_srcdir/../setgid-check
49 mkdir foo bar || framework_failure=1
50 mkdir -p a/b/c d e || framework_failure=1
52 if test $framework_failure = 1; then
53 echo 'failure in testing framework'
59 # With 4.0.37 and earlier (back to when?), this would fail
60 # with the failed assertion from dirname.c.
61 cp -R --parents foo/ bar || fail=1
63 # Exercise the make_path and re_protect code in cp.c.
64 # FIXME: compare verbose output with expected output.
65 cp --verbose -a --parents a/b/c d > /dev/null 2>&1 || fail=1
66 test -d d/a/b/c || fail=1
68 # Check that re_protect works.
70 cp -a --parents d/a/b/c e || fail=1
71 p=`ls -ld e/d|sed 's/ .*//'`; case $p in drwxr-xr-x);; *) fail=1;; esac
72 p=`ls -ld e/d/a|sed 's/ .*//'`; case $p in drwx-w--w-);; *) fail=1;; esac
73 p=`ls -ld e/d/a/b/c|sed 's/ .*//'`; case $p in drwxr-xr-x);; *) fail=1;; esac
75 (exit $fail); exit $fail