[Techtalk] Help? tar(1) -X Option Not Working

Kai MacTane kmactane at GothPunk.com
Tue Sep 3 17:12:32 EST 2002


At 8/31/02 05:06 AM , Telsa Gwynne wrote:

>The tar manual page is not, unfortunately, too useful. It is,
>I think, almost certainly provided by your distribution. (Go
>on. Tell me you're using LFS now :)) And if it's Red Hat, I
>bet they are using the Debian-provided manual page.

I'm using Slackware.

>Also, the man page and the info file differ on whether equals
>signs are needed in the command, and I still don't know whether
>this matters or not. So for tar, I tend to use the info files.

I'm dodging around that one in my tests by just using the old-style, 
single-letter options. So the command now looks like:

tar cvzf $BackupFile -X /etc/exclude -T /etc/include

No matter what I do, it still puts in the stuff I'm trying to exclude. A 
quick test shows I *can* get it to exclude patterns like the '*.o' in the 
examples, but that's really not going to help here; I want to exclude 
certain *directory trees*, not certain file types.

Like, that /home/working directory, where I unpack all my tarballs, is 
naturally going to contain a huge number of .tar and .tar.gz files. But 
individual users might have those in their own directories, for their own 
archival purposes. The users' tarballs *should* get archived; the ones 
downloaded from the Net really shouldn't. (If I need them again, I can just 
download them again... or even newer versions.)

>You're not alone with this. See also:
>http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=54243
>...which I know about in turn because I ran into similar problems
>and was about to enter a very similar bug before I found someone
>already had.

Well, that helps in a "misery loves company" sort of way. I'm starting to 
wonder if a bug report direct to GNU is appropriate.

>As a wild guess, I wonder whether the mention of "PATTERN" in
>"info tar" is relevant:
>[big snip]
>It's specifically saying "pattern" and by that it means the sort
>of globbing you use in the bash shell. It does not mean regexps proper.

I've tried tacking on *s in appropriate places, enclosing each line in 
'apostrophes'... no joy.

>Does bash interpret / marks as part of a pattern? If so, see above.
>I think the "Removing leading /" is to aid in restoring: you don't
>end up overwriting /etc, /usr and so on unless you specifically
>sit in the root directory to do it. I'm not very sure about this
>though.

Sounds about right.

> > Can anyone tell me what I'm doing wrong? I'm using GNU tar version 1.13.
>
>I hate to say it, but I think trusting the man page which didn't
>come with the GNU package but instead was slapped in by the distro
>is the problem. It's incomplete. You know the "the info page is the
>authoritative reference" comment you get in some GNU packages' man
>pages? With tar, it is _definitely_ true. Set aside at least an hour
>to navigate and read it all, but do read info tar, particularly the
>two nodes I mentioned above.

I looked at that, but it seems not to have anything helpful to say on this 
matter.

                                                 --Kai MacTane
----------------------------------------------------------------------
"I hear the roar of a big machine,
  Two worlds and in between;
  Hot metal and methedrine.
  I hear your empire down."
                                                 --Sisters of Mercy,
                                                  "Lucretia, My
                                                   Reflection"




More information about the Techtalk mailing list