简体   繁体   English

从tarball提取的这些零散杂散文件是什么? (OSX)

[英]What are these stray zero-byte files extracted from tarball? (OSX)

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): 我正在从压缩包中提取一个文件夹,并且看到这些零字节文件显示在结果中(它们不在源文件中。)安装程序(全部在OS X上):

On machine one, I have a directory /My/Stuff/Goes/Here/ containing several hundred files. 在第一台机器上,我有一个目录/ My / Stuff / Goes / Here /,其中包含数百个文件。 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. 在第二台计算机上,我将tgz文件压缩到本地目录,然后将其解压缩。

tar -xZf mystuff.tgz

It creates ~scott/My/Stuff/Goes/, but then under Goes, I see two files: 它创建〜scott / My / Stuff / Goes /,但是在Goes下,我看到两个文件:

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. 零字节的“ Here.bGd”文件具有一个随机的3个字符的后缀,大小写混合。 It has the same name as the lowest-level directory mentioned in the tar-creation command. 它具有与tar-creation命令中提到的最低级别目录相同的名称。 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. 更新:我使用tar tZvf检查了文件的目录:toc没有列出零字节文件,因此我倾向于解压缩机器有问题的建议。 OS X is version 10.5.5 on the unzip machine (not sure how to check the filesystem type). OS X是解压缩计算机上的10.5.5版(不确定如何检查文件系统类型)。 Tar is GNU tar 1.15.1, and it came with the machine. Tar是GNU tar 1.15.1,它随计算机一起提供。

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. 如果未列出它们,则问题出在计算机上解压缩tarball。

I can't replicate this on my 10.5.5 system. 我无法在10.5.5系统上复制它。

So, for each system: 因此,对于每个系统:

  1. what version of OSX are you using? 您正在使用哪个版本的OSX?
  2. what filesystem is in use? 正在使用什么文件系统?

I have not seen this particular problem before with tar. 我以前从未用tar看到过这个特殊问题。 However, there is another problem where tar bundles metadata files with regular files (they have the same name but are prefixed with "._"). 但是,另一个问题是tar将元数据文件与常规文件捆绑在一起(它们具有相同的名称,但前缀为“ ._”)。 The solution to this was to set the environment variable COPYFILE_DISABLE=y . 解决方案是设置环境变量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. 失败的话,您可以尝试安装其他版本的tar。

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. 在我的MacOS X(10.4.11)计算机上,有时会在目录中获取文件.DS_Store(但这些文件不是空文件),并且在Mac上使用的记忆棒上还看到了其他隐藏文件名。 These are somehow related to the Mac file system. 这些与Mac文件系统有关。 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. 原始Mac(MacOS 9和更早的Mac)具有文件的数据叉和资源叉。

A little bit of play shows that a directory in which I've never used Finder has no .DS_Store file; 一点点玩法表明,我从未使用过Finder的目录中没有.DS_Store文件; if I use the Finder to navigate to that directory, the .DS_Store file appears. 如果我使用Finder导航到该目录,则会出现.DS_Store文件。 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). 它大概包含有关文件应如何在Finder显示屏中显示的信息(因此,如果您四处移动文件,它们将保留在放置位置)。

This doesn't directly answer your question; 这不会直接回答您的问题; I hope it gives some pointers. 我希望它能提供一些指示。

I don't know (and boy is this a hard problem to Google for!), but here's a troubleshooting step: try tar without Z . 我不知道(这对Google来说,这是一个很难的问题!),但这是一个故障排除步骤:尝试不带Z tar That will determine whether compress or tar is causing the issue. 这将确定是compress还是tar引起了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM