]> Dogcows Code - chaz/tar/blob - tests/incr02.at
tar: quote 'like this', not `like this'
[chaz/tar] / tests / incr02.at
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
2
3 # Test suite for GNU tar.
4 # Copyright (C) 2005, 2007 Free Software Foundation, Inc.
5
6 # This program 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, or (at your option)
9 # any later version.
10
11 # This program 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, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301, USA.
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 # Create directory structure
37 mkdir dir
38 mkdir dir/subdir1
39 mkdir dir/subdir2
40 genfile --length 10 --file dir/subdir1/file
41
42 # Save mtime for later comparison
43 genfile --stat=mtime dir/subdir1 > ts
44
45 # Create an archive. Using incremental mode makes sure the
46 # archive will have a directory-first member ordering,
47 # i.e.:
48 # dir/
49 # dir/subdir1/
50 # dir/subdir2/
51 # dir/subdir1/foofile
52 #
53 # When restoring from this directory structure, 'dir/subdir2/' used to
54 # trigger apply_nonancestor_delayed_set_stat() which restored stats for
55 # 'subdir1' prior to restoring 'dir/subdir1/foofile'. Then, restoring the
56 # latter clobbered the directory timestamp.
57
58 tar -cf archive -g db dir
59
60 # Move away the directory
61 mv dir orig
62
63 # Wait enough time for timestamps to differ in case of failure.
64 sleep 5
65
66 # Restore the directory
67 tar -xf archive dir
68
69 # Check the timestamp
70 genfile --stat=mtime dir/subdir1 | diff ts -
71 ],
72 [0],
73 [],[],[],[],[gnu, oldgnu, posix])
74
75 AT_CLEANUP
76
77 # End of incr02.at
This page took 0.040391 seconds and 5 git commands to generate.