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
39 # With 4.0.37 and earlier (back to when?), this would fail
40 # with the failed assertion from dirname.c.
41 cp -R --parents foo
/ bar || fail
=1
43 # Exercise the make_path and re_protect code in cp.c.
44 # FIXME: compare verbose output with expected output.
45 cp --verbose -a --parents a
/b
/c d
> /dev
/null
2>&1 || fail
=1
46 test -d d
/a
/b
/c || fail
=1
48 # With 6.7 and earlier, cp --parents f/g d would mistakenly create a
49 # directory d/f, even though f is a regular file.
50 cp --parents f
/g d
2>/dev
/null
&& fail
=1
53 # Check that re_protect works.
55 cp -a --parents d
/a
/b
/c e || fail
=1
56 cp -a --parents sym
/b
/c g || fail
=1
57 p
=`ls -ld e/d|cut -b-10`; case $p in drwxr-xr-x
);; *) fail
=1;; esac
58 p
=`ls -ld e/d/a|cut -b-10`; case $p in drwx-w--w-
);; *) fail
=1;; esac
59 p
=`ls -ld g/sym|cut -b-10`; case $p in drwx-w--w-
);; *) fail
=1;; esac
60 p
=`ls -ld e/d/a/b/c|cut -b-10`; case $p in drwxr-xr-x
);; *) fail
=1;; esac
61 p
=`ls -ld g/sym/b/c|cut -b-10`; case $p in drwxr-xr-x
);; *) fail
=1;; esac