2 # cp -R --parents dir-specified-with-trailing-slash/ other-dir
3 # would get a failed assertion.
5 # Copyright (C) 2000, 2002, 2004-2009 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 working_umask_or_skip_
29 # Run the setgid check from the just-created directory.
32 mkdir foo bar || framework_failure
33 mkdir -p a/b/c d e g || framework_failure
34 ln -s d/a sym || framework_failure
35 touch f || framework_failure
38 # With 4.0.37 and earlier (back to when?), this would fail
39 # with the failed assertion from dirname.c.
40 cp -R --parents foo/ bar || fail=1
42 # Exercise the make_path and re_protect code in cp.c.
43 # FIXME: compare verbose output with expected output.
44 cp --verbose -a --parents a/b/c d > /dev/null 2>&1 || fail=1
45 test -d d/a/b/c || fail=1
47 # With 6.7 and earlier, cp --parents f/g d would mistakenly create a
48 # directory d/f, even though f is a regular file.
49 cp --parents f/g d 2>/dev/null && fail=1
52 # Check that re_protect works.
54 cp -a --parents d/a/b/c e || fail=1
55 cp -a --parents sym/b/c g || fail=1
56 p=`ls -ld e/d|cut -b-10`; case $p in drwxr-xr-x);; *) fail=1;; esac
57 p=`ls -ld e/d/a|cut -b-10`; case $p in drwx-w--w-);; *) fail=1;; esac
58 p=`ls -ld g/sym|cut -b-10`; case $p in drwx-w--w-);; *) fail=1;; esac
59 p=`ls -ld e/d/a/b/c|cut -b-10`; case $p in drwxr-xr-x);; *) fail=1;; esac
60 p=`ls -ld g/sym/b/c|cut -b-10`; case $p in drwxr-xr-x);; *) fail=1;; esac