Subject: Re: ftp and tar annoyances
To: Rick Byers <rickb@iaw.on.ca>
From: Simon Burge <simonb@telstra.com.au>
List: current-users
Date: 11/14/1997 09:26:22
On Thu, 13 Nov 1997 14:41:18 -0500 (EST)  Rick Byers wrote:

> On Thu, 13 Nov 1997, Brad Salai wrote:
> 
> > There is a thing about tar that makes it slightly harder to use than it
> > might otherwise be.
> > 
> > You have to get the options in the right order,
> > 
> > tar -zxvpf bin.tar.gz   works, but
> > 
> > tar -zxvfp bin.tar.gz   doesn't
> > 
> > Once you know this, only the occasional tyop causes problems, but why does
> > it have to be that way?
> 
> That is because 'bin.tar.gz' is a parameter to the '-f' option.  Really,
> what you are doing is:
> 
> tar -z -x -v -p -f bin.tar.gz
> and 
> tar -z -x -v -f -p bin.tar.gz
> 
> The -p option doesn't take a paremeter.  -f take as a parameter the file
> you want to extract...

To further confuse things, the original command line _will_ work if you
leave off the leading "-" from the option string.  If the leading "-" is
left of, then the first argument is taken as a list of options, and each
option that expects an argument pulls in following arguments.  Here's
some comments from GNU tar's decode_options() function:

	/* Convert old-style tar call by exploding option element and rearranging
	   options accordingly.  */

		and:

	/* Copy each old letter option as a separate option, and have the
	   corresponding argument moved next to it.  */

I always use "tar xvpfz filename.tar.gz" to extract gzip'd tar files,
and I've never had a problem.  I personally have never understood why
people have bothered with the unneeded "-" and the hassle that goes with
it :-)

Simon.