Subject: bin/16297: tar -p ignores umask when creating dir not present in tar ball.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <liman@autonomica.se>
List: netbsd-bugs
Date: 04/11/2002 10:57:02
>Number: 16297
>Category: bin
>Synopsis: tar -p ignores umask when creating dir not present in tar ball.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Apr 11 01:57:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Lars-Johan Liman
>Release: NetBSD 1.5ZA (and others)
>Organization:
Autonomica AB
#----------------------------------------------------------------------
# Lars-Johan Liman ! E-mail: liman@autonomica.se
# Senior Systems Specialist ! HTTP : //www.autonomica.se/
# Autonomica AB, Stockholm ! Voice : +46 8 - 615 85 72
#----------------------------------------------------------------------
>Environment:
System: NetBSD naptop.autonomica.net 1.5ZA NetBSD 1.5ZA (GENERIC_LAPTOP) #0: Fri Mar 8 18:54:17 MET 2002 liman@homburg.liman.sunet.se:/usr/obj/sys/arch/i386/compile/GENERIC_LAPTOP i386
Architecture: i386
Machine: i386
>Description:
If one creates a tar ball which contains files in a
subdirectory, but not the subdirecory itself, tar will create
the subdirectory when extracting the files. The problem is
that, if -p is given, the directory will be created 0777,
ignoring the curren umask. This can be very unfortunate if one
stores precious information in the subdirectory.
>How-To-Repeat:
mkdir tmp1
chmod 0755 tmp1
cd tmp1
touch foobar
chmod 0644 foobar
cd ..
tar cf foobar.tar tmp1/foobar
# Note! Input is just the file, not the entire dir!
ls -lgd tmp1
umask 022
mkdir tmp2
cd tmp2
tar xvpf ../foobar.tar
# Note! tar has to create tmp1, but it's not in the tar ball.
ls -lgd tmp1
>Fix:
Not known.
>Release-Note:
>Audit-Trail:
>Unformatted: