Menu

#2416 Cannot rename file in zip from pigz

open
nobody
None
5
2023-10-22
2023-10-21
Sam Tansy
No

It happened to me when I was testing something and wanted to quickly make zip with pigz.. File was named '-' and when I tried to rename it with 7zip it failed.
Here is a script that shows it:

$ echo aaaaaa > a
$ zip zip.zip a
$ 7z rn zip.zip a b
(...)
Updating archive: zip.zip

Items to compress: 0

Files read from disk: 0
Archive size: 158 bytes (1 KiB)
Everything is Ok

$ pigz -K -k a
$ mv a.zip pigz.zip
$ 7z rn pigz.zip a b

Updating archive: pigz.zip

Items to compress: 0

System ERROR:
E_NOTIMPL

As you can see zip file created with zip works, zip file created with pigz doesn't . What is even more surprising, test ($ 7z t pigz.zip) is ok.

It maybe a problem with pigz, maybe with 7zip. I don't know. They follow somewhat strange specs or something, for example zip.zip starts with 50 4B 03 04 │ 14, pigz.zip starts with 50 4B 03 04 │ 2D.

1 Attachments

Discussion

  • Igor Pavlov

    Igor Pavlov - 2023-10-22

    That zip archive uses descriptor (stream mode compression).
    7-Zip doesn't allow to rename such items by some reasons.
    Descptor case has no good specification in zip format.
    So diffirent ways to implement it are possible. And if we update such archive, we can broke zip archive, because we don't know what exact way was used to create discriptor records in archive.
    So 7-Zip just doesn't allow rename operations for descptor cases.

    7z l pigz.zip -slt
    Characteristics = UT:M:1 : Descriptor
    

    zip specification:

          4.3.9.3 Although not originally assigned a signature, the value 
          0x08074b50 has commonly been adopted as a signature value 
          for the data descriptor record.  Implementers SHOULD be 
          aware that ZIP files MAY be encountered with or without this 
          signature marking data descriptors and SHOULD account for
          either case when reading ZIP files to ensure compatibility.
    

    The problem in this specification statement: ZIP files MAY be encountered with or without this signature.

    So we don't know for 100% what exact size of descriptor record.
    We can try to detect size of descriptor record with additional code, but it's not safe for 100% still, and it was not implemented in 7-zip.

     

    Last edit: Igor Pavlov 2023-10-22
    • Sam Tansy

      Sam Tansy - 2023-10-22

      Understood.
      Not a bug then.

      Can be closed.

       

      Last edit: Sam Tansy 2023-11-07

Log in to post a comment.