Subject: Re: tar 1.15.1 broken
From: [email-masked] (Eric Blake)
To: Alan Hourihane <[email-masked]>
Cc: [email-masked]
Date: Thu, 27 Oct 2005 15:46:52 +0000

> 
> This works with tar 1.13.25
> 
> tar cvjf test.tbz2 <files> --exclude=<file>

Hmm, I agree that the behavior has changed, but am not yet sure
it is a bug.  I'll ask upstream if the change in behavior was intentional,
or whether it should be construed as a bug.

> 
> In 1.15.1 it mucks up parsing of --exclude=<file> and somehow later
> tries to stat "--exclude=<file>" as being the complete filename. But
> actually when it reports the "Cannot stat: No such file or directory"
> message the filename is correct.
> 
> Moving --exclude=<file> to this...
> 
> tar --exclude=<file> -cvjf test.tbz2 <files>
> 
> makes it work.

The info pages for 1.15 are more explicit - tar supports three types
of argument parsing - traditional, short, and long options.  Traditional
options use no dash, and must be the very first argument.  The
traditional options also have weird behavior; when using multiple
options that require an argument, such as f and b, the syntax is
"tar fb file blocking" (ie. the number of options that required an
argument consume that many more arguments).  If you are mixing
option types, then once the traditional options have been consumed,
the next argument must be a short or long option, otherwise all
remaining arguments are treated as filenames even if they look like
options.  The upshot of this is that:

tar cvjf test.tbz2 --exclude=<file> <files>

is different from

tar cvjf test.tbz2 <files> --exclude=<file>

Fixing your invocation to use long options followed by short
options instead of traditional options followed by long options
is an appropriate workaround.

--
Eric Blake

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/