tar question

David Tonhofer, m-plify S.A. d.tonhofer at m-plify.com
Thu Oct 6 18:53:44 UTC 2005


> Please look at the tar line closer:

Um...right. My bad. Comes from doing two things at a time.

> My version of tar is 1.13.25, plus I'm also using the '=' in my exclude.
> It is possible that they changed how exclude works in the newer version
> of tar.

Nah, I don't think so. The difference comes from the fact that
you use a a relative path to state the stuff to include, whereas I use
an absolute path. Let's make this definitive statement and call it
quits for today as the beer awaits. Apparently "exclude" does not
100% respect the principle of least astonishment:


cd /

# CASE 1:

tar -zcf out1.tgz --exclude=etc/sysconfig   etc
-> the archive contains relative paths
-> etc/sysconfig has been excluded
   (parameter matches archive path)

# CASE 2:

tar -zcf out2.tgz --exclude=/etc/sysconfig  etc
-> the archive contains relative paths
-> etc/sysconfig has NOT been excluded!
   (parameter does not match archive path)

# CASE 3:

tar -zcf out3.tgz --exclude=etc/sysconfig   /etc
-> the archive contains relative paths, as the leading '/' is stripped
   tar says "Removing leading `/' from member names"
   (a Good Thing as you can then untar anywhere)
-> etc/sysconfig has been excluded
   (parameter matches archive path)

# CASE 4:

tar -zcf out4.tgz --exclude=/etc/sysconfig  /etc
-> the archive contains relative paths, as the leading '/' is stripped
   tar says "Removing leading `/' from member names"
   (a Good Thing as you can then untar anywhere)
-> etc/sysconfig HAS BEEN excluded
   (even though parameter does not match archive path)






More information about the redhat-list mailing list