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]

Re: tar -f behaviour

Eugene Rosenzweig wrote:
> 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
You meant "tar tfz ..." right?

> 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
> works.
> 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?

This is a feature and documented in the info page. GNU doesn't believe
in man so they provide all their documentation in the info format, and
some programs also have a minimal man page. Look for old options style
(without dash):
   When options that need arguments are given together with the command,
   all the associated arguments follow, in the same order as the
   Thus, the example given previously could also be written in the old
   style as follows:

        $ tar cvbf 20 /dev/rmt0

   Here, `20' is the argument of `-b' and `/dev/rmt0' is the argument of

Note to have info find the file automatically you may need to
'redir' the info files. Something like this will do. That the tar
package doesn't install the info page can be considered a bug 8-(
	cd /usr/info
	for f in *.info ; do install-info $f dir ; done

> 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:
> Documentation:
> FAQ:         

Med venlig hilsen / Kind regards

Hack Kampbjørn

Unsubscribe info:
Bug reporting:

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