Skip to content

Commit 3692f81

Browse files
committed
[SHADE-420] create IT: 2 runs with different TZ give different jars
1 parent a5315de commit 3692f81

File tree

4 files changed

+382
-0
lines changed

4 files changed

+382
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
invoker.goals.1 = clean package -DfinalName=current-OS dependency:copy-dependencies
19+
20+
invoker.mavenOpts.2=-Duser.timezone=Etc/UTC
21+
invoker.goals.2 = package -DfinalName=UTC
22+
invoker.mavenOpts.3=-Duser.timezone=Asia/Tokyo
23+
invoker.goals.3 = package -DfinalName=Tokyo
24+
invoker.mavenOpts.4=-Duser.timezone=Canada/Yukon
25+
invoker.goals.4 = package -DfinalName=Yukon

src/it/projects/MSHADE-420/pom.xml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
-->
21+
22+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
23+
<modelVersion>4.0.0</modelVersion>
24+
25+
<groupId>org.apache.maven.its.shade.parallel</groupId>
26+
<artifactId>mshade420</artifactId>
27+
<version>1.0</version>
28+
29+
<name>MSHADE-420</name>
30+
<description>
31+
Some jar entries are timezone-sensitive.
32+
</description>
33+
34+
<dependencies>
35+
<dependency>
36+
<groupId>net.java.dev.jna</groupId>
37+
<artifactId>jna</artifactId>
38+
<version>5.13.0</version>
39+
</dependency>
40+
</dependencies>
41+
42+
<build>
43+
<plugins>
44+
<plugin>
45+
<groupId>org.apache.maven.plugins</groupId>
46+
<artifactId>maven-shade-plugin</artifactId>
47+
<version>@project.version@</version>
48+
<executions>
49+
<execution>
50+
<goals>
51+
<goal>shade</goal>
52+
</goals>
53+
<configuration>
54+
<finalName>${finalName}</finalName>
55+
<filters>
56+
<filter>
57+
<artifact>net.java.dev.jna:jna</artifact>
58+
<excludes><!-- exclude files not having the issue, to ease review -->
59+
<exclude>META-INF/*</exclude>
60+
<exclude>**/*.class</exclude>
61+
<exclude>com/sun/jna/win32**/*</exclude>
62+
</excludes>
63+
</filter>
64+
</filters>
65+
</configuration>
66+
</execution>
67+
</executions>
68+
</plugin>
69+
<plugin>
70+
<groupId>org.apache.maven.plugins</groupId>
71+
<artifactId>maven-dependency-plugin</artifactId>
72+
<version>3.5.0</version>
73+
<executions>
74+
<execution>
75+
<goals>
76+
<goal>copy-dependencies</goal>
77+
</goals>
78+
</execution>
79+
</executions>
80+
</plugin>
81+
</plugins>
82+
</build>
83+
</project>
+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import java.security.MessageDigest
21+
import java.util.jar.JarFile
22+
23+
String describeEntry(JarFile jar, String name, long time) {
24+
def entry = jar.getEntry(name)
25+
return String.format(" - %-47s: time = %d, lastModified = %s = diff %d min., extra = %b", name, entry.getTime(), entry.getLastModifiedTime().toString(),
26+
(long)((entry.getTime() / 1000L - time)/60L), entry.getExtra() != null)
27+
}
28+
29+
String describeJar(JarFile jar) {
30+
return describeEntry(jar, "com/sun/jna/openbsd-x86-64/libjnidispatch.so", 1671223758L) + '\n'\
31+
+ describeEntry(jar, "com/sun/jna/linux-loongarch64/libjnidispatch.so", 1671223358L)
32+
}
33+
34+
String describe(String name) {
35+
def file = new File(basedir, "target/" + name)
36+
def jar = new JarFile(file)
37+
38+
println(name)
39+
return "sha1 = " + MessageDigest.getInstance("SHA1").digest(file.bytes).encodeHex().toString()\
40+
+ "\n" + describeJar(jar)
41+
}
42+
43+
void describeTz(TimeZone tz) {
44+
println("TZ = " + tz.getID() + ", raw offset = " + tz.getRawOffset() / 60000 + " min., offset to current TZ = " + (tz.getRawOffset() - TimeZone.getDefault().getRawOffset()) / 60000 + " min.")
45+
}
46+
47+
describeTz(TimeZone.getDefault())
48+
println(describe("dependency/jna-5.13.0.jar"))
49+
println(describe("current-OS.jar"))
50+
def utcDescription = describe("UTC.jar")
51+
describeTz(TimeZone.getTimeZone("Etc/UTC"))
52+
println(utcDescription)
53+
def tokyoDescription = describe("Tokyo.jar")
54+
describeTz(TimeZone.getTimeZone("Asia/Tokyo"))
55+
println(tokyoDescription)
56+
describeTz(TimeZone.getTimeZone("Canada/Yukon"))
57+
println(describe("Yukon.jar"))
58+
59+
assert utcDescription == tokyoDescription
+215
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# extract of zipdetails tool (https://perldoc.perl.org/zipdetails) output on target/dependency/jna-5.13.0.jar
19+
# and on UTC.jar and Tokyo.jar
20+
# to compare details of a problematic zip entry vs non-problematic in origin jar
21+
# vs in shaded jars
22+
#
23+
24+
# extracts from *.zipdetails.txt and *.zipdetails-stderr.txt files generated by:
25+
$ for n in UTC Tokyo dependency/jna-5.13.0 ; do sha1sum $n.jar ; zipdetails $n.jar > $n-zipdetails.txt 2> $n-zipdetails-stderr.txt ; done
26+
2f9bd2808b7f93058abd8a66e160b699e2ff53f1 UTC.jar
27+
bc0b043cbcdda98b53d9aa8f8ef3a4e7f6624708 Tokyo.jar
28+
1200e7ebeedbe0d10062093f32925a912020e747 dependency/jna-5.13.0.jar
29+
# done on my own Linux box with Paris TZ in January 2024 (I don't know if other OS TZ may have an impact, or daylight savings,
30+
# recording details for comparing with anybody getting different results on SHA1s)
31+
# focused on problematic zip entries com/sun/jna/openbsd-x86-64/libjnidispatch.so vs non-problematic com/sun/jna/linux-loongarch64/libjnidispatch.so
32+
33+
# initial zipdetails contains 2 "Extra ID" fields
34+
35+
##
36+
## jna-5.13.0.jar
37+
##
38+
# zip entry in jna-5.13.0.jar causing the issue
39+
ADD 1600309 1648805 CENTRAL HEADER ref Local #B5: com/sun/jna/openbsd-x86-64/libjnidispatch.so
40+
1CAAA1 CENTRAL HEADER #B5 02014B50
41+
1CAAA5 Created Zip Spec 14 '2.0'
42+
1CAAA6 Created OS 03 'Unix'
43+
1CAAA7 Extract Zip Spec 0A '1.0'
44+
1CAAA8 Extract OS 00 'MS-DOS'
45+
1CAAA9 General Purpose Flag 0800
46+
[Bits 1-2] 0 'Normal Compression'
47+
[Bit 11] 1 'Language Encoding'
48+
1CAAAB Compression Method 0008 'Deflated'
49+
1CAAAD Last Mod Time 5590AE29 'Fri Dec 16 21:49:18 2022'
50+
1CAAB1 CRC 9D24CF73
51+
1CAAB5 Compressed Length 0000BD70
52+
1CAAB9 Uncompressed Length 0001E03E
53+
1CAABD Filename Length 002C
54+
1CAABF Extra Length 0018
55+
1CAAC1 Comment Length 0000
56+
1CAAC3 Disk Start 0000
57+
1CAAC5 Int File Attributes 0000
58+
[Bit 0] 0 'Binary Data'
59+
1CAAC7 Ext File Attributes 81ED0000
60+
1CAACB Local Header Offset 00186B35
61+
1CAACF Filename 'com/sun/jna/openbsd-x86-
62+
64/libjnidispatch.so'
63+
1CAAFB Extra ID #0001 5455 'UT: Extended Timestamp'
64+
1CAAFD Length 0005
65+
1CAAFF Flags '03 mod access'
66+
1CAB00 Mod Time 639CD9CE 'Fri Dec 16 21:49:18 2022'
67+
1CAB04 Extra ID #0002 7875 'ux: Unix Extra Type 3'
68+
1CAB06 Length 000B
69+
1CAB08 Version 01
70+
1CAB09 UID Size 04
71+
1CAB0A UID 00000000
72+
1CAB0E GID Size 04
73+
1CAB0F GID 00000000
74+
75+
# usual zip entry jna-5.13.0.jar, not causing any issue
76+
ADD 1059307 1109553 CENTRAL HEADER ref Local #A1: com/sun/jna/linux-loongarch64/libjnidispatch.so
77+
1CA392 CENTRAL HEADER #A1 02014B50
78+
1CA396 Created Zip Spec 14 '2.0'
79+
1CA397 Created OS 03 'Unix'
80+
1CA398 Extract Zip Spec 0A '1.0'
81+
1CA399 Extract OS 00 'MS-DOS'
82+
1CA39A General Purpose Flag 0800
83+
[Bits 1-2] 0 'Normal Compression'
84+
[Bit 11] 1 'Language Encoding'
85+
1CA39C Compression Method 0008 'Deflated'
86+
1CA39E Last Mod Time 5590AD53 'Fri Dec 16 21:42:38 2022'
87+
1CA3A2 CRC 1AA0D033
88+
1CA3A6 Compressed Length 0000C446
89+
1CA3AA Uncompressed Length 0005B768
90+
1CA3AE Filename Length 002F
91+
1CA3B0 Extra Length 0000
92+
1CA3B2 Comment Length 0000
93+
1CA3B4 Disk Start 0000
94+
1CA3B6 Int File Attributes 0000
95+
[Bit 0] 0 'Binary Data'
96+
1CA3B8 Ext File Attributes 81A40000
97+
1CA3BC Local Header Offset 001029EB
98+
1CA3C0 Filename 'com/sun/jna/linux-
99+
loongarch64/libjnidispatch.so'
100+
101+
102+
##
103+
## UTC.jar = shaded content with JVM UTC TZ
104+
##
105+
# zip entry in UTC.jar having an issue
106+
ADD 1317115 1365611 CENTRAL HEADER ref Local #38: com/sun/jna/openbsd-x86-64/libjnidispatch.so
107+
14E7BF CENTRAL HEADER #38 02014B50
108+
14E7C3 Created Zip Spec 14 '2.0'
109+
14E7C4 Created OS 00 'MS-DOS'
110+
14E7C5 Extract Zip Spec 14 '2.0'
111+
14E7C6 Extract OS 00 'MS-DOS'
112+
14E7C7 General Purpose Flag 0808
113+
[Bits 1-2] 0 'Normal Compression'
114+
[Bit 3] 1 'Streamed'
115+
[Bit 11] 1 'Language Encoding'
116+
14E7C9 Compression Method 0008 'Deflated'
117+
14E7CB Last Mod Time 5590A629 'Fri Dec 16 20:49:18 2022'
118+
14E7CF CRC 9D24CF73
119+
14E7D3 Compressed Length 0000BD70
120+
14E7D7 Uncompressed Length 0001E03E
121+
14E7DB Filename Length 002C
122+
14E7DD Extra Length 0000
123+
14E7DF Comment Length 0000
124+
14E7E1 Disk Start 0000
125+
14E7E3 Int File Attributes 0000
126+
[Bit 0] 0 'Binary Data'
127+
14E7E5 Ext File Attributes 00000000
128+
14E7E9 Local Header Offset 001418FB
129+
14E7ED Filename 'com/sun/jna/openbsd-x86-
130+
64/libjnidispatch.so'
131+
132+
# zip entry in UTC.jar not having an issue
133+
ADD 776025 826271 CENTRAL HEADER ref Local #24: com/sun/jna/linux-loongarch64/libjnidispatch.so
134+
14E188 CENTRAL HEADER #24 02014B50
135+
14E18C Created Zip Spec 14 '2.0'
136+
14E18D Created OS 00 'MS-DOS'
137+
14E18E Extract Zip Spec 14 '2.0'
138+
14E18F Extract OS 00 'MS-DOS'
139+
14E190 General Purpose Flag 0808
140+
[Bits 1-2] 0 'Normal Compression'
141+
[Bit 3] 1 'Streamed'
142+
[Bit 11] 1 'Language Encoding'
143+
14E192 Compression Method 0008 'Deflated'
144+
14E194 Last Mod Time 5590AD53 'Fri Dec 16 21:42:38 2022'
145+
14E198 CRC 1AA0D033
146+
14E19C Compressed Length 0000C446
147+
14E1A0 Uncompressed Length 0005B768
148+
14E1A4 Filename Length 002F
149+
14E1A6 Extra Length 0000
150+
14E1A8 Comment Length 0000
151+
14E1AA Disk Start 0000
152+
14E1AC Int File Attributes 0000
153+
[Bit 0] 0 'Binary Data'
154+
14E1AE Ext File Attributes 00000000
155+
14E1B2 Local Header Offset 000BD759
156+
14E1B6 Filename 'com/sun/jna/linux-
157+
loongarch64/libjnidispatch.so'
158+
159+
160+
##
161+
## Tokyo.jar = shaded content with JVM Asia/Tokyo TZ
162+
##
163+
# zip entry in Tokyo.jar having an issue
164+
ADD 1317115 1365611 CENTRAL HEADER ref Local #38: com/sun/jna/openbsd-x86-64/libjnidispatch.so
165+
14E7BF CENTRAL HEADER #38 02014B50
166+
14E7C3 Created Zip Spec 14 '2.0'
167+
14E7C4 Created OS 00 'MS-DOS'
168+
14E7C5 Extract Zip Spec 14 '2.0'
169+
14E7C6 Extract OS 00 'MS-DOS'
170+
14E7C7 General Purpose Flag 0808
171+
[Bits 1-2] 0 'Normal Compression'
172+
[Bit 3] 1 'Streamed'
173+
[Bit 11] 1 'Language Encoding'
174+
14E7C9 Compression Method 0008 'Deflated'
175+
14E7CB Last Mod Time 55912E29 'Sat Dec 17 05:49:18 2022'
176+
14E7CF CRC 9D24CF73
177+
14E7D3 Compressed Length 0000BD70
178+
14E7D7 Uncompressed Length 0001E03E
179+
14E7DB Filename Length 002C
180+
14E7DD Extra Length 0000
181+
14E7DF Comment Length 0000
182+
14E7E1 Disk Start 0000
183+
14E7E3 Int File Attributes 0000
184+
[Bit 0] 0 'Binary Data'
185+
14E7E5 Ext File Attributes 00000000
186+
14E7E9 Local Header Offset 001418FB
187+
14E7ED Filename 'com/sun/jna/openbsd-x86-
188+
64/libjnidispatch.so'
189+
190+
# zip entry in Tokyo.jar not having an issue
191+
ADD 776025 826271 CENTRAL HEADER ref Local #24: com/sun/jna/linux-loongarch64/libjnidispatch.so
192+
14E188 CENTRAL HEADER #24 02014B50
193+
14E18C Created Zip Spec 14 '2.0'
194+
14E18D Created OS 00 'MS-DOS'
195+
14E18E Extract Zip Spec 14 '2.0'
196+
14E18F Extract OS 00 'MS-DOS'
197+
14E190 General Purpose Flag 0808
198+
[Bits 1-2] 0 'Normal Compression'
199+
[Bit 3] 1 'Streamed'
200+
[Bit 11] 1 'Language Encoding'
201+
14E192 Compression Method 0008 'Deflated'
202+
14E194 Last Mod Time 5590AD53 'Fri Dec 16 21:42:38 2022'
203+
14E198 CRC 1AA0D033
204+
14E19C Compressed Length 0000C446
205+
14E1A0 Uncompressed Length 0005B768
206+
14E1A4 Filename Length 002F
207+
14E1A6 Extra Length 0000
208+
14E1A8 Comment Length 0000
209+
14E1AA Disk Start 0000
210+
14E1AC Int File Attributes 0000
211+
[Bit 0] 0 'Binary Data'
212+
14E1AE Ext File Attributes 00000000
213+
14E1B2 Local Header Offset 000BD759
214+
14E1B6 Filename 'com/sun/jna/linux-
215+
loongarch64/libjnidispatch.so'

0 commit comments

Comments
 (0)