| 1 |
# Process this file with autom4te to create testsuite. -*- Autotest -*- |
| 2 |
# Test suite for GNU tar. |
| 3 |
# Copyright 2015-2023 Free Software Foundation, Inc. |
| 4 |
# |
| 5 |
# GNU tar is free software; you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation; either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# GNU tar is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
# Description: When creating multivolume archives, the bufmap code in |
| 19 |
# buffer.c implicitly assumed that the members are stored in the archive |
| 20 |
# in a contiguous fashion, ignoring the member (and eventual extended) headers |
| 21 |
# between them. This worked until the member header happened to be at |
| 22 |
# the very beginning of the volume, in which case its length was included in |
| 23 |
# the calculation of the stored size and size left to store. Due to this, |
| 24 |
# the GNUFileParts extended header contained invalid GNU.volume.offset value, |
| 25 |
# and the resulting archive failed to extract properly. The bug affected |
| 26 |
# versions of tar up to 1.29.90 (commit da8d0659a6). |
| 27 |
# |
| 28 |
# This test case also checks that GNUFileParts headers are not displayed in |
| 29 |
# verbose mode. |
| 30 |
# |
| 31 |
# Reported by: <[email protected]> |
| 32 |
# References: |
| 33 |
# <CAE7Kiz_0oMqGdzkoh0FbOd=hUoPhtHHYhjZveM_4hEku081QFQ@mail.gmail.com>, |
| 34 |
# http://lists.gnu.org/archive/html/bug-tar/2017-05/msg00007.html |
| 35 |
# |
| 36 |
|
| 37 |
AT_SETUP([file start at the beginning of a posix volume]) |
| 38 |
AT_KEYWORDS([multivolume multiv multiv10]) |
| 39 |
|
| 40 |
AT_TAR_CHECK([ |
| 41 |
set -e |
| 42 |
genfile --length=15360 --file data1 |
| 43 |
genfile --length=15360 --file data2 |
| 44 |
tar -v -c -L 10 -M -f 1.tar -f 2.tar -f 3.tar -f 4.tar -f 5.tar data1 data2 |
| 45 |
tar -M -t -f 1.tar -f 2.tar -f 3.tar -f 4.tar -f 5.tar |
| 46 |
mkdir out |
| 47 |
tar -C out -M -x -f 1.tar -f 2.tar -f 3.tar -f 4.tar -f 5.tar |
| 48 |
cmp data1 out/data1 |
| 49 |
cmp data2 out/data2 |
| 50 |
], |
| 51 |
[0], |
| 52 |
[data1 |
| 53 |
data2 |
| 54 |
data1 |
| 55 |
data2 |
| 56 |
], |
| 57 |
[],[],[],[posix]) |
| 58 |
|
| 59 |
AT_CLEANUP |