GNU tar manpage BUG
The --exclude-tag option - does not mention the required magic cookie
The man page is factually inaccurate.
File CACHEDIR.TAG is insufficient to trigger the action described (the file must also have a magic cookie)
#
The man page should mention that the file CACHEDIR.TAG will be ignored if it does not start with magic cookie
Signature: 8a477f597d28d172789f06886806bc55
It could also mention that you might prefer option --exclude-tag=CACHEDIR.TAG
but that there is some hazzard that a useful file with that name could appear and cause tar to exclude that directory.
It might also be interesting to mention what that large number is:
echo -n ".IsCacheDirectory" | md5sum
8a477f597d28d172789f06886806bc55 -
This is the current information in the GNU tar man page (that is in error)
man tar
--exclude-caches
Exclude contents of directories containing file CACHEDIR.TAG, except for the tag file itself.
--exclude-caches-all
Exclude directories containing file CACHEDIR.TAG and the file itself.
--exclude-caches-under
Exclude everything under directories containing CACHEDIR.TAG
This bug is in the man page (for GNU tar)
Verify this bug in the man page by running this code below
To show the program behavior that demonstrates the man page is in error:
mkdir -p 1/2/3
touch 1/2/CACHEDIR.TAG
tar --exclude-caches -cvf /dev/null 1 # tar archives the file as normal, and tar will NOT act as the man page describes
This shows that the file WITH the magic cookie will cause tar to act as the man page describes.
To show the program behavior that demonstrates what the man page SHOULD say, run:
mkdir -p 1/2/3
echo -n "Signature: 8a477f597d28d172789f06886806bc55" > 1/2/CACHEDIR.TAG
tar --exclude-caches -cvf /dev/null 1
Running tar this way now tar will print
tar: 1/2/: contains a cache directory tag CACHEDIR.TAG; contents not dumped