re-mark 1.29b-2 as not yet uploaded (merge madness!)
[debian/tar] / tests / incr08.at
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
2 # Test suite for GNU tar.
3 # Copyright 2013-2014, 2016 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 # Description: In tar 1.26 listed-incremental with -C and absolute path
19 # would malfunction under certain conditions due to buggy filename
20 # normalization.
21 #
22 # The value returned by normalize_filename() is used to populate the "caname"
23 # field in both the "directory" structure in incremen.c and the "name"
24 # structure in names.c, and in both cases that field is then used in the
25 # "hash" and "compare" functions for the related hash tables.  Thus, the
26 # fact that the returned value doesn't reflect the operation of previous
27 # "-C" options means that it's possible for two different directories to
28 # be given the same "caname" value in the hashed structure and thus end up
29 # being confused with each other.
30 #
31 # The bug is triggered when dumping both relative paths after -C and
32 # absolute paths that match the process' current working directory.
33 #
34 # Reported by: Nathan Stratton Treadway <nathanst@ontko.com>
35 # References: <20130922192135.GJ32256@shire.ontko.com>,
36 #             http://lists.gnu.org/archive/html/bug-tar/2013-09/msg00034.html
37
38 AT_SETUP([filename normalization])
39 AT_KEYWORDS([incremental create incr08])
40
41 AT_TAR_CHECK([
42 AT_CHECK_TIMESTAMP
43 AT_SORT_PREREQ
44 mkdir tartest
45 cd tartest
46 mkdir foo
47 mkdir foo/subdir
48 mkdir foo/subdir/dir1
49 mkdir subdir
50 mkdir subdir/dir2
51 decho A
52 find .|sort
53
54 decho B
55 DIR=`pwd`
56 tar -cvf ../foo.tar --listed-incremental=../foo.snar -C foo . $DIR 2>../err |\
57   sed "s|$DIR|ABSPATH|"
58 sed "s|$DIR|ABSPATH|" ../err >&2
59 ],
60 [0],
61 [A
62 .
63 ./foo
64 ./foo/subdir
65 ./foo/subdir/dir1
66 ./subdir
67 ./subdir/dir2
68 B
69 ./
70 ./subdir/
71 ./subdir/dir1/
72 ABSPATH/
73 ABSPATH/subdir/
74 ABSPATH/subdir/dir2/
75 ],
76 [A
77 B
78 tar: .: Directory is new
79 tar: ./subdir: Directory is new
80 tar: ./subdir/dir1: Directory is new
81 tar: ABSPATH: Directory is new
82 tar: ABSPATH/subdir: Directory is new
83 tar: ABSPATH/subdir/dir2: Directory is new
84 tar: Removing leading `/' from member names
85 ],[],[],[gnu])
86
87 AT_CLEANUP