Mac – way to suppress valid files beginning with dot (.) in a tar archive giving false errors and files

command linemactar

I have a tar compressed archive created on a linux system that has valid files in a directory beginning with dot (.).

When I extract that tar file on a Mac, tar thinks that the dotted file is a resource fork

On linux:

# mkdir test_dir
# cd test_dir
# echo hello > ._SUCCESS.crc
# cd ..
# tar cvzf test_dir.tar.gz test_dir
test_dir/
test_dir/._SUCCESS.crc
# tar tf test_dir.tar.gz 
test_dir/
test_dir/._SUCCESS.crc

On the Mac:

$ tar xzf test_dir.tar.gz 
tar: copyfile unpack (test_dir/SUCCESS.crc) failed: No such file or directory
$ ls -la test_dir
total 8
drwxr-xr-x  4 xxxx  xxxx  128 Jul 31 16:31 .
drwxr-xr-x  4 xxxx  xxxx  128 Jul 31 16:31 ..
-rw-r--r--  1 xxxx  xxxx    6 Jul 31 16:22 ._SUCCESS.crc
-rw-r--r--  1 xxxx  xxxx    0 Jul 31 16:31 SUCCESS.crc

Is there any way to suppress the belief that any given dot file is a resource fork?

For the curious, this is part of a sequence file export from HDFS.

Best Answer

A more refined search brought up:

using export COPYFILE_DISABLE=true before extracting the archive prevents the dotfile processing:

$ rm -r test_dir
$ export COPYFILE_DISABLE=true
$ tar xzf test_dir.tar.gz 
$ ll test_dir
total 8
drwxr-xr-x  3 xxxx  xxxx    96B Jul 31 16:47 .
drwxr-xr-x  4 xxxx  xxxx   128B Jul 31 16:47 ..
-rw-r--r--  1 xxxx  xxxx     6B Jul 31 16:22 ._SUCCESS.crc