解压缩文件时出现额外字节错误

rai*_*r11 42 zip

当我输入时unzip ../founation-latest.zip,它输出:

警告 [../foundation-latest.zip]:开头或 zipfile 中的 248 个额外字节(无论如何都在尝试处理)

该文件为 138KB。它可以正确解压缩,但为什么会出现此错误?

小智 46

我的问题是因为我试图在无法处理用 PKZIP 压缩的东西的 MAC OSX 上使用“解压缩”。

我能够brew install p7zip使用命令解压缩7za x some_file.zip

我最初在这篇文章中找到了解决方案:need-pk-compat-v4-5-can-do-v2-1

  • 我从 microsoft.com 下载了一个 Windows VM,这是解压的解决方案。 (4认同)
  • 还值得一提的是,它的速度要快一些,并且显示了进度。 (2认同)

slm*_*slm 36

我发现这个线程有类似的问题。错误报告的标题是:在 5.4GB ZIP 上解压缩失败,并带有“在 zipfile 开头或内部的额外字节”。建议的修复方法之一是在.zip文件上使用此命令。

$ zip -FFv foo.zip --out fixed.zip
Run Code Online (Sandbox Code Playgroud)

示例运行

$ zip -FFv foo.zip --out fixed.zip
Fix archive (-FF) - salvage what can
 Found end record (EOCDR) - says expect single disk archive
Scanning for entries...
 Local ( 1      0): copying: d1/f1   (651734 bytes)
 Local ( 1 651817): copying: d1/d2/  (0 bytes)
 Local ( 1 651905): copying: d1/d2/f3   (80 bytes)
 Local ( 1 652083): copying: d1/f23   (891 bytes)
 Local ( 1 653021): copying: d1/f27   (8764 bytes)
 Local ( 1 661837): copying: d1/f24   (14818 bytes)
 Local ( 1 676709): copying: d1/f25   (17295 bytes)
...
 Cen   ( 1 5488799949): updating: d1/f13
 Cen   ( 1 5488800052): updating: d1/f14
Zip64 EOCDR found ( 1 5488800155)...
Zip64 EOCDL found ( 1 5488800211)...
EOCDR found ( 1 5488800231)...
$ echo $?
0
Run Code Online (Sandbox Code Playgroud)

zip 的 -FF 开关

摘自 zip 手册页

       -FF
       --fixfix
              Fix the zip archive. The -F option can be used if some 
              portions of the archive are missing, but requires a reasonably 
              intact central directory.   The  input  archive is scanned as 
              usual, but zip will ignore some problems.  The resulting 
              archive should be valid, but any inconsistent entries will be 
              left out.

              When doubled as in -FF, the archive is scanned from the 
              beginning and zip scans  for  special  signatures  to  
              identify  the  limits between the archive members. The single 
              -F is more reliable if the archive is not too much damaged, so 
              try this option first.

              If  the archive is too damaged or the end has been truncated, 
              you must use -FF.  This is a change from zip 2.32, where the 
              -F option is able to read a truncated archive.  The -F option 
              now more reliably fixes archives with minor damage and the -FF 
              option is  needed to fix archives where -F might have been 
              sufficient before.
              ...
Run Code Online (Sandbox Code Playgroud)

  • Windows 10 可以生成 Info-ZIP `unzip` 命令无法正确读取的大型(大于 4GB?) ZIP 文件。(看起来 Debian bug #661956 从未得到解决。)正如上面的答案所暗示的,您可以使用 `-FF` 将文件解开为 `unzip` 可以读取的文件,或者您可以放弃并使用 7- Zip `7z` 程序可以直接读取该文件。 (3认同)

小智 5

也刚收到这个警告。在我的情况下,它是由使用“curl -i”下载它引起的,这导致 http-headers 出现在 zip 文件的开头。傻我。当然,这不会是所有情况下的原因/解决方案,但也许它可以帮助某人......


Ric*_*cky 3

它可能是自解压存档(windows .exe)或由于某种原因已被填充。