Bug 54243 - --exclude option not correctly documented in man page
--exclude option not correctly documented in man page
Product: Red Hat Linux
Classification: Retired
Component: tar (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Vrabec
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2001-10-02 10:57 EDT by Karl schmidt
Modified: 2007-04-18 12:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-09-07 03:18:57 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Karl schmidt 2001-10-02 10:57:05 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.3-13 i686)

Description of problem:
It is not clear anywhere as to what is the correct syntax for the
--exclude option

Can it be used more than once in a command line?

Which is the proper syntax ?

tar -czf  --exclude=/etc/somedir*'  /etc

or 2

tar -czf --exclude='/etc/somedir*'   /etc

or 3

tar -czf --exclude  /etc/somedir*  /etc

or 4

tar -czf --exclude '/etc/somedir*'   /etc

Atleast # 3 appears not to work?

I would be happy to assist who ever is maintaining the docs with this
issue - provide me the man page and I will test the syntax.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
tar -zcf --exclude  /etc/somedir*  /etc


Actual Results:  returns errors 

Expected Results:  would work as in man page

Additional info:

I would be happy to assist who ever is maintaining the docs with this
issue - provide me the new man page and I will test the syntax.
Comment 1 Bernhard Rosenkraenzer 2001-10-02 11:06:06 EDT
The correct usage is

tar czf foo.tar /etc --exclude 'pattern'


tar cjf foo.tar.bz2 /etc --exclude 'passwd*'

would back up your /etc, but not passwd, passwd-, passwd.old and whatever else 
you have.

I've taken the documentation issue up with the base package maintainer; 
waiting for his response.
Comment 2 Telsa Gwynne 2002-02-04 07:06:07 EST
I've just met this myself on RH 7.2, tar 1.13.19.

It didn't help that I was mixing and matching old-style single letter options
and longopts in the first few runs. Some suggestions for docs improvements:

man tar should mention that it is far safer to stick to *either* longoptions,
*or* the ones with hyphens, *or* the old ones :) (Ow.) I am not sure that 
info explicitly says this, but it's abundantly clear in the examples of
"what these do" from it.

Why does man tar refer to "--longopt foo" and info tar to "--longopt=foo"?
Is the = necessary?

Finally, this did not do what I expected: 

tar --create --verbose --multivolume --exclude /home/hobbit/ogg --file /dev/st0
/etc /home

I expected this to "tar cvf" /etc and /home onto the tape, with the 
exception of the ogg collection. It put /etc and /home onto the tape, but
it did not exclude /home/hobbit/ogg.

If this has something to do with -P and leading slashes being dropped from 
the --exclude file as well as from the files being archived, I *really* think
this needs putting in the man page and the info page. If it was the lack of
the equals sign, the man page needs fixing. If a plain filename won't work,
that definitely needs mentioning!

(For anyone who queries bugzilla and wants an answer to something similar,
I used  --exclude *.ogg in the end. And --exclude *.rpm, so to the original
questioner: yes, it can be used twice in the same command line.)

I gather the man page is RH's (or Debian's) and the info file is GNU's. Can
I request that "please give info examples clarifying --exclude and its syntax"
gets passed upstream, or should I head for the spamtrap that is bug-gnu-utils

Oh --  and on RH when you type info tar, you start at the node beginning
"now that we have learned the three most common options in the tutorial..".
I think it should start at the beginning, before the tutorial! info is 
somewhat difficult to negotiate for some people (me), and finding the start
of the thing took a while. 

Sorry this is so long, but if you're talking to the maintainers anyway, 
perhaps it's a good time to mention it.
Comment 3 Peter Vrabec 2005-09-07 03:18:57 EDT
fixed in devel and FC4-update.

Note You need to log in before you can comment on or make changes to this bug.