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
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
33 # Test if the directory permissions are restored properly.
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
47 tar -xf a.tar --no-overwrite-dir
48 genfile --stat=mode.777 dir