1# Process this file with autom4te to create testsuite. -*- Autotest -*- 2 3# Test suite for GNU tar. 4# Copyright (C) 2006 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 2, 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# The bug occurs when extracting from a tarfile a directory when the directory 22# already exists and the version in the tarfile has more permissive 23# permissions than your umask. In this case, the permissions of the 24# existing directory will toggle between the version which complies with 25# your umask (which would be correct, without -p) and the version from the 26# tarfile. 27# 28# Reported by: Ian Jackson <iwj@ubuntu.com> 29# 30# References: <17461.519.640947.664400@davenant.relativity.greenend.org.uk> 31# 32 33AT_SETUP([mode of extracted directories]) 34AT_KEYWORDS([extract extract06 directory mode]) 35 36AT_TAR_CHECK([ 37 38# Force umask 39umask 022 40 41# Make sure user's umask is honored, even if we are superuser 42TAR_OPTIONS="$TAR_OPTIONS --no-same-permissions" 43 44# Create a directory 45mkdir directory 46chmod 777 directory 47genfile --stat=mode:777 directory 48 49# Archive it 50tar cf arc directory 51 52# Change its permissions ... 53chmod 755 directory 54genfile --stat=mode:777 directory 55 56# ... and attempt to restore it twice 57tar xf arc directory 58genfile --stat=mode:777 directory 59 60tar xf arc directory 61genfile --stat=mode:777 directory 62 63# After both restores, the directory mode should be 755 64], 65[0], 66[777 67755 68755 69755 70]) 71 72AT_CLEANUP 73