mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-04-26 11:30:39 +00:00
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
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -226,6 +226,7 @@ TESTSUITE_AT = \
|
||||
update.at\
|
||||
update01.at\
|
||||
update02.at\
|
||||
update03.at\
|
||||
volsize.at\
|
||||
volume.at\
|
||||
verbose.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])
|
||||
|
||||
51
tests/update03.at
Normal file
51
tests/update03.at
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user