mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-08-21 16:56:06 +00:00
Keep a detailed map of archive members stored in the record buffer.
A separate map (bufmap) provides information for creating multi-volume continuation headers. * src/buffer.c (bufmap): New struct. (bufmap_head, bufmap_tail, inhibit_map): New variables. (mv_begin_write): New function. (mv_begin): Rename to mv_begin_read. Rewrite using mv_begin_write. All callers changed. (mv_total_size): Remove. (bufmap_locate, bufmap_free, bufmap_reset): New functions. (_flush_write): Update bufmap. (close_archive): Free bufmap. (add_chunk_header): Take a bufmap argument. (gnu_add_multi_volume_header): Likewise. (add_multi_volume_header): Likewise. (_gnu_flush_write): Rewrite using bufmap. (real_s_name, real_s_totsize) (real_s_sizeleft) (save_name, save_totsize, save_sizeleft): Removed. All uses updated. (mv_size_left): Update bufmap_head. (mv_end): Rewrite. (multi_volume_sync): Remove. * src/common.h (mv_begin_write): New prototype. (mv_begin): Rename to mv_begin_read. * src/create.c: Use mv_begin_write instead of mv_begin. Remove calls to mv_size_left and mv_end. * src/sparse.c: Likewise. * tests/multiv07.at: Close stdin. * tests/spmvp00.at: Update AT_KEYWORDS. * tests/spmvp10.at: Likewise. * tests/multiv08.at: New testcase. * tests/Makefile.am, tests/testsuite.at: Add multiv08.at.
This commit is contained in:
@@ -110,6 +110,7 @@ TESTSUITE_AT = \
|
||||
multiv05.at\
|
||||
multiv06.at\
|
||||
multiv07.at\
|
||||
multiv08.at\
|
||||
old.at\
|
||||
options.at\
|
||||
options02.at\
|
||||
|
||||
@@ -31,6 +31,8 @@ AT_XFAIL_IF(test -f $[]XFAILFILE)
|
||||
AT_TARBALL_PREREQ([xsplit-1.tar],[0e008c84c517e48fbf23ca6a7033cde6])
|
||||
AT_TARBALL_PREREQ([xsplit-2.tar],[03150b9852d285458f43734e9e0b9a45])
|
||||
|
||||
exec <&-
|
||||
|
||||
cd $TEST_DATA_DIR
|
||||
tar -t -M -fxsplit-1.tar -fxsplit-2.tar
|
||||
],
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
# Test suite for GNU tar. -*- Autotest -*-
|
||||
# Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
||||
# This program 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, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program 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/>.
|
||||
|
||||
# Description: Tar 1.23 would in some cases silently fail to create
|
||||
# a continuation header in multivolume archives.
|
||||
#
|
||||
# In this testcase, the file `a' is 18.5 blocks long and the file `b'
|
||||
# is 19.5 blocks long.
|
||||
|
||||
AT_SETUP([multivolume header creation])
|
||||
AT_KEYWORDS([multivolume multiv multiv08])
|
||||
|
||||
AT_TAR_CHECK([
|
||||
genfile --length 9472 --file a
|
||||
genfile --length 9984 --file b
|
||||
decho Creating
|
||||
tar -c -M -L10 -f A.tar -f B.tar -f C.tar a b
|
||||
decho Testing
|
||||
tar -tMR -f A.tar -f B.tar -f C.tar
|
||||
],
|
||||
[0],
|
||||
[Creating
|
||||
Testing
|
||||
block 0: a
|
||||
block 21: b
|
||||
block 43: ** Block of NULs **
|
||||
],
|
||||
[Creating
|
||||
Testing
|
||||
],
|
||||
[],
|
||||
[],
|
||||
[gnu])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
# 02110-1301, USA.
|
||||
|
||||
AT_SETUP([sparse files in PAX MV archives, v.0.0])
|
||||
AT_KEYWORDS([sparse multiv sparsemvp sparsemvp00])
|
||||
AT_KEYWORDS([sparse multivolume multiv sparsemvp sparsemvp00])
|
||||
|
||||
TAR_MVP_TEST(0.0, [0 ABCDEFGHI 1M ABCDEFGHI], [0 ABCDEFGH 1M ABCDEFGHI])
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
# 02110-1301, USA.
|
||||
|
||||
AT_SETUP([sparse files in PAX MV archives, v.1.0])
|
||||
AT_KEYWORDS([sparse multiv sparsemvp sparsemvp10])
|
||||
AT_KEYWORDS([sparse multivolume multiv sparsemvp sparsemvp10])
|
||||
|
||||
TAR_MVP_TEST(1.0, [0 ABCDEFGH 1M ABCDEFGHI], [0 ABCDEFG 1M ABCDEFGHI])
|
||||
|
||||
|
||||
@@ -196,6 +196,7 @@ m4_include([multiv04.at])
|
||||
m4_include([multiv05.at])
|
||||
m4_include([multiv06.at])
|
||||
m4_include([multiv07.at])
|
||||
m4_include([multiv08.at])
|
||||
|
||||
m4_include([old.at])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user