Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-30713

Remove the assignment to the ZIP "extra" field to produce correct ZIP

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.10
    • Fix Version/s: 10.10-HF56, 2021.13
    • Component/s: Core IO
    • Release Notes Summary:
      The extra field setting can now be disabled when doing Nuxeo IO ZIP export.
    • Backlog priority:
      800
    • Upgrade notes:
      Hide

      You can now disable the extra field setting when doing Nuxeo IO export by contributing the following:

        <extension target="org.nuxeo.runtime.ConfigurationService" point="configuration">
          <property name="nuxeo.core.io.archive.extra.files.count">false</property>
        </extension>
      

      This could be interesting if you want to open the produced archive with external tools such as Archive Utility.app.

      This property has true as default as disabling this behavior may impact performance when re-importing to Nuxeo the archive.

      Show
      You can now disable the extra field setting when doing Nuxeo IO export by contributing the following: <extension target= "org.nuxeo.runtime.ConfigurationService" point= "configuration" > <property name= "nuxeo.core.io.archive.extra.files.count" > false </property> </extension> This could be interesting if you want to open the produced archive with external tools such as Archive Utility.app. This property has true as default as disabling this behavior may impact performance when re-importing to Nuxeo the archive.
    • Sprint:
      nxplatform #50
    • Story Points:
      3

      Description

      The error message comes from libarchive (an internal dependency of Archive Utility.app) when reading ZIP's "extra" field: https://github.com/libarchive/libarchive/blob/5bb998d869979140156bce59c0ff8f9063a25581/libarchive/archive_read_support_format_zip.c#L528

      This is due to Nuxeo code attempting to use the "extra" field of ZIP entries for directories as a count of the number of children. The ZIP "extra" entry is under-specified in the ZIP format, Nuxeo uses it as a 4-byte big endian count. libarchive seems to use it as a 2-byte id + 2-byte length (little endian) + payload. Thus the error.

      This storing of the count of children is a functionality needed only in "streaming" ZIP reading, to avoid reading too many ZIP entries beyond the children of the current folder, which avoids buffering. The "streaming" ZIP reading doesn't seem used currently in the Nuxeo codebase except for our "apidoc" plugin.

      It's likely that just removing the assignment to the ZIP "extra" field will produce correct ZIP files. Code is at https://github.com/nuxeo/nuxeo/blob/a105ee2a16cc0aac7cb4c2264e2919a235c15d71/nuxeo-core/nuxeo-core-io/src/main/java/org/nuxeo/ecm/core/io/impl/plugins/NuxeoArchiveWriter.java#L124

      FYI using zipdetails to dump the file gives:

      ...
      
      00003E LOCAL HEADER #2       04034B50
      000042 Extract Zip Spec      14 '2.0'
      000043 Extract OS            00 'MS-DOS'
      000044 General Purpose Flag  0808
             [Bits 1-2]            0 'Normal Compression'
             [Bit  3]              1 'Streamed'
             [Bit 11]              1 'Language Encoding'
      000046 Compression Method    0008 'Deflated'
      000048 Last Mod Time         52CB8D39 'Fri Jun 11 17:41:50 2021'
      00004C CRC                   00000000
      000050 Compressed Length     00000000
      000054 Uncompressed Length   00000000
      000058 Filename Length       0009
      00005A Extra Length          0004
      00005C Filename              'vehicles/'
      000065 Extra ID #0001        0000 ''
      000067   Length              0100
      000069 PAYLOAD               ..
      
      ...
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: