From 6c65ce4c643b038c61bd332aab5ea87a75117273 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Sat, 2 Jan 2016 18:38:37 +0000 Subject: 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 --- tests/install/create-leading.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/install') 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 -- cgit v1.2.3-70-g09d2