[ 
https://issues.apache.org/jira/browse/MSHADE-417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17515338#comment-17515338
 ] 

Michael Osipov commented on MSHADE-417:
---------------------------------------

I can confirm this even with 3.3.1-SNAPSHOT:
{noformat}
$ ~/.local/bin/diffoscope original-shadetest-0.0.0.jar shadetest-0.0.0.jar
--- original-shadetest-0.0.0.jar
+++ shadetest-0.0.0.jar
├── zipinfo {}
│ @@ -1,10 +1,10 @@
│ -Zip file size: 1580 bytes, number of entries: 8
│ -drwxr-xr-x  2.0 unx        0 b- stor 22-Mar-31 22:30 META-INF/
│ --rw-r--r--  2.0 unx      126 b- defN 22-Mar-31 22:30 META-INF/MANIFEST.MF
│ --rw-r--r--  2.0 unx        1 b- defN 22-Mar-31 22:30 test.txt
│ -?rwsrwsrwt  2.0 unx        0 b- stor 22-Mar-31 22:30 META-INF/maven/
│ -?rwsrwsrwt  2.0 unx        0 b- stor 22-Mar-31 22:30 
META-INF/maven/shadetest/
│ -?rwsrwsrwt  2.0 unx        0 b- stor 22-Mar-31 22:30 
META-INF/maven/shadetest/shadetest/
│ --rw-r--r--  2.0 unx      979 b- defN 22-Mar-31 22:29 
META-INF/maven/shadetest/shadetest/pom.xml
│ --rw-r--r--  2.0 unx      104 b- defN 22-Mar-31 22:30 
META-INF/maven/shadetest/shadetest/pom.properties
│ -8 files, 1210 bytes uncompressed, 544 bytes compressed:  55.0%
│ +Zip file size: 1727 bytes, number of entries: 8
│ +-rw----     2.0 fat        0 bX defN 22-Mar-31 22:30 META-INF/
│ +-rw----     2.0 fat      126 bl defN 22-Mar-31 22:30 META-INF/MANIFEST.MF
│ +-rw----     2.0 fat        4 bl defN 22-Mar-31 22:30 test.txt
│ +-rw----     2.0 fat        0 bl defN 22-Mar-31 22:29 META-INF/maven/
│ +-rw----     2.0 fat        0 bl defN 22-Mar-31 22:29 
META-INF/maven/shadetest/
│ +-rw----     2.0 fat        0 bl defN 22-Mar-31 22:29 
META-INF/maven/shadetest/shadetest/
│ +-rw----     2.0 fat      979 bl defN 22-Mar-31 22:29 
META-INF/maven/shadetest/shadetest/pom.xml
│ +-rw----     2.0 fat      104 bl defN 22-Mar-31 22:30 
META-INF/maven/shadetest/shadetest/pom.properties
│ +8 files, 1213 bytes uncompressed, 555 bytes compressed:  54.2%
├── filetype from file(1)
│ @@ -1 +1 @@
│ -Zip archive data, at least v1.0 to extract, compression method=store
│ +Java archive data (JAR)
├── test.txt
│ @@ -1 +1 @@
│ -00000000: 61                                       a
│ +00000000: 6100 0000                                a...
{noformat}

The new zip file is logically different, regardless of your wrenched text file. 
That is UGLY. Let me have a deeper look into that.


> 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, test.txt
>
>
> 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)

Reply via email to