Fix listing of volume labels (in particular in PAX archives).
* src/buffer.c (match_volume_label): Call set_volume_label. (check_label_pattern): Get label string as argument. (match_volume_label): Handle volume labels stored in global PAX headers. * src/common.c (print_header,read_header): Change signature. (read_header_primitive): Remove prototype. * src/list.c (recent_global_header): New static. (list_archive): Always print volume labels. (read_header_primitive): Remove. (read_header): Change the signature (all callers updated) Save the recent global header. (volume_label_printed): New static. (simple_print_header): New function (ex-print_header). (print_header): Change the signature (all callers updated). For POSIX formats, print first volume header (if set). * src/xheader.c (xheader_write_global): Write the data accumulated in xhdr->stk even if keyword_global_override_list is empty. (xheader_read): On unexpected EOF, report error instead of coredumping. (XHDR_PROTECTED, XHDR_GLOBAL): New defines. (struct xhdr_tab): Remove `protected' with `flags'. All uses updated. (decg): If XHDR_GLOBAL bit is set, call the keyword's decode method instead of adding it to `kwl'. * src/compare.c: Update calls to read_header. * src/create.c: Likewise. * src/delete.c: Likewise. * src/update.c: Likewise. * src/extract.c: Likewise. (extract_volhdr): Do not print "Reading <label>" statement, because it is inconsistent: it is not printed if the volume begins with a member continued from the previous volume. * tests/label01.at: New testcase. * tests/label02.at: New testcase. * tests/Makefile.am, tests/testsuite.at: Add new testcases.
This commit is contained in:
@@ -87,6 +87,8 @@ TESTSUITE_AT = \
|
||||
incr06.at\
|
||||
indexfile.at\
|
||||
ignfail.at\
|
||||
label01.at\
|
||||
label02.at\
|
||||
link01.at\
|
||||
link02.at\
|
||||
link03.at\
|
||||
|
||||
35
tests/label01.at
Normal file
35
tests/label01.at
Normal file
@@ -0,0 +1,35 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# 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/>.
|
||||
|
||||
AT_SETUP([single-volume label])
|
||||
AT_KEYWORDS([label label01])
|
||||
|
||||
AT_TAR_CHECK([
|
||||
genfile --file foo
|
||||
genfile --file bar
|
||||
tar -cf archive --label=Test foo bar
|
||||
tar tf archive
|
||||
],
|
||||
[0],
|
||||
[Test
|
||||
foo
|
||||
bar
|
||||
],
|
||||
[],[],[],[gnu,oldgnu,posix])
|
||||
|
||||
AT_CLEANUP
|
||||
38
tests/label02.at
Normal file
38
tests/label02.at
Normal file
@@ -0,0 +1,38 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# 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/>.
|
||||
|
||||
AT_SETUP([multi-volume label])
|
||||
AT_KEYWORDS([label label02 multi-label multivolume multiv])
|
||||
|
||||
AT_TAR_CHECK([
|
||||
exec <&-
|
||||
genfile --length 0 --file foo
|
||||
genfile --length 12288 --file bar
|
||||
genfile --length 12288 --file baz
|
||||
tar --label=Test -cM -L10 -f 1.tar -f 2.tar -f 3.tar -f 4.tar foo bar baz
|
||||
tar -Mt -f 1.tar -f 2.tar -f 3.tar -f 4.tar
|
||||
],
|
||||
[0],
|
||||
[Test Volume 1
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
],
|
||||
[],[],[],[gnu,oldgnu,posix])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -146,6 +146,9 @@ m4_include([extrac06.at])
|
||||
m4_include([extrac07.at])
|
||||
m4_include([extrac08.at])
|
||||
|
||||
m4_include([label01.at])
|
||||
m4_include([label02.at])
|
||||
|
||||
m4_include([backup01.at])
|
||||
|
||||
m4_include([gzip.at])
|
||||
|
||||
Reference in New Issue
Block a user