Fix the difflink test
[tar.git] / tests / incr02.at
blob8f7a37b8815d4c238d2f7e65847be5d0d2a76801
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
3 # Test suite for GNU tar.
4 # Copyright 2005, 2007, 2013-2014, 2016-2017 Free Software Foundation,
5 # Inc.
7 # This file is part of GNU tar.
9 # GNU tar is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # GNU tar is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 # Description:
23 # Restoring of directory modes and timestamps works correctly only
24 # if the archive has normal member ordering, i.e. each directory
25 # member is immediately followed by members located under that directory.
26 # This is not true for incremental archives, where directory members
27 # precede the non-directory ones. Due to this, GNU tar up to version 1.15.2
28 # failed to correctly restore directory timestamps from an incremental
29 # archive if this directory contained some files in it.
31 # References: <200511291228.47081.karaman@dssgmbh.de>
33 AT_SETUP([restoring timestamps from incremental])
34 AT_KEYWORDS([incremental timestamp restore incr02])
36 AT_TAR_CHECK([
37 AT_CHECK_TIMESTAMP
38 # Create directory structure
39 mkdir dir
40 mkdir dir/subdir1
41 mkdir dir/subdir2
42 genfile --length 10 --file dir/subdir1/file
44 # Save mtime for later comparison
45 genfile --stat=mtime dir/subdir1 > ts
47 # Create an archive. Using incremental mode makes sure the
48 # archive will have a directory-first member ordering,
49 # i.e.:
50 # dir/
51 # dir/subdir1/
52 # dir/subdir2/
53 # dir/subdir1/foofile
55 # When restoring from this directory structure, 'dir/subdir2/' used to
56 # trigger apply_nonancestor_delayed_set_stat() which restored stats for
57 # 'subdir1' prior to restoring 'dir/subdir1/foofile'. Then, restoring the
58 # latter clobbered the directory timestamp.
60 tar -cf archive -g db dir
62 # Move away the directory
63 mv dir orig
65 # Wait enough time for timestamps to differ in case of failure.
66 sleep 5
68 # Restore the directory
69 tar -xf archive dir
71 # Check the timestamp
72 genfile --stat=mtime dir/subdir1 | diff ts -
74 [0],
75 [],[],[],[],[gnu, oldgnu, posix])
77 AT_CLEANUP
79 # End of incr02.at