| 1 |
# Process this file with autom4te to create testsuite. -*- Autotest -*- |
| 2 |
# Test suite for GNU tar. |
| 3 |
# Copyright 2009-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 |
AT_SETUP([incremental restores with -C]) |
| 19 |
AT_KEYWORDS([incremental extract incr07 chdir]) |
| 20 |
|
| 21 |
# Tar 1.26 had problems extracting from incremental restores when given |
| 22 |
# the -C option. The code in incremen.c:try_purge_directory and |
| 23 |
# misc.c:remove_any_file was using savedir(), which ignored eventual changes |
| 24 |
# in the current working directory and caused the malfunctioning. |
| 25 |
# |
| 26 |
# The problem was reported by Piotr Rotter on 2013-03-22. |
| 27 |
# |
| 28 |
# This testcase is based on scripts provided by Piotr Rotter and Nathan |
| 29 |
# Stratton Treadway. |
| 30 |
# |
| 31 |
# References: <[email protected]>, |
| 32 |
# http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00036.html, |
| 33 |
# <[email protected]>, |
| 34 |
# http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00042.html, |
| 35 |
# <[email protected]>, |
| 36 |
# http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00043.html, |
| 37 |
# <[email protected]>, |
| 38 |
# http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00044.html |
| 39 |
|
| 40 |
AT_TAR_CHECK([ |
| 41 |
AT_CHECK_TIMESTAMP |
| 42 |
mkdir dirA |
| 43 |
echo 'a' > dirA/a |
| 44 |
echo 'a' > dirA/b |
| 45 |
|
| 46 |
decho C0 |
| 47 |
tar -g test.snar -vcf test.0.tar dirA |
| 48 |
|
| 49 |
echo 'a' > dirA/c |
| 50 |
decho C1 |
| 51 |
tar -g test.snar -vcf test.1.tar dirA |
| 52 |
|
| 53 |
rm -f dirA/a |
| 54 |
decho C2 |
| 55 |
tar -g test.snar -vcf test.2.tar dirA |
| 56 |
|
| 57 |
mkdir ext |
| 58 |
rm -rf dirA |
| 59 |
|
| 60 |
decho E0 |
| 61 |
tar -g test.snar -vxf test.0.tar -C ext/ |
| 62 |
decho E1 |
| 63 |
tar -g test.snar -vxf test.1.tar -C ext/ |
| 64 |
|
| 65 |
decho E2 |
| 66 |
tar -g test.snar -vxf test.2.tar -C ext/ |
| 67 |
|
| 68 |
mkdir ext/dirA/dirB |
| 69 |
touch ext/dirA/dirB/file |
| 70 |
|
| 71 |
decho E3 |
| 72 |
tar -g test.snar -vxf test.2.tar -C ext/ |
| 73 |
|
| 74 |
echo FIN |
| 75 |
test -d dirA && echo >&2 "toplevel dirA exists" |
| 76 |
exit 0 |
| 77 |
], |
| 78 |
[0], |
| 79 |
[C0 |
| 80 |
dirA/ |
| 81 |
dirA/a |
| 82 |
dirA/b |
| 83 |
C1 |
| 84 |
dirA/ |
| 85 |
dirA/c |
| 86 |
C2 |
| 87 |
dirA/ |
| 88 |
E0 |
| 89 |
dirA/ |
| 90 |
dirA/a |
| 91 |
dirA/b |
| 92 |
E1 |
| 93 |
dirA/ |
| 94 |
dirA/c |
| 95 |
E2 |
| 96 |
dirA/ |
| 97 |
tar: Deleting 'dirA/a' |
| 98 |
E3 |
| 99 |
dirA/ |
| 100 |
tar: Deleting 'dirA/dirB' |
| 101 |
FIN |
| 102 |
], |
| 103 |
[C0 |
| 104 |
tar: dirA: Directory is new |
| 105 |
C1 |
| 106 |
C2 |
| 107 |
E0 |
| 108 |
E1 |
| 109 |
E2 |
| 110 |
E3 |
| 111 |
],[],[],[gnu, oldgnu, posix]) |
| 112 |
|
| 113 |
AT_CLEANUP |