summaryrefslogtreecommitdiff
path: root/tests/incr07.at
blob: ccef7f45e49d67151584fb66256c6351aed6a7e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright 2009-2022 Free Software Foundation, Inc.
#
# GNU tar 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 of the License, or
# (at your option) any later version.
#
# GNU tar 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([incremental restores with -C])
AT_KEYWORDS([incremental extract incr07 chdir])

# Tar 1.26 had problems extracting from incremental restores when given
# the -C option.  The code in incremen.c:try_purge_directory and
# misc.c:remove_any_file was using savedir(), which ignored eventual changes
# in the current working directory and caused the malfunctioning.
#
# The problem was reported by Piotr Rotter on 2013-03-22.
#
# This testcase is based on scripts provided by Piotr Rotter and Nathan
# Stratton Treadway.
#
# References: <514C8F56.90900@active24.pl>,
#             http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00036.html, 
#             <20130326181922.GZ3732@shire.ontko.com>,
#             http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00042.html,
#             <20130327051828.GA3732@shire.ontko.com>,
#             http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00043.html,
#             <20130327054957.GB3732@shire.ontko.com>,
#             http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00044.html

AT_TAR_CHECK([
AT_CHECK_TIMESTAMP
mkdir dirA
echo 'a' > dirA/a
echo 'a' > dirA/b

decho C0
tar -g test.snar -vcf test.0.tar dirA

echo 'a' > dirA/c
decho C1
tar -g test.snar -vcf test.1.tar dirA

rm -f dirA/a
decho C2
tar -g test.snar -vcf test.2.tar dirA

mkdir ext
rm -rf dirA

decho E0
tar -g test.snar -vxf test.0.tar -C ext/
decho E1
tar -g test.snar -vxf test.1.tar -C ext/

decho E2
tar -g test.snar -vxf test.2.tar -C ext/

mkdir ext/dirA/dirB
touch ext/dirA/dirB/file

decho E3
tar -g test.snar -vxf test.2.tar -C ext/

echo FIN
test -d dirA && echo >&2 "toplevel dirA exists"
exit 0
],
[0],
[C0
dirA/
dirA/a
dirA/b
C1
dirA/
dirA/c
C2
dirA/
E0
dirA/
dirA/a
dirA/b
E1
dirA/
dirA/c
E2
dirA/
tar: Deleting 'dirA/a'
E3
dirA/
tar: Deleting 'dirA/dirB'
FIN
],
[C0
tar: dirA: Directory is new
C1
C2
E0
E1
E2
E3
],[],[],[gnu, oldgnu, posix])

AT_CLEANUP