From: Sergey Poznyakoff Date: Mon, 26 Sep 2016 10:17:26 +0000 (+0300) Subject: Fix interaction of -u with -C X-Git-Tag: release_1_30~38 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e1b7e40ff08c2493d2256f0ce6c682afc0c453f3;p=thirdparty%2Ftar.git 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 --- 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 . + +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 +# References: , +# 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