Behaviour
For the sake of clarity about the issue, the following MWE illustrates what is happening:
cas$ tar --version
bsdtar 2.6.2 - libarchive 2.6.2
cas$ mkdir o
cas$ touch o/a o/b
cas$ tar cv o > /dev/null
a ./._o
a o
a o/._a
a o/a
a o/._b
a o/b
So each file and directory has a ._ file added to the tar file in the same directory, as mipadi said. This tar, let's call it mactar, avoids collisions by ignoring files beginning ._ in the input, e.g, with:
mkdir p && touch p/._a p/._b
cas$ tar cv p p/._b > /dev/null
a ./._p
a p
the existence of the p/._a file is simply ignored by tar, and so is the p/._b file, even though that is explicitly included in the CLI invocation. Thus, no collisions can occur.
Controlling tar
If you have a Unix background, you likely are unhappy about this behaviour. The mactar lacks the expected documentation: the man page is for the regular Free BSD tar and does not mention this idiosyncrasy.
However, the generation of the files for the meta forks can be disabled by setting an environment variable, so: export COPYFILE_DISABLE=true
.
History
I'm not quite clear on the timing, but OSX began with the regular Free BSD tar, then Apple circulated an additional utility, tar_hfs that was the ancestor of mactar, and then, I think with Leopard, changed /usr/bin/tar
to be mactar.