Saturday 13 April 2019

mac - Weird bug in 'tar' not including files named .__init__.py


Does anyone know why tar is not including files named .__init__.py (note the dot)?


$ mkdir /tmp/work && cd /tmp/work
$ mkdir foo
$ touch foo/.__init__.py
$ touch foo/.namespace__init__.py
$ tar czf foo.tar.gz foo

$ mkdir e && mv foo.tar.gz e/ && cd e/
$ tar zxf foo.tar.gz
$ ls -al foo/
total 0
drwxr-xr-x 2 sridharr wheel 102 14 Mar 17:16 .
drwxr-xr-x 3 sridharr wheel 136 14 Mar 17:17 ..
-rw-r--r-- 1 sridharr wheel 0 14 Mar 17:16 .namespace__init__.py
$

$ echo ".__init__.py file is missing. WTF? This is OSX 10.6"

Update: tar appears to be ignoring files starting with ._ characters; why?


Update 2: I cannot reproduce this on Linux.



Answer



Found the solution. On Apple systems, files starting with ._ contains resource fork of another file. They are not normal files that can be copied and moved around.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...