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