| 1 |
# Process this file with autom4te to create testsuite. -*- Autotest -*- |
| 2 |
|
| 3 |
# Test suite for GNU tar. |
| 4 |
# Copyright 2004-2023 Free Software Foundation, Inc. |
| 5 |
|
| 6 |
# This file is part of GNU tar. |
| 7 |
|
| 8 |
# GNU tar is free software; you can redistribute it and/or modify |
| 9 |
# it under the terms of the GNU General Public License as published by |
| 10 |
# the Free Software Foundation; either version 3 of the License, or |
| 11 |
# (at your option) any later version. |
| 12 |
|
| 13 |
# GNU tar is distributed in the hope that it will be useful, |
| 14 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
# GNU General Public License for more details. |
| 17 |
|
| 18 |
# You should have received a copy of the GNU General Public License |
| 19 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
|
| 21 |
# Problem: GNU multivolume archives are not able to continue on members |
| 22 |
# with filenames longer than 100 characters. Versions of tar <= 1.14 |
| 23 |
# were not checking filename lengths and produced malformed multivolume |
| 24 |
# headers. |
| 25 |
# References: <[email protected]> |
| 26 |
# http://lists.gnu.org/archive/html/bug-tar/2004-08/msg00012.html |
| 27 |
# <[email protected]> |
| 28 |
# |
| 29 |
|
| 30 |
AT_SETUP([MV archive & long filenames]) |
| 31 |
AT_KEYWORDS([multivolume multiv multiv03]) |
| 32 |
|
| 33 |
AT_TAR_CHECK([ |
| 34 |
AFILE=`awk 'BEGIN { for (i = 0; i < 100; i++) printf "a"; exit; }'` |
| 35 |
BFILE=`awk 'BEGIN { for (i = 0; i < 101; i++) printf "b"; exit; }'` |
| 36 |
|
| 37 |
cat > ../experr <<EOF |
| 38 |
tar: $BFILE: file name too long to be stored in a GNU multivolume header, truncated |
| 39 |
tar: '$BFILE' is possibly continued on this volume: header contains truncated name |
| 40 |
EOF |
| 41 |
|
| 42 |
cat > ../expout <<EOF |
| 43 |
$AFILE |
| 44 |
separator-1 |
| 45 |
separator-2 |
| 46 |
EOF |
| 47 |
|
| 48 |
genfile --length 15360 --file $AFILE |
| 49 |
|
| 50 |
exec <&- |
| 51 |
|
| 52 |
tar -M -L 10 -c -f arch.1 -f arch.2 $AFILE || exit 1 |
| 53 |
tar -tM -f arch.1 -f arch.2 || exit 1 |
| 54 |
|
| 55 |
echo separator-1 |
| 56 |
|
| 57 |
genfile --length 15360 --file $BFILE |
| 58 |
tar -M -L 10 -c -f arch.1 -f arch.2 $BFILE || exit 1 |
| 59 |
|
| 60 |
echo separator-2 |
| 61 |
mv $BFILE bfile |
| 62 |
tar -M -x -f arch.1 -f arch.2 --warning=no-timestamp || exit 1 |
| 63 |
cmp $BFILE bfile |
| 64 |
], |
| 65 |
[0], |
| 66 |
[expout], |
| 67 |
[experr], |
| 68 |
[],[],[gnu, oldgnu]) |
| 69 |
|
| 70 |
AT_CLEANUP |