This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

tar -f behaviour

Looking at tar I noticed a small oddity in its behaviour, as compared to
what I would have thought was 'normal'
When dealing with files, using dash before options, the 'f' option has to be
the last one in the option string, e.g.
tar -tfz tarball.tar.gz
works while
tar -ftz tarball.tar.gz
doesn't reporting that file 'tz' does not exist.
It seems that 'f' anything after the 'f' option is considered to be the
archive filename.
tar -f tarball.tar.gz -tz
When dash is absent the oddity is absent too,
tar ftz tarball.tar.gz
works with options f, t and z in any combination whatsoever.

There is no tar manpage on my system. I looked at 'tar --help' for option
explanation which didn't offer anything and I compared with linux tar
behaviour. The linux version doesn't exhibit any pickiness about position of
'f' option when dash is being used. I do not have any experience with unix
command line parsing but I wonder if the presence of this behaviour only
when there is a dash indicates it has got something to do with getopt() or
popt? I do not seem to have manpage for getopt() either even though it is
references in popt manpage.

In conclusion, is this a bug or a feature?

PS I checked the package listing on, there is no man page
with tar distribution. There is tar.texi in the source package. Maybe there
should be manpage in the binary package.

Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]