The tar versions in RedHat 6.1 and 6.2 have problems with exclusions and wildcards. I will give an example, this is much easier. File tree looks like this: cmds/ cmds/RCS/ cmds/RCS/bing.c,v cmds/bing.c cmds/living/ cmds/living/RCS/ cmds/living/RCS/bing2.c,v cmds/living/bing2.c bash$ tar -cf - --exclude '*/RCS*' cmds | tar -tf - cmds/ cmds/bing.c cmds/living/ cmds/living/RCS/ cmds/living/RCS/bing2.c,v cmds/living/bing2.c bash$ tar -cf - --exclude '*/RCS/*' cmds | tar -tf - cmds/ cmds/RCS/ cmds/bing.c cmds/living/ cmds/living/RCS/ cmds/living/RCS/bing2.c,v cmds/living/bing2.c bash$ When the tree is one deep it does work, however deeper recursion doesn't. Tar version 1.12 from RedHat 6.0 works fine.
Hm, now that I look at ALL tar bugs (instead of only the ones for 6.2) I see it has been reported twice already. How about a fix or downgrade?
According to the GNU tar maintainers, this is not a bug but intended (POSIXly-correct) behavior.
curiously this bug isn't QUITE compliant with what they are claiming. if I have a dir tree like: home home/skvidal home/skvidal/.netscape home/skvidal/.netscape/cache home/skvidal/.netscape/cache/not home/skvidal/.netscape/cache/this home/skvidal/.mozilla home/skvidal/.mozilla/cache home/skvidal/.mozilla/cache/neither home/skvidal/la.mp3 home/skvidal/lalaal.mp3 if I have an exclude file that looks like: .netscape/cache *.mp3 then the mp3's will be excluded but the .netscape/cache dir will not be excluded if I change the exclude file to look like: cache *.mp3 then it will exclude all files/dirs named cache and all .mp3 files. I looked through the source and it appears that they have a specific allowance for files containing slashes but I think its just not working.