]> git.cworth.org Git - tar/blob - tests/remfiles01.at
upstream: Fix extraction of device nodes.
[tar] / tests / remfiles01.at
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
2
3 # Test suite for GNU tar.
4 # Copyright (C) 2009 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: 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_SORT_PREREQ
36
37 mkdir dir
38 cd dir
39 genfile --file a --length 0
40 chmod 0 a
41 genfile --file b
42 mkdir c
43
44 # Depending on when the SIGPIPE gets delivered, the invocation below
45 # may finish with either
46 #  tar: a: Cannot write: Broken pipe
47 # or
48 #  tar: Child returned status 2
49
50 tar -c -f a -z --remove-files b c 2>err
51 EC=$?
52 sed -n '/(child)/p' err >&2
53 rm err
54 find . | sort
55 # Gzip exit code is propagated to the shell. Usually it is
56 # 141.  We convert all non-zero exits to 2 to make it predictable.
57 test $EC && exit 2
58 ],
59 [2],
60 [.
61 ./a
62 ./b
63 ./c
64 ],
65 [tar (child): a: Cannot open: Permission denied
66 tar (child): Error is not recoverable: exiting now
67 ])
68
69 AT_CLEANUP