[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tar-bug
Subject:    [Bug-tar] Possible bug in directory exclusion in GNU Tar 1.26
From:       Dotan Cohen <dotancohen () gmail ! com>
Date:       2013-04-07 6:46:03
Message-ID: CAKDXFkP5_1G_eAQFsuUSpKM1c-iOBUg8vP_QOcKVPTYgF1=aLQ () mail ! gmail ! com
[Download RAW message or body]

When excluding directories to be tarred with GNU Tar, a slash after
the directory name makes the exclude fail:

$ mkdir a
$ mkdir a/bigfiles
$ mkdir b
$ echo 12345 > a/1.txt
$ echo 67890 > a/2.txt
$ echo nice > a/3.txt
$ echo "This is a big file\!" > a/bigfiles/big.txt
$ tar -czf backup.tgz a/ --exclude a/bigfiles/
$ mv backup.tgz b
$ cd b/
$ tar -xzf backup.tgz
$ tree a/
a/
=E2=94=9C=E2=94=80=E2=94=80 1.txt
=E2=94=9C=E2=94=80=E2=94=80 2.txt
=E2=94=9C=E2=94=80=E2=94=80 3.txt
=E2=94=94=E2=94=80=E2=94=80 bigfiles
    =E2=94=94=E2=94=80=E2=94=80 big.txt

The same test but without the trailing slash on "a/bigfiles" properly
excludes the bigfiles directory. In my opinion this is a bug as it is
in contrast to other GNU tools such as cp which do accept a trailing
slash. Furthermore, Bash filename completion adds the trailing slash
so it is intuitive that the command will include it.

--
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic