Debian Codegraph @

tests/extrac22.at

raw
1 # Test suite for GNU tar. -*- Autotest -*-
2 # Copyright 2017-2023 Free Software Foundation, Inc.
3 #
4 # This file is part of GNU tar.
5 #
6 # GNU tar is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # GNU tar is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 AT_SETUP([delay-directory-restore on reversed ordering])
20
21 # The --delay-directory-resore option worked incorrectly on archives with
22 # reversed member ordering (which was documented, anyway). This is illustrated
23 # in
24 # http://lists.gnu.org/archive/html/bug-tar/2019-03/msg00022.html
25 # which was taken as a base for this testcase.
26 # The bug affected tar versions <= 1.32.
27
28 AT_KEYWORDS([extract extrac22 delay delay-reversed])
29 AT_TAR_CHECK([
30 AT_UNPRIVILEGED_PREREQ
31 AT_SORT_PREREQ
32 mkdir t
33 (cd t
34 genfile --length 100 --file data1
35 mkdir dir1
36 cp data1 dir1
37 mkdir dir2
38 cd dir2
39 ln -s ../dir1/data1 data2
40 cd ..
41 chmod -w dir2)
42
43 AT_DATA([filelist],
44 [./dir2/data2
45 ./dir2
46 ./dir1/data1
47 ./dir1
48 ./data1
49 ])
50
51 tar -C t -c -f a.tar --no-recursion -T filelist
52
53 mkdir restore
54 tar -x -p --delay-directory-restore -C restore -f a.tar
55 # Previous versions of tar would fail here with the following diagnostics:
56 # tar: ./dir2/data2: Cannot unlink: Permission denied
57 ],
58 [0],
59 [])
60 AT_CLEANUP