当我试图在我的OpenBSD上构建源代码时,我在解压文件时遇到了问题--首先我认为它只是被破坏了的文件,但在它发生在许多不同的程序和不同的下载方法(curl -O
、FTP、Windows下载和通过WinSCP传输)之后,甚至是同一个程序的不同文件(.xz
、.bz2
、.lz
)之后,我开始相信我一定做错了什么。我在使用时遇到的错误
tar xzvf file
是
gzip: stdin: unrecognized file format
tar: End of archive volume 1 reached
tar: Sorry, unable to determine archive format.
它发生在不同的程序,不同的下载方法,甚至不同的文件,这使我疯狂。
我现在无法解压缩的文件示例:gnutls-3.4.3.tar.xz
和gmp-6.0.0a.tar.bz2
通过Windows下载并通过WinSCP二进制模式传输。
ls -L
输出:
-rw-r--r-- 1 root wheel 6546268 Jul 12 09:18 gnutls-3.4.3.tar.xz
-rw-r--r-- 1 root wheel 2319400 Jul 24 2015 gmp-6.0.0a.tar.bz2
od -x
输出:
od -x gnutls-3.4.3.tar.xz | head -10
0000000 37fd 587a 005a 0400 d6e6 46b4 0002 0121
0000020 0016 0000 2f74 a3e5 00e8 f06d 5d02 3300
0000040 8b9b 1912 a356 72d2 a129 5502 49fb f64d
0000060 c492 64da be73 7fde 4d79 9170 c055 27b9
0000100 8fc9 6caa 3f02 b551 e014 fd24 a2ad c57d
0000120 ce49 59f3 da73 0ee9 0319 b7ea c55c 5e2e
0000140 8fd8 7af6 4f97 b1a8 1ac9 d553 a703 1f1d
0000160 b226 682e 3e00 d2bc a0f8 4b57 13d0 f887
0000200 7f84 c83f 94cd 154b 1dfe 37cd 25db 13d9
0000220 cdcd 5861 6558 acc3 0103 21ed e8d9 979d
我的tar似乎甚至不认为J
是一种选择:
tar xJvf gmp-5.1.3.tar.xz
tar: unknown option J
和从第二个命令输出的错误:
tar xjvf gmp-6.0.0a.tar.bz2
tar: could not exec bzip2: No such file or directory
tar: End of archive volume 1 reached
tar: Sorry, unable to determine archive format.
更有用的错误输出:
tar xvf gnutls-3.4.3.tar.xz
tar: Cannot identify format. Searching...
tar: Cpio file name length 36039 is out of range
tar: Invalid header, starting valid header search.
tar: Cpio file name length 63118 is out of range
tar: Cpio file name length 38744 is out of range
<suppressed similar errors>
tar: Cpio file name in header is corrupted
tar: Cpio file name length 46161 is out of range
tar: Cpio file name length 32085 is out of range
<suppressed similar errors>
tar: Cpio file name in header is corrupted
<more suppressed similar errors>
tar: End of archive volume 1 reached
发布于 2015-07-24 21:15:43
z
选项告诉tar
使用gunzip
(或其内部等效的)解压缩存档,并且只适用于gzip
-compressed归档,通常带有.tar.gz
扩展。
要使用其他压缩格式解压缩存档,可以尝试
tar xvf file
看看您的tar
是否足够聪明,能够自己解决问题。如果不是,您可以告诉它使用什么解压缩工具,也可以解压缩和管道归档:
.tar.bz2
:tar xjvf file
或bunzip2 -c file | tar xvf -
.tar.xz
:tar xJvf file
或xzcat file | tar xvf -
.tar.lz
:tar xjf file --lzip
或lunzip -c file | tar xvf -
使用您正在使用的文件:
tar xJvf gnutls-3.4.3.tar.xz
tar xjvf gmp-6.0.0a.tar.bz2
或者显然是和OpenBSD tar
在一起:
xzcat gnutls-3.4.3.tar.xz | tar xvf -
bunzip2 -c gmp-6.0.0a.tar.bz2 | tar xvf -
您需要确保安装了xz
和bunzip2
;bunzip2
可能与bzip2
一起打包。
https://unix.stackexchange.com/questions/218230
复制相似问题