[GitHub] [tomcat-jakartaee-migration] ebourg commented on issue #46: "java.util.zip.ZipException: invalid CEN header (bad signature)" when opening migrated jar with `java.util.zip.ZipFile`

2023-04-18 Thread via GitHub


ebourg commented on issue #46:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/46#issuecomment-1513306019

   My test was flawed, removing the zip64 field has no effect actually :(


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] [tomcat-jakartaee-migration] ebourg commented on issue #46: "java.util.zip.ZipException: invalid CEN header (bad signature)" when opening migrated jar with `java.util.zip.ZipFile`

2023-04-18 Thread via GitHub


ebourg commented on issue #46:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/46#issuecomment-1513245658

   In `Migration.migrateArchiveStreaming()`, if the zip64 field is removed with 
`destZipEntry.removeExtraField(new ZipShort(0x0001));` the file generated 
becomes parseable by ZipInputStream. And curiously, commons-compress still sees 
a zip64 extra field.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] [tomcat-jakartaee-migration] ebourg commented on issue #46: "java.util.zip.ZipException: invalid CEN header (bad signature)" when opening migrated jar with `java.util.zip.ZipFile`

2023-04-18 Thread via GitHub


ebourg commented on issue #46:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/46#issuecomment-1513198356

   Something weird I noticed, commons-compress thinks the entries of the 
original jar have the zip64 field (`ZipArchiveOutputStream.hasZip64Extra()` 
returns true), and the field is copied to the output jar. But diffoscope 
doesn't see the extra field on the original jar. I haven't traced back the 
commons-compress code to understand why.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] [tomcat-jakartaee-migration] ebourg commented on issue #46: "java.util.zip.ZipException: invalid CEN header (bad signature)" when opening migrated jar with `java.util.zip.ZipFile`

2023-04-18 Thread via GitHub


ebourg commented on issue #46:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/46#issuecomment-1513182991

   If that helps, this is the difference between the two jar files for the 
first entry (as seen by diffoscope):
   
   ```
   ¦  End-of-central-directory record:
   ¦  ---
   ¦
   ¦ -  Zip archive file size:   3406225 (0033F991h)
   ¦ -  Actual end-cent-dir record offset:   3406203 (0033F97Bh)
   ¦ -  Expected end-cent-dir record offset: 3406203 (0033F97Bh)
   ¦ +  Zip archive file size:   3450535 (0034A6A7h)
   ¦ +  Actual end-cent-dir record offset:   3450437 (0034A645h)
   ¦ +  Expected end-cent-dir record offset: 3450437 (0034A645h)
   ¦(based on the length of the central directory and its expected offset)
   ¦
   ¦This zipfile constitutes the sole disk of a single-part archive; its
   ¦central directory contains 1580 entries.
   ¦ -  The central directory is 158714 (00026BFAh) bytes long,
   ¦ +  The central directory is 165034 (000284AAh) bytes long,
   ¦and its (expected) offset in bytes from the beginning of the zipfile
   ¦ -  is 3247489 (00318D81h).
   ¦ +  is 3285403 (0032219Bh).
   ¦
   ¦
   ¦  Central directory entry #1:
   ¦  ---
   ¦
   ¦
META-INF/native-image/org.apache.tomcat.embed/tomcat-embed-core/native-image.properties
   ¦
   ¦offset of local header from start of archive:   0
   ¦(h) 
bytes
   ¦ -  file system or operating system of origin:  Unix
   ¦ -  version of encoding software:   2.0
   ¦ +  file system or operating system of origin:  MS-DOS, OS/2 or NT FAT
   ¦ +  version of encoding software:   4.5
   ¦minimum file system compatibility required: MS-DOS, OS/2 or NT FAT
   ¦ -  minimum software version required to extract:   1.0
   ¦ +  minimum software version required to extract:   4.5
   ¦compression method: deflated
   ¦compression sub-type (deflation):   normal
   ¦file security status:   not encrypted
   ¦ -  extended local header:  no
   ¦ +  extended local header:  yes
   ¦file last modified on (DOS date/time):  2023 Feb 27 20:25:28
   ¦32-bit CRC value (hex): 02f543c3
   ¦compressed size:514 bytes
   ¦uncompressed size:  913 bytes
   ¦length of filename: 87 characters
   ¦ -  length of extra field:  0 bytes
   ¦ +  length of extra field:  4 bytes
   ¦length of file comment: 0 characters
   ¦disk number on which file begins:   disk 1
   ¦apparent file type: binary
   ¦ -  Unix file attributes (100644 octal):-rw-r--r--
   ¦ +  non-MSDOS external file attributes: 00 hex
   ¦MS-DOS file attributes (00 hex):none
   ¦
   ¦ +  The central-directory extra field contains:
   ¦ +  - A subfield with ID 0x0001 (PKWARE 64-bit sizes) and 0 data bytes.
   ¦ +
   ¦There is no file comment.
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] [tomcat-jakartaee-migration] ebourg commented on issue #46: "java.util.zip.ZipException: invalid CEN header (bad signature)" when opening migrated jar with `java.util.zip.ZipFile`

2023-04-18 Thread via GitHub


ebourg commented on issue #46:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/46#issuecomment-1513023104

   The file is unreadable using a ZipInputStream with OpenJDK 11.0.18 and 
17.0.6 (tested with ZuluJDK on Windows). Are you sure it works with Java 11?
   
   I agree this is a JDK bug and we could ignore it if this was fixed in a 
recent JDK. But until a fix is available the tool is altering a working jar 
such that no JRE can use it, so I think the burden is upon us to find a 
solution. At least, if the conditions leading to this issue can be identified, 
the tool could stop and display a warning, suggesting to use `-zipInMemory`.
   
   I won't reopen the issue because I don't have the time to investigate 
further, but if someone is willing to contribute a fix I'll certainly review it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] [tomcat-jakartaee-migration] ebourg commented on issue #46: "java.util.zip.ZipException: invalid CEN header (bad signature)" when opening migrated jar with `java.util.zip.ZipFile`

2023-04-18 Thread via GitHub


ebourg commented on issue #46:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/46#issuecomment-1512841690

   I think that was for performance. Maybe we should make it the default when 
processing jar files.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] [tomcat-jakartaee-migration] ebourg commented on issue #46: "java.util.zip.ZipException: invalid CEN header (bad signature)" when opening migrated jar with `java.util.zip.ZipFile`

2023-04-17 Thread via GitHub


ebourg commented on issue #46:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/46#issuecomment-1511775702

   I tried disabling the zip64 mode and the migration fails with:
   
   ```
   Exception in thread "main" 
org.apache.tomcat.jakartaee.commons.compress.archivers.zip.Zip64RequiredException:
 Archive's size exceeds the limit of 4GByte.
   at 
org.apache.tomcat.jakartaee.commons.compress.archivers.zip.ZipArchiveOutputStream.createCentralFileHeader(ZipArchiveOutputStream.java:766)
   at 
org.apache.tomcat.jakartaee.commons.compress.archivers.zip.ZipArchiveOutputStream.writeCentralDirectoryInChunks(ZipArchiveOutputStream.java:1792)
   at 
org.apache.tomcat.jakartaee.commons.compress.archivers.zip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:1031)
   at 
org.apache.tomcat.jakartaee.commons.compress.archivers.zip.ZipArchiveOutputStream.close(ZipArchiveOutputStream.java:633)
   at 
org.apache.tomcat.jakartaee.Migration.migrateArchiveStreaming(Migration.java:323)
   at 
org.apache.tomcat.jakartaee.Migration.migrateStream(Migration.java:383)
   at 
org.apache.tomcat.jakartaee.Migration.migrateFile(Migration.java:274)
   at org.apache.tomcat.jakartaee.Migration.execute(Migration.java:241)
   at 
org.apache.tomcat.jakartaee.MigrationCLI.main(MigrationCLI.java:107)
   ```
   
   It smells like a bug in commons-compress.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] [tomcat-jakartaee-migration] ebourg commented on issue #46: "java.util.zip.ZipException: invalid CEN header (bad signature)" when opening migrated jar with `java.util.zip.ZipFile`

2023-04-17 Thread via GitHub


ebourg commented on issue #46:
URL: 
https://github.com/apache/tomcat-jakartaee-migration/issues/46#issuecomment-1511773166

   I have been able to reproduce the issue. Even if Tomcat 10.1 doesn't need to 
be migrated the use of a zip64 entry is questionable. The same issue could 
affect another jar unrelated to Tomcat.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org