untarring write-protected directories

James Helman jim at baroque.Stanford.EDU
Tue Jul 31 08:01:37 AEST 1990


Unlike BSD/SunOS, IRIX tar religiously obeys the directory modes
defined in an archive.  This means that if you restore an archive
which contains write-protected directories, tar is unable to write any
part of the archive beneath that point (unless one is root).  One
solution is repeatedly untar and unprotect the offending directories,
but this could take many iterations if the protected tree is deep.
There must be a better way, but I don't see any flags that help.

In a similar vein (i.e. IRIX tar shooting itself in the foot),
something which bugs the bejesus out of me is tar's restoring
directory/file ownerships for normal users.  Why should normal users
need or even be able to create files and directories they don't own?
This usually means that tar then fails to retrieve the requested files
because of protection mismatches as above.  In addition, if the
protections on what they just restored are restrictive, they may even
have to call a rotorooter to remove the directory!  Of course the "-o"
flag will save you, but why leave an open hole for novice or
BSD-acclimated users to trip into?

b'roke> id
uid=31(guest) gid=31(guest)
b'roke> tar tvf enough.tar
r-xr-xr-x  13/11 dir     Jul 30 14:55 1990 enough/
rw-r--r--  13/11       0 Jul 30 14:54 1990 enough/already
rw-r--r--  13/11       0 Jul 30 14:54 1990 enough/irepent
rw-r--r--  13/11       0 Jul 30 14:54 1990 enough/juststop
rw-r--r--  13/11       0 Jul 30 14:55 1990 enough/please
rw-r--r--  13/11       0 Jul 30 14:55 1990 enough/youtwit
b'roke> tar xf enough.tar
tar: enough/already - cannot create
tar: enough/irepent - cannot create
tar: enough/juststop - cannot create
tar: enough/please - cannot create
tar: enough/youtwit - cannot create
b'roke> rmdir enough
rmdir: enough: Search or write permission needed

Yeeech!

Jim Helman
Department of Applied Physics			6 Trillium Lane
Stanford University				San Carlos, CA 94070
(jim at KAOS.stanford.edu) 			(415) 723-9127



More information about the Comp.sys.sgi mailing list