[
https://issues.apache.org/jira/browse/MSHADE-417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17515201#comment-17515201
]
Max Zerzouri commented on MSHADE-417:
-------------------------------------
Sure. I've uploaded those files now.
Not familiar with {{zipdetails}}, but here's what it shows for the {{test.txt}}
entry:
{code}
04E7 CENTRAL HEADER #3 02014B50
04EB Created Zip Spec 14 '2.0'
04EC Created OS 00 'MS-DOS'
04ED Extract Zip Spec 14 '2.0'
04EE Extract OS 00 'MS-DOS'
04EF General Purpose Flag 0808
[Bits 1-2] 0 'Normal Compression'
[Bit 3] 1 'Streamed'
[Bit 11] 1 'Language Encoding'
04F1 Compression Method 0008 'Deflated'
04F3 Last Mod Time 547FB3CA 'Thu Mar 31 22:30:20 2022'
04F7 CRC A2DE4F7A
04FB Compressed Length 00000006
04FF Uncompressed Length 00000004
0503 Filename Length 0008
0505 Extra Length 0000
0507 Comment Length 0000
0509 Disk Start 0000
050B Int File Attributes 0000
[Bit 0] 0 'Binary Data'
050D Ext File Attributes 00000000
0511 Local Header Offset 000000E8
0515 Filename 'test.txt'
{code}
The regular zip handling used by the normal classloader in OpenJDK also sees
the zero bytes, which is how we noticed the issue (because we had some small
JSON files in the classpath containing just the string {{{}}}, which failed to
parse due to trailing zero bytes).
> Nul bytes appended to small files by maven-shade-plugin
> -------------------------------------------------------
>
> Key: MSHADE-417
> URL: https://issues.apache.org/jira/browse/MSHADE-417
> Project: Maven Shade Plugin
> Issue Type: Bug
> Affects Versions: 3.3.0
> Reporter: Max Zerzouri
> Priority: Major
> Attachments: original-shadetest-0.0.0.jar, pom.xml,
> shadetest-0.0.0.jar
>
>
> Version 3.3.0 of maven shade plugin seems to append "\x00" bytes to a file if
> it's less than 4 bytes:
> {code:sh}
> $ echo -n a > src/main/resources/test.txt
> $ mvn clean install
> ...
> $ bsdtar -xOf target/original-shadetest-0.0.0.jar test.txt | xxd
> 00000000: 61 a
> $ bsdtar -xOf target/shadetest-0.0.0.jar test.txt | xxd
> 00000000: 6100 0000 a...
> {code}
> I've attached a basic {{pom.xml}} that triggers this.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)