bz2 文件和“这看起来不像 tar 存档”

sda*_*aau 3 linux tar archiving

我已经看到与此错误相关的其他问题(例如提取 tar.gz 文件返回,“这看起来不像 tar 存档。”),但我不确定如何将它们应用于我的问题:

首先,下载文件:

$ wget --no-check-certificate https://wxpython.org/Phoenix/tools/doxygen-1.8.8-linux.bz2
--2017-04-06 15:06:11--  https://wxpython.org/Phoenix/tools/doxygen-1.8.8-linux.bz2
Resolving wxpython.org (wxpython.org)... 85.234.150.54
Connecting to wxpython.org (wxpython.org)|85.234.150.54|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3961996 (3.8M) [application/x-bzip2]
Saving to: ‘doxygen-1.8.8-linux.bz2’

100%[==============================================================================>] 3,961,996    734KB/s   in 5.0s   

2017-04-06 15:06:16 (778 KB/s) - ‘doxygen-1.8.8-linux.bz2’ saved [3961996/3961996]
Run Code Online (Sandbox Code Playgroud)

然后,检查文件的文件类型:

$ wget --no-check-certificate https://wxpython.org/Phoenix/tools/doxygen-1.8.8-linux.bz2
--2017-04-06 15:06:11--  https://wxpython.org/Phoenix/tools/doxygen-1.8.8-linux.bz2
Resolving wxpython.org (wxpython.org)... 85.234.150.54
Connecting to wxpython.org (wxpython.org)|85.234.150.54|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3961996 (3.8M) [application/x-bzip2]
Saving to: ‘doxygen-1.8.8-linux.bz2’

100%[==============================================================================>] 3,961,996    734KB/s   in 5.0s   

2017-04-06 15:06:16 (778 KB/s) - ‘doxygen-1.8.8-linux.bz2’ saved [3961996/3961996]
Run Code Online (Sandbox Code Playgroud)

嗯,是“bzip2压缩数据”,我们解压一下吧:

$ file doxygen-1.8.8-linux.bz2 
doxygen-1.8.8-linux.bz2: bzip2 compressed data, block size = 900k
Run Code Online (Sandbox Code Playgroud)

我解压了一个空文件:

$ tar xjvf doxygen-1.8.8-linux.bz2
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Archive contains ‘\351\357\377I\211\304H\211’ where numeric mode_t value expected
tar: Archive contains ‘A\270\001\0\0\0H\211?\001’ where numeric time_t value expected
tar: Archive contains ‘\307\350\216v)\0I\307’ where numeric uid_t value expected
tar: Archive contains ‘\004$P\254|\0\2770’ where numeric gid_t value expected
@\2678\350\330\351\357\377\2778
tar: @\2678\350\330\351\357\377\2778: Unknown file type '', extracted as normal file
tar: @?8??????8: implausibly old time stamp 1970-01-01 00:59:59
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
Run Code Online (Sandbox Code Playgroud)

奇怪的是,如果我使用file-roller(Archive Manager) 并从 GUI 解压缩,我确实会解压缩一个文件:

$ ls -la @?8??????8 
-rwxrwxr-x 1 user user 0 Jan  1  1970 @?8??????8
Run Code Online (Sandbox Code Playgroud)

好的,那么这里发生了什么 - 为什么我不能从命令行解压缩它,以及如何使用命令行解压缩它?


编辑:实际上我可以用以下方法解压它:

$ bzip2 -d doxygen-1.8.8-linux.bz2 
$ file doxygen-1.8.8-linux 
doxygen-1.8.8-linux: ELF 64-bit LSB  executable, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0eccee11d38322d5df3a1723651c2f18303e1188, not stripped
Run Code Online (Sandbox Code Playgroud)

......所以剩下的唯一问题是 - 为什么我不能tar像以前那样使用它?

小智 23

tar只是将文件一起复制到一个大.tar文件而不进行压缩。bzip2, gzip,xz是单个文件的文件压缩器,即。tar文件。扩展名是.tar.gz, .tar.xz,.tar.bz2.tbz( 2) .txz,.tgz等。

tar只能处理.tar带有或不带有 bzip2、xz、gzip 压缩的文件。但不是非焦油.bz2.xz档案。

非 tar'ed bzip 文件可以用bzip2 -d file.bz2.