| 1 |
# Process this file with autom4te to create testsuite. -*- Autotest -*- |
| 2 |
# |
| 3 |
# Test suite for GNU tar. |
| 4 |
# Copyright 2010-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 |
# Tar up to 1.26 was unable to cope with directories that had once |
| 22 |
# been part of the dumped system and became separate mount points |
| 23 |
# afterwards. The bug has been reported by Nathan Stratton Treadway, |
| 24 |
# who also proposed a fix and a testcase, on which the present one is |
| 25 |
# built. |
| 26 |
# Reported-by: Nathan Stratton Treadway <[email protected]> |
| 27 |
# Last-Affected-Version: 1.26 |
| 28 |
# References: <[email protected]> |
| 29 |
# http://lists.gnu.org/archive/html/bug-tar/2012-05/msg00022.html |
| 30 |
|
| 31 |
# This testcase is Linux-specific and requires root privileges. |
| 32 |
|
| 33 |
AT_SETUP([--listed-incremental and remounted directories]) |
| 34 |
AT_KEYWORDS([listed incremental listed05 chdir]) |
| 35 |
|
| 36 |
AT_TAR_CHECK([ |
| 37 |
AT_CHECK_TIMESTAMP |
| 38 |
AT_PRIVILEGED_PREREQ |
| 39 |
options="-C tartest --create --one-file-system --verbose" |
| 40 |
rm -rf archive-[01].snar archive-[01].tar tartest subdir |
| 41 |
|
| 42 |
# Create initial structure |
| 43 |
mkdir tartest |
| 44 |
echo "hi" > tartest/top-level-file |
| 45 |
mkdir tartest/subdir |
| 46 |
echo "hi" > tartest/subdir/subdir-file |
| 47 |
|
| 48 |
echo "# Level 0" |
| 49 |
tar $options --file archive-0.tar --listed-incremental=archive-0.snar . |
| 50 |
|
| 51 |
echo "# Remount" |
| 52 |
mv tartest/subdir . |
| 53 |
mkdir tartest/subdir |
| 54 |
mount -t ramfs none tartest/subdir || AT_SKIP_TEST |
| 55 |
tar -C subdir -c -f - . | tar -C tartest/subdir -x -f - |
| 56 |
|
| 57 |
echo "# Level 1" |
| 58 |
cp archive-0.snar archive-1.snar |
| 59 |
tar $options --file archive-1.tar --listed-incremental=archive-1.snar . |
| 60 |
|
| 61 |
umount tartest/subdir |
| 62 |
], |
| 63 |
[0], |
| 64 |
[# Level 0 |
| 65 |
./ |
| 66 |
./subdir/ |
| 67 |
./top-level-file |
| 68 |
./subdir/subdir-file |
| 69 |
# Remount |
| 70 |
# Level 1 |
| 71 |
./ |
| 72 |
./subdir/ |
| 73 |
], |
| 74 |
[tar: .: Directory is new |
| 75 |
tar: ./subdir: Directory is new |
| 76 |
tar: ./subdir: directory is on a different filesystem; not dumped |
| 77 |
],[],[],[gnu]) |
| 78 |
|
| 79 |
AT_CLEANUP |