]> Dogcows Code - chaz/tar/blob - tests/remfiles01.at
Update copyright years.
[chaz/tar] / tests / remfiles01.at
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
2
3 # Test suite for GNU tar.
4 # Copyright 2009, 2013-2014 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: When called with --create --remove-files and a compression
22 # options tar (v. <= 1.22.90) would remove files even if it had failed
23 # to store them in the archive.
24 #
25 # References: <77cb99c00910020940k6ce15da4wb564d2418ec52cfb@mail.gmail.com>
26 # http://lists.gnu.org/archive/html/bug-tar/2009-10/msg00005.html
27
28 AT_SETUP([remove-files with compression])
29 AT_KEYWORDS([create remove-files remfiles01 gzip])
30
31 unset TAR_OPTIONS
32 AT_CHECK([
33 AT_UNPRIVILEGED_PREREQ
34 AT_GZIP_PREREQ
35 AT_SIGPIPE_PREREQ
36 AT_SORT_PREREQ
37
38 mkdir dir
39 cd dir
40 genfile --file a --length 0
41 chmod 0 a
42 genfile --file b
43 mkdir c
44
45 # Depending on when the SIGPIPE gets delivered, the invocation below
46 # may finish with either
47 # tar: a: Cannot write: Broken pipe
48 # or
49 # tar: Child returned status 2
50
51 # Discard diagnostics that some shells generate about broken pipes,
52 # and discard all of tar's diagnostics except for the ones saying "(child)".
53 # Gzip's exit code is propagated to the shell. Usually it is 141.
54 # Convert all non-zero exits to 2 to make it predictable.
55 (tar -c -f a -z --remove-files b c 2>err || (exit 2) ) 2>/dev/null
56 EC=$?
57 sed -n '/(child)/p' err >&2
58 rm err
59 find . | sort
60 exit $EC
61 ],
62 [2],
63 [.
64 ./a
65 ./b
66 ./c
67 ],
68 [tar (child): a: Cannot open: Permission denied
69 tar (child): Error is not recoverable: exiting now
70 ])
71
72 AT_CLEANUP
This page took 0.033462 seconds and 4 git commands to generate.