re-mark 1.29b-2 as not yet uploaded (merge madness!)
[debian/tar] / tests / incr02.at
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
2
3 # Test suite for GNU tar.
4 # Copyright 2005, 2007, 2013-2014, 2016 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 # Description:
22 # Restoring of directory modes and timestamps works correctly only
23 # if the archive has normal member ordering, i.e. each directory
24 # member is immediately followed by members located under that directory.
25 # This is not true for incremental archives, where directory members
26 # precede the non-directory ones. Due to this, GNU tar up to version 1.15.2
27 # failed to correctly restore directory timestamps from an incremental
28 # archive if this directory contained some files in it.
29 #
30 # References: <200511291228.47081.karaman@dssgmbh.de>
31
32 AT_SETUP([restoring timestamps from incremental])
33 AT_KEYWORDS([incremental timestamp restore incr02])
34
35 AT_TAR_CHECK([
36 AT_CHECK_TIMESTAMP
37 # Create directory structure
38 mkdir dir
39 mkdir dir/subdir1
40 mkdir dir/subdir2
41 genfile --length 10 --file dir/subdir1/file
42
43 # Save mtime for later comparison
44 genfile --stat=mtime dir/subdir1 > ts
45
46 # Create an archive. Using incremental mode makes sure the
47 # archive will have a directory-first member ordering,
48 # i.e.:
49 # dir/
50 # dir/subdir1/
51 # dir/subdir2/
52 # dir/subdir1/foofile
53 #
54 # When restoring from this directory structure, 'dir/subdir2/' used to
55 # trigger apply_nonancestor_delayed_set_stat() which restored stats for
56 # 'subdir1' prior to restoring 'dir/subdir1/foofile'. Then, restoring the
57 # latter clobbered the directory timestamp.
58
59 tar -cf archive -g db dir
60
61 # Move away the directory
62 mv dir orig
63
64 # Wait enough time for timestamps to differ in case of failure.
65 sleep 5
66
67 # Restore the directory
68 tar -xf archive dir
69
70 # Check the timestamp
71 genfile --stat=mtime dir/subdir1 | diff ts -
72 ],
73 [0],
74 [],[],[],[],[gnu, oldgnu, posix])
75
76 AT_CLEANUP
77
78 # End of incr02.at