I believe in that case (where you're trying to specify a file, but the 
parent directories don't exist) then Brett's post is exactly correct.  I 
suppose tar could check each directory in the structure and if it 
doesn't exist, then extract it, but that would require endless rewinding 
in the archive.  Remember that tar is the Tape ARchiver.  When you look 
in a tar archive for a specific file, it runs through the 'tape' until 
it finds the *file* (or directory) you specified on the command line, 
ignoring all the entries it finds until it finds what you were looking 
for.

Once it finds the file, it extracts it, and applies the permissions that 
are encoded in the archive *for that file*.  It doesn't search for the 
parent directories on the way, unless you explicitly specify them on the 
command line:

That command sets the permissions correctly but throws an error.  This 
command, however, works with no errors, so it has to be an issue with 
the order in which the files are archived:
tar xvf test.tar a/b/c/d a/b/c a/b

The heart of the problem is that going back through the archive is 
expensive - it takes a long time, and in an actual tape scenario would 
unnecessarily wear the tape out, and take hours and hours as it went 
back looking for each parent directory.

R

Rubin Bennett
rbTechnologies, LLC
1970 VT Route 14 South
East Montpelier, VT 05651

(802)223-4448
http://thatitguy.com

"Think for yourselves and let others enjoy the privilege to do so too."
  Voltaire, Essay on Tolerance
  French author, humanist, rationalist, & satirist (1694 - 1778)


-----Original Message-----
From: Anthony Carrico [mailto:[email protected]] 
Sent: Wednesday, July 14, 2010 10:27 PM
To: [email protected]
Subject: Re: tar and ownership

On 07/14/2010 10:00 PM, Rubin Bennett wrote:
> Talk about new school... all those double dashes make my head spin!

Sorry, I don't know why I did that. I don't think you tried the "tar xf 
test.tar a/b/c/d" test, which is the bizarre case.

--
Anthony Carrico

Reply via email to