Fewer macros in xheader.c
[tar.git] / tests / extrac06.at
blobb68336441aa159db6e21daea665a2d1a851045fd
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
3 # Test suite for GNU tar.
5 # Copyright 2006-2024 Free Software Foundation, 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 # The bug occurs when extracting from a tarfile a directory when the directory
23 # already exists and the version in the tarfile has more permissive
24 # permissions than your umask.  In this case, the permissions of the
25 # existing directory will toggle between the version which complies with
26 # your umask (which would be correct, without -p) and the version from the
27 # tarfile.
29 # Reported by: Ian Jackson <iwj@ubuntu.com>
31 # References: <17461.519.640947.664400@davenant.relativity.greenend.org.uk>
34 AT_SETUP([mode of extracted directories])
35 AT_KEYWORDS([extract extract06 directory mode])
37 AT_TAR_CHECK([
39 # Force umask
40 umask 022
42 # Make sure user's umask is honored, even if we are superuser
43 TAR_OPTIONS="$TAR_OPTIONS --no-same-permissions"
45 # Create a directory
46 mkdir directory
47 chmod 777 directory
48 genfile --stat=mode:777 directory
50 # Archive it
51 tar cf arc directory
53 # Change its permissions ...
54 chmod 755 directory
55 genfile --stat=mode:777 directory
57 # ... and attempt to restore it twice
58 tar xf arc directory --warning=no-timestamp
59 genfile --stat=mode:777 directory
61 tar xf arc directory --warning=no-timestamp
62 genfile --stat=mode:777 directory
64 # After both restores, the directory mode should be 755
66 [0],
67 [777
68 755
69 755
70 755
73 AT_CLEANUP