1 | # Process this file with autom4te to create testsuite. -*- Autotest -*-
|
---|
2 |
|
---|
3 | # Test suite for GNU tar.
|
---|
4 | # Copyright (C) 2006 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 2, 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 | # Using tar 1.15.x the following equivalent command sets:
|
---|
22 | #
|
---|
23 | # 1. tar cf archive file1 file2
|
---|
24 | # and
|
---|
25 | # 2. tar cfT archive /dev/null
|
---|
26 | # tar rf archive file1
|
---|
27 | # tar rt archive file2
|
---|
28 | #
|
---|
29 | # produced different archives (GNU format is assumed). Namely, in the
|
---|
30 | # second case the mode field of all members, except the first, was truncated
|
---|
31 | # to lower 3 octets (& 0777).
|
---|
32 | #
|
---|
33 | # References:
|
---|
34 | # <200607210526.AA03440@tamuki.linet.gr.jp>
|
---|
35 | # http://lists.gnu.org/archive/html/bug-tar/2006-07/msg00029.html
|
---|
36 |
|
---|
37 | # The test case below verifies that the equivalent create and append commands
|
---|
38 | # produce binary equivalent archives for all formats.
|
---|
39 |
|
---|
40 | AT_SETUP([append vs. create])
|
---|
41 | AT_KEYWORDS([append append02 append-gnu])
|
---|
42 |
|
---|
43 | AT_TAR_CHECK([
|
---|
44 | genfile --file file1
|
---|
45 | genfile --file file2
|
---|
46 |
|
---|
47 | # Make sure file timestamps in the archive will not differ
|
---|
48 | MTIME="--mtime=@0"
|
---|
49 |
|
---|
50 | # For PAX archives, we need to make sure extended header names are
|
---|
51 | # reproducible and that their contents won't change with time
|
---|
52 | if test $[]TEST_TAR_FORMAT = posix; then
|
---|
53 | TAR_OPTIONS="$TAR_OPTIONS --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=mtime,delete=atime,delete=ctime"
|
---|
54 | fi
|
---|
55 |
|
---|
56 | echo Creating archive.1
|
---|
57 | tar $MTIME -cf archive.1 file1 file2
|
---|
58 |
|
---|
59 | echo Creating archive.2
|
---|
60 | tar $MTIME -cf archive.2 -T /dev/null
|
---|
61 | tar $MTIME -rf archive.2 file1
|
---|
62 | tar $MTIME -rf archive.2 file2
|
---|
63 |
|
---|
64 | echo Comparing archives
|
---|
65 | cmp archive.1 archive.2
|
---|
66 | ],
|
---|
67 | [0],
|
---|
68 | [Creating archive.1
|
---|
69 | Creating archive.2
|
---|
70 | Comparing archives
|
---|
71 | ])
|
---|
72 |
|
---|
73 | AT_CLEANUP
|
---|
74 |
|
---|
75 | # End of append02.at
|
---|