17

运行后,make distcheck我收到消息说我已成功构建包并准备好分发。如果我解压它tar.gztar -zxvf hello-0.2.tar.gz它会成功提取其所有内容。但是,当我尝试在不同的机器中提取它们时,我得到:

tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors

奇怪的是它以前工作过。

在我试图构建包的机器上,我已经更新了我automake 1.10.1, autoconf 2.61, and tar 1.20 to automake 1.11.1, autoconf 2.65, and tar 1.23的问题,但仍然是同样的问题。

任何想法可能是什么问题?

4

2 回答 2

17

The problem is not on the build machine; the problem is on the target machines.

Not all versions of tar automatically recognize the decompression to apply to a compressed tar file. Given that gunzip followed by tar does work, then the tar on your target machine is one such. The versions of tar on the mainstream Unix systems (AIX, HP-UX, Solaris) do not recognize compressed tar files automatically. Those on Linux and MacOS X do.

Note that you can use:

gzip -dc hello-0.2.tar.gz | tar -xf -

to avoid creating the intermediate uncompressed file.

于 2012-01-10T07:40:49.613 回答
5

实际上,当您下载的服务器应用另一轮 GZip 并且您用于下载文件的客户端不读取/尊重 HTTPContent-Encoding标头并将 HTTP 有效负载存储在网络上时,可能会发生这种情况。

尽管该文件似乎只有扩展名.tar.gz,但实际上是.tar.gz.gz. 在您运行gunzip一次文件仅获取扩展名.tar但这次仍然运行 tar 命令后,它会tar xf hello-0.2.tar识别 GZip 格式并在解压缩之前再通过 gunzip 隐式运行文件一次。

您可以通过运行head hello-02.tar.gz和检查这一点head hello-02.tar。GZip 是一种非常二进制的格式,而 tar 是人类可读的。如果 .tar 文件看起来“过于二进制”,则您手头上有一个双重编码的文件。

于 2013-01-15T23:54:42.053 回答