diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2007-02-03 18:12:11 +0100 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2007-02-03 18:12:11 +0100 |
commit | 1c73876f5f7973ca41caaf0ce326254b1081713a (patch) | |
tree | 168710b53277fa888fc53d184d00bb088338192a /tests | |
parent | 251f774621735e208e3800022ad4acd0b785784e (diff) | |
download | coreutils-1c73876f5f7973ca41caaf0ce326254b1081713a.tar.xz |
* NEWS: Document fix for cp --parents.
* src/cp.c (make_dir_parents_private): Report the error sooner with
"cp --parents DIR/FILE DEST" when DIR is a non-directory, thus not
creating the directory, DEST/DIR.
* tests/cp/cp-parents: Test for the non-race-condition bug fixed
by the above change.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/cp/cp-parents | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/cp/cp-parents b/tests/cp/cp-parents index 373e60776..6c123d225 100755 --- a/tests/cp/cp-parents +++ b/tests/cp/cp-parents @@ -2,7 +2,8 @@ # cp -R --parents dir-specified-with-trailing-slash/ other-dir # would get a failed assertion. -# Copyright (C) 2000, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2000, 2002, 2004, 2005, 2006, 2007 Free Software +# Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -48,6 +49,7 @@ cd $tmp || framework_failure=1 mkdir foo bar || framework_failure=1 mkdir -p a/b/c d e || framework_failure=1 +touch f || framework_failure=1 if test $framework_failure = 1; then echo 'failure in testing framework' @@ -65,6 +67,11 @@ cp -R --parents foo/ bar || fail=1 cp --verbose -a --parents a/b/c d > /dev/null 2>&1 || fail=1 test -d d/a/b/c || fail=1 +# With 6.7 and earlier, cp --parents f/g d would mistakenly create a +# directory d/f, even though f is a regular file. +cp --parents f/g d 2>/dev/null && fail=1 +test -d d/f && fail=1 + # Check that re_protect works. chmod go=w d/a cp -a --parents d/a/b/c e || fail=1 |