tags:

views:

294

answers:

5

I'm extracting a folder from a tarball, and I see these zero-byte files showing up in the result (where they are not in the source.) Setup (all on OS X):

On machine one, I have a directory /My/Stuff/Goes/Here/ containing several hundred files. I build it like this

tar -cZf mystuff.tgz /My/Stuff/Goes/Here/

On machine two, I scp the tgz file to my local directory, then unpack it.

tar -xZf mystuff.tgz

It creates ~scott/My/Stuff/Goes/, but then under Goes, I see two files:

Here/ - a directory,  
Here.bGd - a zero byte file.

The "Here.bGd" zero-byte file has a random 3-character suffix, mixed upper and lower-case characters. It has the same name as the lowest-level directory mentioned in the tar-creation command. It only appears at the lowest level directory named. Anybody know where these come from, and how I can adjust my tar creation to get rid of them?

Update: I checked the table of contents on the files using tar tZvf: toc does not list the zero-byte files, so I'm leaning toward the suggestion that the uncompress machine is at fault. OS X is version 10.5.5 on the unzip machine (not sure how to check the filesystem type). Tar is GNU tar 1.15.1, and it came with the machine.

A: 

I don't know (and boy is this a hard problem to Google for!), but here's a troubleshooting step: try tar without Z. That will determine whether compress or tar is causing the issue.

Rich
+1  A: 

You can get a table of contents from the tarball by doing

tar tZvf mystuff.tgz

If those zero-byte files are listed in the table of contents, then the problem is on the computer making the tarball. If they aren't listed, then the problem is on the computer decompressing the tarball.

Adam Rosenfield
A: 

I can't replicate this on my 10.5.5 system.

So, for each system:

  1. what version of OSX are you using?
  2. what filesystem is in use?
Alnitak
A: 

I have not seen this particular problem before with tar. However, there is another problem where tar bundles metadata files with regular files (they have the same name but are prefixed with "._"). The solution to this was to set the environment variable COPYFILE_DISABLE=y. If those weird files you have are more metadata files, maybe this would solve your problem as well?

Failing that, you could try installing a different version of tar.

Jay Conrod
A: 

On my MacOS X (10.4.11) machine, I sometimes acquire files .DS_Store in a directory (but these are not empty files), and I've seen other hidden file names on memory sticks that have been used on the Mac. These are somehow related to the Mac file system. I'd guess that what you are seeing are related to one or the other of these sets of files. Original Macs (MacOS 9 and earlier) had data forks and resource forks for files.

A little bit of play shows that a directory in which I've never used Finder has no .DS_Store file; if I use the Finder to navigate to that directory, the .DS_Store file appears. It presumably contains information about how the files should appear in the Finder display (so if you move files around, they stay where you put them).

This doesn't directly answer your question; I hope it gives some pointers.

Jonathan Leffler