summaryrefslogtreecommitdiff
path: root/tests/install
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2016-01-02 18:38:37 +0000
committerPádraig Brady <P@draigBrady.com>2016-01-03 12:58:39 +0000
commit6c65ce4c643b038c61bd332aab5ea87a75117273 (patch)
tree76190ad69cfe2f11a9c8b8c5e6a4ac2347887467 /tests/install
parent50a950ba69c2ba8f2300c9e77f67978979537ad5 (diff)
downloadcoreutils-6c65ce4c643b038c61bd332aab5ea87a75117273.tar.xz
install: fix relative copies to absolute directory with -D
* src/install.c (mkancesdirs_safe_wd): Unconditionally restore the current working directory when possibly called multiple times (from install_file_in_dir()). * tests/install/create-leading.sh: Add a test case. * NEWS: Mention the fix. Fixes http://bugs.gnu.org/21497
Diffstat (limited to 'tests/install')
-rwxr-xr-xtests/install/create-leading.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/install/create-leading.sh b/tests/install/create-leading.sh
index 8971d5fde..62f74f53f 100755
--- a/tests/install/create-leading.sh
+++ b/tests/install/create-leading.sh
@@ -24,7 +24,7 @@ print_ver_ ginstall
file=file
-echo foo > $file
+echo foo > $file || framework_failure_
# Before 4.0q, this would mistakenly create $file, not 'dest'
# in no-dir1/no-dir2/.
@@ -32,4 +32,11 @@ ginstall -D $file no-dir1/no-dir2/dest || fail=1
test -d no-dir1/no-dir2 || fail=1
test -r no-dir1/no-dir2/dest || fail=1
+# Between 6.1 and 8.24, this would not copy $file
+# due to incorrectly modified working directory
+mkdir dir1 || framework_failure_
+touch dir1/file1 || framework_failure_
+ginstall -D $PWD/dir1/file1 $file -t $PWD/no-dir2/ || fail=1
+test -r no-dir2/$file && test -r no-dir2/file1 || fail=1
+
Exit $fail