Update copyright years
[tar.git] / tests / extrac23.at
blobfa3e791147c9187a042843a63c441a392a0a60d2
1 # Test suite for GNU tar.                             -*- Autotest -*-
2 # Copyright 2020-2022 Free Software Foundation, Inc.
4 # This file is part of GNU tar.
6 # GNU tar 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 of the License, or
9 # (at your option) any later version.
11 # GNU tar 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.
16 # You should have received a copy of the GNU General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 AT_SETUP([--no-overwrite-dir])
19 AT_KEYWORDS([extract extrac23 no-overwrite-dir])
21 # Description: Implementation of the --no-overwrite-dir option was flawed in
22 # tar versions up to 1.32.90.  This option is intended to preserve metadata
23 # of existing directories.  In fact it worked only for non-empty directories.
24 # Moreover, if the actual directory was owned by the user tar runs as and the
25 # S_IWUSR bit was not set in its actual permissions, tar failed to create files
26 # in it.
28 # Reported by: Michael Kaufmann <mail@michael-kaufmann.ch>
29 # References: <20200207112934.Horde.anXzYhAj2CHiwUrw5CuT0G-@webmail.michael-kaufmann.ch>,
30 #   https://lists.gnu.org/archive/html/bug-tar/2020-02/msg00003.html
32 AT_TAR_CHECK([
33 # Test if the directory permissions are restored properly.
34 mkdir dir
35 chmod 755 dir
36 tar cf a.tar dir
37 chmod 777 dir
38 tar -xf a.tar --no-overwrite-dir
39 genfile --stat=mode.777 dir
41 # Test if temporary permissions are set correctly to allow the owner
42 # to write to the directory.
43 genfile --file dir/file
44 tar cf a.tar dir
45 rm dir/file
46 chmod 400 dir
47 tar -xf a.tar --no-overwrite-dir
48 genfile --stat=mode.777 dir
49 chmod 700 dir
50 find dir
52 [0],
53 [777
54 400
55 dir
56 dir/file
58 AT_CLEANUP