diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-09-26 13:17:26 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-09-26 13:53:50 +0300 |
commit | e1b7e40ff08c2493d2256f0ce6c682afc0c453f3 (patch) | |
tree | 818fc41315718b12781cd49ad730c003936e3a52 | |
parent | c2886473a803c8e4a60f673e12ebf5b7d2c5a38a (diff) | |
download | tar-e1b7e40ff08c2493d2256f0ce6c682afc0c453f3.tar.gz |
Fix interaction of -u with -C
* src/update.c (update_archive): Pass correct change_dir
value for addname
* tests/update03.at: New file.
* tests/Makefile.am: Add update03.at
* tests/testsuite.at: Include update03.at
-rw-r--r-- | src/update.c | 2 | ||||
-rw-r--r-- | tests/Makefile.am | 1 | ||||
-rw-r--r-- | tests/testsuite.at | 1 | ||||
-rw-r--r-- | tests/update03.at | 51 |
4 files changed, 54 insertions, 1 deletions
diff --git a/src/update.c b/src/update.c index ad7a6bf7..d54cbdbc 100644 --- a/src/update.c +++ b/src/update.c @@ -152,7 +152,7 @@ update_archive (void) for (p = dirp; *p; p += strlen (p) + 1) addname (namebuf_name (nbuf, p), - 0, false, NULL); + name->change_dir, false, NULL); namebuf_free (nbuf); free (dirp); diff --git a/tests/Makefile.am b/tests/Makefile.am index 3e638e37..53761809 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -226,6 +226,7 @@ TESTSUITE_AT = \ update.at\ update01.at\ update02.at\ + update03.at\ volsize.at\ volume.at\ verbose.at\ diff --git a/tests/testsuite.at b/tests/testsuite.at index 6fe5f89c..1f1897b2 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -396,6 +396,7 @@ AT_BANNER([Updates]) m4_include([update.at]) m4_include([update01.at]) m4_include([update02.at]) +m4_include([update03.at]) AT_BANNER([Verifying the archive]) m4_include([verify.at]) diff --git a/tests/update03.at b/tests/update03.at new file mode 100644 index 00000000..0a38e275 --- /dev/null +++ b/tests/update03.at @@ -0,0 +1,51 @@ +# Process this file with autom4te to create testsuite. -*- Autotest -*- +# Test suite for GNU tar. +# Copyright 2016 Free Software Foundation, Inc. +# +# This file is part of GNU tar. +# +# GNU tar is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# GNU tar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +AT_SETUP([update with chdir]) +AT_KEYWORDS([update update03 chdir]) + +# Tar <=1.29 failed to chdir when -u was used with -C +# Reported by: Ivan Kalvachev <ikalvachev@gmail.com> +# References: <CABA=pqfSq-4PJYp7W2ezGOz+fR2uh74AyA7kOeXJBzg2o-oQBA@mail.gmail.com>, +# http://lists.gnu.org/archive/html/bug-tar/2016-08/msg00003.html +AT_TAR_CHECK([ +mkdir dir1 +mkdir dir2 +mkdir dir1/subdir1 dir2/subdir2 +genfile --file dir1/subdir1/a +genfile --file dir2/subdir2/a +echo Create +tar -vcf arc.tar -C dir1 subdir1 -C ../dir2 subdir2 +genfile --file dir1/subdir1/b +genfile --file dir2/subdir2/c +echo Update +tar -vuf arc.tar -C dir1 subdir1 -C ../dir2 subdir2 +], +[0], +[Create +subdir1/ +subdir1/a +subdir2/ +subdir2/a +Update +subdir1/b +subdir2/c +]) + +AT_CLEANUP
\ No newline at end of file |