无法解压 6 GB 的文件:zip 文件偏移错误

无法解压 6 GB 的文件:zip 文件偏移错误

我需要解压一个大约 6 GB 的文件。但是,我无法通过右键单击(它显示错误“清空存档”)或在终端中执行此操作,后者显示以下内容:

$ ls
 fhs-3.0.pdf   IDrive   Tese.zip  'Transport Studies of Dual-Gated ABC and ABA Trilayer Graphene: Band Gap Opening and Band Structure Tuning in Very Large Perpendicular Electric Fields - Zou.pdf'

$ unzip Tese.zip
Archive:  Tese.zip
warning [Tese.zip]:  4294967296 extra bytes at beginning or within zipfile
  (attempting to process anyway)
file #1:  bad zipfile offset (local header sig):  4294967296
  (attempting to re-compensate)
 extracting: Tese/.DS_Store          
error: not enough memory for bomb detection

$ jar xvf Tese.zip
java.util.zip.ZipException: only DEFLATED entries can have EXT descriptor
    at java.base/java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:313)
    at java.base/java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:125)
    at jdk.jartool/sun.tools.jar.Main.extract(Main.java:1361)
    at jdk.jartool/sun.tools.jar.Main.run(Main.java:409)
    at jdk.jartool/sun.tools.jar.Main.main(Main.java:1681)

我不认为该文件已损坏,因为我最近在 Mac 中解压了同一个文件。

我的电脑有 15 GB 的 RAM 和 2 GB 的交换内存。

答案1

zipJava 仅支持 ZIP 格式的文件,不支持 ZIP64。简单命令也是如此

Zip 文件的大小限制为 4GB 减 1 字节,Zip64 的大小限制为 16EB 减 1 字节。当大小超过支持值时,MacOS 会生成 zip64 文件。您的桌面环境提供的工具可能具有相同的限制

您需要适当的工具来读取 zip64 文件。在命令行上ditto可以读取这些文件,而在 Java 上,你可以使用Apache Commons 压缩

答案2

unzip和这两个工具都jar明确告诉您该文件已损坏:

miguel@...$ unzip Tese.zip
...
warning [Tese.zip]:  4294967296 extra bytes at beginning or within zipfile
  (attempting to process anyway)
file #1:  bad zipfile offset (local header sig):  4294967296
  (attempting to re-compensate)
miguel@...$ jar xvf Tese.zip
java.util.zip.ZipException: only DEFLATED entries can have EXT 
...

如果您可以在 Mac 上解压缩它,则可能是某些 Mac 软件创建了该 ZIP 文件,但可能是非标准格式(就 ZIP 文件标准化而言),只有某些 Mac 软件可以理解。

您可以尝试再次转到该 Mac,在那里将其解压缩,然后从中创建一个压缩的 tar 文件,然后将该 tar 文件带到您的 PC 并将其解压。

答案3

你可以通过运行并检查是否存在来测试你的副本是否unzip支持 zip64 扩展(以及大于 4G 的存档)。下面是我在 Ubuntu 设置中得到的结果。注意它确实有unzip -vZIP64_SUPPORTZIP64_SUPPORT

如果unzip没有 显示ZIP64_SUPPORT,则需要较新版本的unzip

或者,如果您unzip确实遇到了ZIP64_SUPPORT问题,那么问题可能出在其他方面。您能分享有关如何创建 zip 文件的详细信息吗?该 zip 文件是否在任何地方公开提供?

$ unzip -v
$ unzip -v
UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;
see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with gcc 9.2.0 for Unix (Linux ELF).

UnZip special compilation options:
        ACORN_FTYPE_NFS
        COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)
        SET_DIR_ATTRIB
        SYMLINKS (symbolic links supported, if RTL and file system permit)
        TIMESTAMP
        UNIXBACKUP
        USE_EF_UT_TIME
        USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)
        USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
        UNICODE_SUPPORT [wide-chars, char coding: UTF-8] (handle UTF-8 paths)
        LARGE_FILE_SUPPORT (large files over 2 GiB supported)
        ZIP64_SUPPORT (archives using Zip64 for large files supported)
        USE_BZIP2 (PKZIP 4.6+, using bzip2 lib version 1.0.8, 13-Jul-2019)
        VMS_TEXT_CONV
        WILD_STOP_AT_DIR
        [decryption, version 2.11 of 05 Jan 2007]

UnZip and ZipInfo environment options:
           UNZIP:  [none]
        UNZIPOPT:  [none]
         ZIPINFO:  [none]
      ZIPINFOOPT:  [none]

相关内容