Skip to content

Conversation

hboutemy
Copy link
Member

after #311 , need to check what jar file is created with 1970 timestamp, to be able to dig if anything is unexpected

@hboutemy hboutemy marked this pull request as draft September 24, 2025 11:39
@hboutemy
Copy link
Member Author

target/test/dummy-2000.jar is as expected:

$ unzip -v target/test/dummy-2000.jar
Archive:  target/test/dummy-2000.jar
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
       0  Stored        0   0% 2000-01-01 00:00 00000000  META-INF/
      73  Defl:N       75  -3% 2000-01-01 00:00 67bb4699  META-INF/MANIFEST.MF
       0  Stored        0   0% 2000-01-01 00:00 00000000  META-INF/maven/
       0  Stored        0   0% 2000-01-01 00:00 00000000  META-INF/maven/org.apache.dummy/
       0  Stored        0   0% 2000-01-01 00:00 00000000  META-INF/maven/org.apache.dummy/dummy/
    2194  Defl:N      864  61% 2000-01-01 00:00 c30109a5  META-INF/maven/org.apache.dummy/dummy/pom.xml
      56  Defl:N       52   7% 2000-01-01 00:00 0e3ba0a0  META-INF/maven/org.apache.dummy/dummy/pom.properties
--------          -------  ---                            -------
    2323              991  57%                            7 files

$  zipdetails target/test/dummy-2000.jar | head -15

0000 LOCAL HEADER #1       04034B50
0004 Extract Zip Spec      0A '1.0'
0005 Extract OS            00 'MS-DOS'
0006 General Purpose Flag  0800
     [Bit 11]              1 'Language Encoding'
0008 Compression Method    0000 'Stored'
000A Last Mod Time         28210000 'Sat Jan  1 01:00:00 2000'
000E CRC                   00000000
0012 Compressed Length     00000000
0016 Uncompressed Length   00000000
001A Filename Length       0009
001C Extra Length          0000
001E Filename              'META-INF/'

but for 1970, result is strange:

$ unzip -v target/test/dummy-1970.jar
Archive:  target/test/dummy-1970.jar
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
       0  Stored        0   0% 1980-01-01 00:00 00000000  META-INF/
      73  Defl:N       75  -3% 1980-01-01 00:00 67bb4699  META-INF/MANIFEST.MF
       0  Stored        0   0% 1980-01-01 00:00 00000000  META-INF/maven/
       0  Stored        0   0% 1980-01-01 00:00 00000000  META-INF/maven/org.apache.dummy/
       0  Stored        0   0% 1980-01-01 00:00 00000000  META-INF/maven/org.apache.dummy/dummy/
    2194  Defl:N      864  61% 1980-01-01 00:00 c30109a5  META-INF/maven/org.apache.dummy/dummy/pom.xml
      56  Defl:N       52   7% 1980-01-01 00:00 0e3ba0a0  META-INF/maven/org.apache.dummy/dummy/pom.properties
--------          -------  ---                            -------
    2323              991  57%                            7 files

$ zipdetails target/test/dummy-1970.jar | head -30

0000 LOCAL HEADER #1       04034B50
0004 Extract Zip Spec      0A '1.0'
0005 Extract OS            00 'MS-DOS'
0006 General Purpose Flag  0800
     [Bit 11]              1 'Language Encoding'
0008 Compression Method    0000 'Stored'
000A Last Mod Time         00210000 'Tue Jan  1 01:00:00 1980'
000E CRC                   00000000
0012 Compressed Length     00000000
0016 Uncompressed Length   00000000
001A Filename Length       0009
001C Extra Length          002D
001E Filename              'META-INF/'
0027 Extra ID #0001        5455 'UT: Extended Timestamp'
0029   Length              0005
002B   Flags               '01 mod'
002C   Mod Time            FFFFF1FA 'Sun Feb  7 06:28:26 2106'
0030 Extra ID #0002        000A 'NTFS FileTimes'
0032   Length              0020
0034   Reserved            00000000
0038   Tag1                0001
003A   Size1               0018
003C   Mtime               019DB1D6796FF900 'Thu Jan  1 00:00:10
                           1970 0ns'
0044   Atime               0000000000000000 'Mon Jan  1 00:09:21
                           1601 0ns'
004C   Ctime               0000000000000000 'Mon Jan  1 00:09:21
                           1601 0ns'

@hboutemy
Copy link
Member Author

@michael-o commons compress does strange things:

000A Last Mod Time         00210000 'Tue Jan  1 01:00:00 1980'
0027 Extra ID #0001        5455 'UT: Extended Timestamp'
0029   Length              0005
002B   Flags               '01 mod'
002C   Mod Time            FFFFF1FA 'Sun Feb  7 06:28:26 2106'
0030 Extra ID #0002        000A 'NTFS FileTimes'
0032   Length              0020
0034   Reserved            00000000
0038   Tag1                0001
003A   Size1               0018
003C   Mtime               019DB1D6796FF900 'Thu Jan  1 00:00:10
                           1970 0ns'
0044   Atime               0000000000000000 'Mon Jan  1 00:09:21
                           1601 0ns'
004C   Ctime               0000000000000000 'Mon Jan  1 00:09:21
                           1601 0ns'

5455 'UT: Extended Timestamp' looks like MS DOS DATE_MAX instead of the value that is stored in 'NTFS FileTimes'

need to check why: is it Plexus Archiver using Commons Compress the wrong way? or is it Commons Compress doing weird things?

@hboutemy
Copy link
Member Author

hboutemy commented Sep 24, 2025

even stranger bsdtar -t target/test/dummy-1970.jar or bsdtar -t target/test/dummy-2000.jar block and never give any output...
but not related to any timestamp value: same issue with any file in target/test ...

@michael-o
Copy link
Member

even stranger bsdtar -t target/test/dummy-1970.jar or bsdtar -t target/test/dummy-2000.jar block and never give any output... but not related to any timestamp value: same issue with any file in target/test ...

I get proper output:

$ tar -tvf ./test/dummy-2000.jar
drwxr-xr-x  0 0      0           0  1 Jan.  2000 META-INF/
-rw-r--r--  0 0      0          73  1 Jan.  2000 META-INF/MANIFEST.MF
drwxr-xr-x  0 0      0           0  1 Jan.  2000 META-INF/maven/
drwxr-xr-x  0 0      0           0  1 Jan.  2000 META-INF/maven/org.apache.dummy/
drwxr-xr-x  0 0      0           0  1 Jan.  2000 META-INF/maven/org.apache.dummy/dummy/
-rw-r--r--  0 0      0        2194  1 Jan.  2000 META-INF/maven/org.apache.dummy/dummy/pom.xml
-rw-r--r--  0 0      0          56  1 Jan.  2000 META-INF/maven/org.apache.dummy/dummy/pom.properties
$ tar -tvf ./test/dummy-1970.jar
drwxr-xr-x  0 0      0           0  7 Feb.  2106 META-INF/
-rw-r--r--  0 0      0          73  7 Feb.  2106 META-INF/MANIFEST.MF
drwxr-xr-x  0 0      0           0  7 Feb.  2106 META-INF/maven/
drwxr-xr-x  0 0      0           0  7 Feb.  2106 META-INF/maven/org.apache.dummy/
drwxr-xr-x  0 0      0           0  7 Feb.  2106 META-INF/maven/org.apache.dummy/dummy/
-rw-r--r--  0 0      0        2194  7 Feb.  2106 META-INF/maven/org.apache.dummy/dummy/pom.xml
-rw-r--r--  0 0      0          56  7 Feb.  2106 META-INF/maven/org.apache.dummy/dummy/pom.properties

So something is wrong with Commons Compress.

@garydgregory, an you help?

@michael-o
Copy link
Member

$ zipdetails ./test/dummy-1970.jar

0000 LOCAL HEADER #1       04034B50 (67324752)
0004 Extract Zip Spec      0A (10) '1.0'
0005 Extract OS            00 (0) 'MS-DOS'
0006 General Purpose Flag  0800 (2048)
     [Bit 11]              1 'Language Encoding'
0008 Compression Method    0000 (0) 'Stored'
000A Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
000E CRC                   00000000 (0)
0012 Compressed Size       00000000 (0)
0016 Uncompressed Size     00000000 (0)
001A Filename Length       0009 (9)
001C Extra Length          002D (45)
001E Filename              'META-INF/'
0027 Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
0029   Length              0005 (5)
002B   Flags               01 (1) 'Modification'
002C   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
0030 Extra ID #2           000A (10) 'NTFS FileTimes'
0032   Length              0020 (32)
0034   Reserved            00000000 (0)
0038   Tag1                0001 (1)
003A   Size1               0018 (24)
003C   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
0044   Atime               0000000000000000 (0) 'No Date/Time'
004C   Ctime               0000000000000000 (0) 'No Date/Time'

0054 LOCAL HEADER #2       04034B50 (67324752)
0058 Extract Zip Spec      14 (20) '2.0'
0059 Extract OS            00 (0) 'MS-DOS'
005A General Purpose Flag  0800 (2048)
     [Bits 1-2]            0 'Normal Compression'
     [Bit 11]              1 'Language Encoding'
005C Compression Method    0008 (8) 'Deflated'
005E Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
0062 CRC                   67BB4699 (1740326553)
0066 Compressed Size       0000004B (75)
006A Uncompressed Size     00000049 (73)
006E Filename Length       0014 (20)
0070 Extra Length          002D (45)
0072 Filename              'META-INF/MANIFEST.MF'
0086 Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
0088   Length              0005 (5)
008A   Flags               01 (1) 'Modification'
008B   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
008F Extra ID #2           000A (10) 'NTFS FileTimes'
0091   Length              0020 (32)
0093   Reserved            00000000 (0)
0097   Tag1                0001 (1)
0099   Size1               0018 (24)
009B   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
00A3   Atime               0000000000000000 (0) 'No Date/Time'
00AB   Ctime               0000000000000000 (0) 'No Date/Time'
00B3 PAYLOAD               .M..LK-...K-*....R0.3..r.JM,IM.u..R.M,K.Sp,J..,K-..r*..I..J....HM.R02......

00FE LOCAL HEADER #3       04034B50 (67324752)
0102 Extract Zip Spec      0A (10) '1.0'
0103 Extract OS            00 (0) 'MS-DOS'
0104 General Purpose Flag  0800 (2048)
     [Bit 11]              1 'Language Encoding'
0106 Compression Method    0000 (0) 'Stored'
0108 Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
010C CRC                   00000000 (0)
0110 Compressed Size       00000000 (0)
0114 Uncompressed Size     00000000 (0)
0118 Filename Length       000F (15)
011A Extra Length          002D (45)
011C Filename              'META-INF/maven/'
012B Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
012D   Length              0005 (5)
012F   Flags               01 (1) 'Modification'
0130   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
0134 Extra ID #2           000A (10) 'NTFS FileTimes'
0136   Length              0020 (32)
0138   Reserved            00000000 (0)
013C   Tag1                0001 (1)
013E   Size1               0018 (24)
0140   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
0148   Atime               0000000000000000 (0) 'No Date/Time'
0150   Ctime               0000000000000000 (0) 'No Date/Time'

0158 LOCAL HEADER #4       04034B50 (67324752)
015C Extract Zip Spec      0A (10) '1.0'
015D Extract OS            00 (0) 'MS-DOS'
015E General Purpose Flag  0800 (2048)
     [Bit 11]              1 'Language Encoding'
0160 Compression Method    0000 (0) 'Stored'
0162 Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
0166 CRC                   00000000 (0)
016A Compressed Size       00000000 (0)
016E Uncompressed Size     00000000 (0)
0172 Filename Length       0020 (32)
0174 Extra Length          002D (45)
0176 Filename              'META-INF/maven/org.apache.dummy/'
0196 Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
0198   Length              0005 (5)
019A   Flags               01 (1) 'Modification'
019B   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
019F Extra ID #2           000A (10) 'NTFS FileTimes'
01A1   Length              0020 (32)
01A3   Reserved            00000000 (0)
01A7   Tag1                0001 (1)
01A9   Size1               0018 (24)
01AB   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
01B3   Atime               0000000000000000 (0) 'No Date/Time'
01BB   Ctime               0000000000000000 (0) 'No Date/Time'

01C3 LOCAL HEADER #5       04034B50 (67324752)
01C7 Extract Zip Spec      0A (10) '1.0'
01C8 Extract OS            00 (0) 'MS-DOS'
01C9 General Purpose Flag  0800 (2048)
     [Bit 11]              1 'Language Encoding'
01CB Compression Method    0000 (0) 'Stored'
01CD Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
01D1 CRC                   00000000 (0)
01D5 Compressed Size       00000000 (0)
01D9 Uncompressed Size     00000000 (0)
01DD Filename Length       0026 (38)
01DF Extra Length          002D (45)
01E1 Filename              'META-INF/maven/org.apache.dummy/dummy/'
0207 Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
0209   Length              0005 (5)
020B   Flags               01 (1) 'Modification'
020C   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
0210 Extra ID #2           000A (10) 'NTFS FileTimes'
0212   Length              0020 (32)
0214   Reserved            00000000 (0)
0218   Tag1                0001 (1)
021A   Size1               0018 (24)
021C   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
0224   Atime               0000000000000000 (0) 'No Date/Time'
022C   Ctime               0000000000000000 (0) 'No Date/Time'

0234 LOCAL HEADER #6       04034B50 (67324752)
0238 Extract Zip Spec      14 (20) '2.0'
0239 Extract OS            00 (0) 'MS-DOS'
023A General Purpose Flag  0800 (2048)
     [Bits 1-2]            0 'Normal Compression'
     [Bit 11]              1 'Language Encoding'
023C Compression Method    0008 (8) 'Deflated'
023E Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
0242 CRC                   C30109A5 (3271625125)
0246 Compressed Size       00000360 (864)
024A Uncompressed Size     00000892 (2194)
024E Filename Length       002D (45)
0250 Extra Length          002D (45)
0252 Filename              'META-INF/maven/org.apache.dummy/dummy/pom.xml'
027F Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
0281   Length              0005 (5)
0283   Flags               01 (1) 'Modification'
0284   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
0288 Extra ID #2           000A (10) 'NTFS FileTimes'
028A   Length              0020 (32)
028C   Reserved            00000000 (0)
0290   Tag1                0001 (1)
0292   Size1               0018 (24)
0294   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
029C   Atime               0000000000000000 (0) 'No Date/Time'
02A4   Ctime               0000000000000000 (0) 'No Date/Time'
02AC PAYLOAD

060C LOCAL HEADER #7       04034B50 (67324752)
0610 Extract Zip Spec      14 (20) '2.0'
0611 Extract OS            00 (0) 'MS-DOS'
0612 General Purpose Flag  0800 (2048)
     [Bits 1-2]            0 'Normal Compression'
     [Bit 11]              1 'Language Encoding'
0614 Compression Method    0008 (8) 'Deflated'
0616 Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
061A CRC                   0E3BA0A0 (238788768)
061E Compressed Size       00000034 (52)
0622 Uncompressed Size     00000038 (56)
0626 Filename Length       0034 (52)
0628 Extra Length          002D (45)
062A Filename              'META-INF/maven/org.apache.dummy/dummy/pom.properties'
065E Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
0660   Length              0005 (5)
0662   Flags               01 (1) 'Modification'
0663   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
0667 Extra ID #2           000A (10) 'NTFS FileTimes'
0669   Length              0020 (32)
066B   Reserved            00000000 (0)
066F   Tag1                0001 (1)
0671   Size1               0018 (24)
0673   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
067B   Atime               0000000000000000 (0) 'No Date/Time'
0683   Ctime               0000000000000000 (0) 'No Date/Time'
068B PAYLOAD               K,*.LKL..L.M)....J/./-..........3R. .e.E...y..z.z.\.

06BF CENTRAL HEADER #1     02014B50 (33639248)
06C3 Created Zip Spec      14 (20) '2.0'
06C4 Created OS            03 (3) 'Unix'
06C5 Extract Zip Spec      0A (10) '1.0'
06C6 Extract OS            00 (0) 'MS-DOS'
06C7 General Purpose Flag  0800 (2048)
     [Bit 11]              1 'Language Encoding'
06C9 Compression Method    0000 (0) 'Stored'
06CB Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
06CF CRC                   00000000 (0)
06D3 Compressed Size       00000000 (0)
06D7 Uncompressed Size     00000000 (0)
06DB Filename Length       0009 (9)
06DD Extra Length          002D (45)
06DF Comment Length        0000 (0)
06E1 Disk Start            0000 (0)
06E3 Int File Attributes   0000 (0)
     [Bit 0]               0 'Binary Data'
06E5 Ext File Attributes   41ED0010 (1106051088)
     [Bit 4]               Directory
     [Bits 16-24]          01ED (493) 'Unix attrib: rwxr-xr-x'
     [Bits 28-31]          04 (4) 'Directory'
06E9 Local Header Offset   00000000 (0)
06ED Filename              'META-INF/'
06F6 Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
06F8   Length              0005 (5)
06FA   Flags               01 (1) 'Modification'
06FB   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
06FF Extra ID #2           000A (10) 'NTFS FileTimes'
0701   Length              0020 (32)
0703   Reserved            00000000 (0)
0707   Tag1                0001 (1)
0709   Size1               0018 (24)
070B   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
0713   Atime               0000000000000000 (0) 'No Date/Time'
071B   Ctime               0000000000000000 (0) 'No Date/Time'
#
# WARNING: Offset 0x6C5: 'Extract Zip Spec' is '1.0'. Need value >= '2.0' for Directory 'META-INF/'
#

0723 CENTRAL HEADER #2     02014B50 (33639248)
0727 Created Zip Spec      14 (20) '2.0'
0728 Created OS            03 (3) 'Unix'
0729 Extract Zip Spec      14 (20) '2.0'
072A Extract OS            00 (0) 'MS-DOS'
072B General Purpose Flag  0800 (2048)
     [Bits 1-2]            0 'Normal Compression'
     [Bit 11]              1 'Language Encoding'
072D Compression Method    0008 (8) 'Deflated'
072F Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
0733 CRC                   67BB4699 (1740326553)
0737 Compressed Size       0000004B (75)
073B Uncompressed Size     00000049 (73)
073F Filename Length       0014 (20)
0741 Extra Length          002D (45)
0743 Comment Length        0000 (0)
0745 Disk Start            0000 (0)
0747 Int File Attributes   0000 (0)
     [Bit 0]               0 'Binary Data'
0749 Ext File Attributes   81A40000 (2175008768)
     [Bits 16-24]          01A4 (420) 'Unix attrib: rw-r--r--'
     [Bits 28-31]          08 (8) 'Regular File'
074D Local Header Offset   00000054 (84)
0751 Filename              'META-INF/MANIFEST.MF'
0765 Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
0767   Length              0005 (5)
0769   Flags               01 (1) 'Modification'
076A   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
076E Extra ID #2           000A (10) 'NTFS FileTimes'
0770   Length              0020 (32)
0772   Reserved            00000000 (0)
0776   Tag1                0001 (1)
0778   Size1               0018 (24)
077A   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
0782   Atime               0000000000000000 (0) 'No Date/Time'
078A   Ctime               0000000000000000 (0) 'No Date/Time'

0792 CENTRAL HEADER #3     02014B50 (33639248)
0796 Created Zip Spec      14 (20) '2.0'
0797 Created OS            03 (3) 'Unix'
0798 Extract Zip Spec      0A (10) '1.0'
0799 Extract OS            00 (0) 'MS-DOS'
079A General Purpose Flag  0800 (2048)
     [Bit 11]              1 'Language Encoding'
079C Compression Method    0000 (0) 'Stored'
079E Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
07A2 CRC                   00000000 (0)
07A6 Compressed Size       00000000 (0)
07AA Uncompressed Size     00000000 (0)
07AE Filename Length       000F (15)
07B0 Extra Length          002D (45)
07B2 Comment Length        0000 (0)
07B4 Disk Start            0000 (0)
07B6 Int File Attributes   0000 (0)
     [Bit 0]               0 'Binary Data'
07B8 Ext File Attributes   41ED0010 (1106051088)
     [Bit 4]               Directory
     [Bits 16-24]          01ED (493) 'Unix attrib: rwxr-xr-x'
     [Bits 28-31]          04 (4) 'Directory'
07BC Local Header Offset   000000FE (254)
07C0 Filename              'META-INF/maven/'
07CF Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
07D1   Length              0005 (5)
07D3   Flags               01 (1) 'Modification'
07D4   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
07D8 Extra ID #2           000A (10) 'NTFS FileTimes'
07DA   Length              0020 (32)
07DC   Reserved            00000000 (0)
07E0   Tag1                0001 (1)
07E2   Size1               0018 (24)
07E4   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
07EC   Atime               0000000000000000 (0) 'No Date/Time'
07F4   Ctime               0000000000000000 (0) 'No Date/Time'
#
# WARNING: Offset 0x798: 'Extract Zip Spec' is '1.0'. Need value >= '2.0' for Directory 'META-INF/maven/'
#

07FC CENTRAL HEADER #4     02014B50 (33639248)
0800 Created Zip Spec      14 (20) '2.0'
0801 Created OS            03 (3) 'Unix'
0802 Extract Zip Spec      0A (10) '1.0'
0803 Extract OS            00 (0) 'MS-DOS'
0804 General Purpose Flag  0800 (2048)
     [Bit 11]              1 'Language Encoding'
0806 Compression Method    0000 (0) 'Stored'
0808 Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
080C CRC                   00000000 (0)
0810 Compressed Size       00000000 (0)
0814 Uncompressed Size     00000000 (0)
0818 Filename Length       0020 (32)
081A Extra Length          002D (45)
081C Comment Length        0000 (0)
081E Disk Start            0000 (0)
0820 Int File Attributes   0000 (0)
     [Bit 0]               0 'Binary Data'
0822 Ext File Attributes   41ED0010 (1106051088)
     [Bit 4]               Directory
     [Bits 16-24]          01ED (493) 'Unix attrib: rwxr-xr-x'
     [Bits 28-31]          04 (4) 'Directory'
0826 Local Header Offset   00000158 (344)
082A Filename              'META-INF/maven/org.apache.dummy/'
084A Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
084C   Length              0005 (5)
084E   Flags               01 (1) 'Modification'
084F   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
0853 Extra ID #2           000A (10) 'NTFS FileTimes'
0855   Length              0020 (32)
0857   Reserved            00000000 (0)
085B   Tag1                0001 (1)
085D   Size1               0018 (24)
085F   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
0867   Atime               0000000000000000 (0) 'No Date/Time'
086F   Ctime               0000000000000000 (0) 'No Date/Time'
#
# WARNING: Offset 0x802: 'Extract Zip Spec' is '1.0'. Need value >= '2.0' for Directory 'META-INF/maven/org.apache.dummy/'
#

0877 CENTRAL HEADER #5     02014B50 (33639248)
087B Created Zip Spec      14 (20) '2.0'
087C Created OS            03 (3) 'Unix'
087D Extract Zip Spec      0A (10) '1.0'
087E Extract OS            00 (0) 'MS-DOS'
087F General Purpose Flag  0800 (2048)
     [Bit 11]              1 'Language Encoding'
0881 Compression Method    0000 (0) 'Stored'
0883 Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
0887 CRC                   00000000 (0)
088B Compressed Size       00000000 (0)
088F Uncompressed Size     00000000 (0)
0893 Filename Length       0026 (38)
0895 Extra Length          002D (45)
0897 Comment Length        0000 (0)
0899 Disk Start            0000 (0)
089B Int File Attributes   0000 (0)
     [Bit 0]               0 'Binary Data'
089D Ext File Attributes   41ED0010 (1106051088)
     [Bit 4]               Directory
     [Bits 16-24]          01ED (493) 'Unix attrib: rwxr-xr-x'
     [Bits 28-31]          04 (4) 'Directory'
08A1 Local Header Offset   000001C3 (451)
08A5 Filename              'META-INF/maven/org.apache.dummy/dummy/'
08CB Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
08CD   Length              0005 (5)
08CF   Flags               01 (1) 'Modification'
08D0   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
08D4 Extra ID #2           000A (10) 'NTFS FileTimes'
08D6   Length              0020 (32)
08D8   Reserved            00000000 (0)
08DC   Tag1                0001 (1)
08DE   Size1               0018 (24)
08E0   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
08E8   Atime               0000000000000000 (0) 'No Date/Time'
08F0   Ctime               0000000000000000 (0) 'No Date/Time'
#
# WARNING: Offset 0x87D: 'Extract Zip Spec' is '1.0'. Need value >= '2.0' for Directory 'META-INF/maven/org.apache.dummy/dummy/'
#

08F8 CENTRAL HEADER #6     02014B50 (33639248)
08FC Created Zip Spec      14 (20) '2.0'
08FD Created OS            03 (3) 'Unix'
08FE Extract Zip Spec      14 (20) '2.0'
08FF Extract OS            00 (0) 'MS-DOS'
0900 General Purpose Flag  0800 (2048)
     [Bits 1-2]            0 'Normal Compression'
     [Bit 11]              1 'Language Encoding'
0902 Compression Method    0008 (8) 'Deflated'
0904 Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
0908 CRC                   C30109A5 (3271625125)
090C Compressed Size       00000360 (864)
0910 Uncompressed Size     00000892 (2194)
0914 Filename Length       002D (45)
0916 Extra Length          002D (45)
0918 Comment Length        0000 (0)
091A Disk Start            0000 (0)
091C Int File Attributes   0000 (0)
     [Bit 0]               0 'Binary Data'
091E Ext File Attributes   81A40000 (2175008768)
     [Bits 16-24]          01A4 (420) 'Unix attrib: rw-r--r--'
     [Bits 28-31]          08 (8) 'Regular File'
0922 Local Header Offset   00000234 (564)
0926 Filename              'META-INF/maven/org.apache.dummy/dummy/pom.xml'
0953 Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
0955   Length              0005 (5)
0957   Flags               01 (1) 'Modification'
0958   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
095C Extra ID #2           000A (10) 'NTFS FileTimes'
095E   Length              0020 (32)
0960   Reserved            00000000 (0)
0964   Tag1                0001 (1)
0966   Size1               0018 (24)
0968   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
0970   Atime               0000000000000000 (0) 'No Date/Time'
0978   Ctime               0000000000000000 (0) 'No Date/Time'

0980 CENTRAL HEADER #7     02014B50 (33639248)
0984 Created Zip Spec      14 (20) '2.0'
0985 Created OS            03 (3) 'Unix'
0986 Extract Zip Spec      14 (20) '2.0'
0987 Extract OS            00 (0) 'MS-DOS'
0988 General Purpose Flag  0800 (2048)
     [Bits 1-2]            0 'Normal Compression'
     [Bit 11]              1 'Language Encoding'
098A Compression Method    0008 (8) 'Deflated'
098C Modification Time     00210000 (2162688) 'Tue Jan  1 01:00:00 1980'
0990 CRC                   0E3BA0A0 (238788768)
0994 Compressed Size       00000034 (52)
0998 Uncompressed Size     00000038 (56)
099C Filename Length       0034 (52)
099E Extra Length          002D (45)
09A0 Comment Length        0000 (0)
09A2 Disk Start            0000 (0)
09A4 Int File Attributes   0000 (0)
     [Bit 0]               0 'Binary Data'
09A6 Ext File Attributes   81A40000 (2175008768)
     [Bits 16-24]          01A4 (420) 'Unix attrib: rw-r--r--'
     [Bits 28-31]          08 (8) 'Regular File'
09AA Local Header Offset   0000060C (1548)
09AE Filename              'META-INF/maven/org.apache.dummy/dummy/pom.properties'
09E2 Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
09E4   Length              0005 (5)
09E6   Flags               01 (1) 'Modification'
09E7   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'
09EB Extra ID #2           000A (10) 'NTFS FileTimes'
09ED   Length              0020 (32)
09EF   Reserved            00000000 (0)
09F3   Tag1                0001 (1)
09F5   Size1               0018 (24)
09F7   Mtime               019DB1D6796FF900 (116444700100000000) 'Thu Jan  1 00:00:10 1970 0ns'
09FF   Atime               0000000000000000 (0) 'No Date/Time'
0A07   Ctime               0000000000000000 (0) 'No Date/Time'

0A0F END CENTRAL HEADER    06054B50 (101010256)
0A13 Number of this disk   0000 (0)
0A15 Central Dir Disk no   0000 (0)
0A17 Entries in this disk  0007 (7)
0A19 Total Entries         0007 (7)
0A1B Size of Central Dir   00000350 (848)
0A1F Offset to Central Dir 000006BF (1727)
0A23 Comment Length        0000 (0)
#
# Warning Count: 4
#
# Done

@hboutemy
Copy link
Member Author

hboutemy commented Sep 25, 2025

IMHO, we should update Plexus Archiver (I suppose) to:

  1. drop the 'NTFS FileTimes' content
  2. fix the 'Extended Timestamp [UT]'

eventually write the unit test in Plexus Archiver, to avoid the avoidable complexity of the Maven Archiver layer on top of Plexus Archiver https://github.com/codehaus-plexus/plexus-archiver/blob/master/src/test/java/org/codehaus/plexus/archiver/zip/ZipArchiverTest.java

@michael-o
Copy link
Member

IMHO, we should update Plexus Archiver (I suppose) to:

  1. drop the 'NTFS FileTimes' content
  2. fix the 'Extended Timestamp [UT]'

eventually write the unit test in Plexus Archiver, to avoid the avoidable complexity of the Maven Archiver layer on top of Plexus Archiver https://github.com/codehaus-plexus/plexus-archiver/blob/master/src/test/java/org/codehaus/plexus/archiver/zip/ZipArchiverTest.java

Why drop if it can be fixed?

@hboutemy
Copy link
Member Author

Why drop if it can be fixed?

why keep these additional bytes if it is there only when timestamp is out of MS DOS range?

I'm a huge fan of "less is more" approach

@michael-o
Copy link
Member

Why drop if it can be fixed?

why keep these additional bytes if it is there only when timestamp is out of MS DOS range?

I'm a huge fan of "less is more" approach

I see, but this needs to be decided by the CC folks or it is configurable...

@hboutemy
Copy link
Member Author

hboutemy commented Sep 25, 2025

holy shit: I found what happens by looking at entries in codehaus-plexus/plexus-archiver#387 , done by injecting SOURCE_DATE_EPOCH=0 and getting 1h difference in effective timestamp in the zip file...

given the timezone rework of the timestamp, to get reproducible binary output, SOURCE_DATE_EPOCH=10 from configuration in POM property is transformed to -1h in may case (french TZ), then SOURCE_DATE_EPOCH=10-60*60: it is negative!!!

this is why we get

09E2 Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
09E4   Length              0005 (5)
09E6   Flags               01 (1) 'Modification'
09E7   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'

FFFFF1FA is a negative long...

what an unexpected situation!!!

@michael-o
Copy link
Member

holy shit: I found what happens by looking at entries in codehaus-plexus/plexus-archiver#387 , done by injecting SOURCE_DATE_EPOCH=0 and getting 1h difference in effective timestamp in the zip file...

given the timezone rework of the timestamp, to get reproducible binary output, SOURCE_DATE_EPOCH=10 from configuration in POM property is transformed to -1h in may case (french TZ), then SOURCE_DATE_EPOCH=10-60*60: it is negative!!!

this is why we get

09E2 Extra ID #1           5455 (21589) 'Extended Timestamp [UT]'
09E4   Length              0005 (5)
09E6   Flags               01 (1) 'Modification'
09E7   Modification Time   FFFFF1FA (4294963706) 'Sun Feb  7 06:28:26 2106'

FFFFF1FA is a negative long...

what an unexpected situation!!!

Where is the env var being set? I am confused.

@hboutemy
Copy link
Member Author

no env var: don't read SOURCE_DATE_EPOCH, but a value that represents an epoch
transformed to FFFFF1FA

@michael-o
Copy link
Member

no env var: don't read SOURCE_DATE_EPOCH, but a value that represents an epoch transformed to FFFFF1FA

So this basically means that only DOS time needs a TZ offset alignment, but not the rest. Correct?

@hboutemy
Copy link
Member Author

no
it means we'll have to use a minimal date value that is "1/1/1970 0h0" with maximum available timezone = UTC+14 AFAIK

then it will be "1/1/1970 14h00 UTC" for people configuring anything earlier (as people configuring "10" as property value)

not a problem, just a stupid surprising edge case: people who configure like this don't really care the actual value, they just want RB archive binary and no failure (and no zip file that any zip tool is confused with)

@michael-o
Copy link
Member

no it means we'll have to use a minimal date value that is "1/1/1970 0h0" with maximum available timezone = UTC+14 AFAIK

then it will be "1/1/1970 14h00 UTC" for people configuring anything earlier (as people configuring "10" as property value)

not a problem, just a stupid surprising edge case: people who configure like this don't really care the actual value, they just want RB archive binary and no failure (and no zip file that any zip tool is confused with)

This sounds like an uncomprehendable hack

@hboutemy
Copy link
Member Author

hboutemy commented Sep 26, 2025

This sounds like an uncomprehendable hack

true, I must confess :/

there is probably a simpler algorithm to explain:
we have RB normalization for zip archives in Plexus Archiver https://github.com/codehaus-plexus/plexus-archiver/blob/master/src/main/java/org/codehaus/plexus/archiver/zip/AbstractZipArchiver.java#L686 = what makes zip binary output stable whatever the TZ of the user (= the root cause of all this mess: zip stores local time without TZ info = what is hard to get initially)

what we need to avoid the current edge case is to get a negative value from dosToJavaTime(lastModifiedTime.toMillis()), whatever the timezone of the user (see the implementation of dosToJavaTime)

this is where we need to force a minimal value

@hboutemy
Copy link
Member Author

hboutemy commented Sep 27, 2025

thanks for the discussion: I think I found the right fix that can be understood
= codehaus-plexus/plexus-archiver#388

the minimal value is not a magical black box: it is based on most extreme timezone offset from real life

and it is specific to zip format, not other types of archives

with this plexus-archiver PR merged and used in maven-archiver in the current branch, I get

$ zipdetails target/test/dummy-1970.jar | head -30

0000 LOCAL HEADER #1       04034B50
0004 Extract Zip Spec      0A '1.0'
0005 Extract OS            00 'MS-DOS'
0006 General Purpose Flag  0800
     [Bit 11]              1 'Language Encoding'
0008 Compression Method    0000 'Stored'
000A Last Mod Time         00210000 'Tue Jan  1 01:00:00 1980'
000E CRC                   00000000
0012 Compressed Length     00000000
0016 Uncompressed Length   00000000
001A Filename Length       0009
001C Extra Length          002D
001E Filename              'META-INF/'
0027 Extra ID #0001        5455 'UT: Extended Timestamp'
0029   Length              0005
002B   Flags               '01 mod'
002C   Mod Time            00000000 'Thu Jan  1 01:00:00 1970'
0030 Extra ID #0002        000A 'NTFS FileTimes'
0032   Length              0020
0034   Reserved            00000000
0038   Tag1                0001
003A   Size1               0018
003C   Mtime               019DB1DED53E8000 'Thu Jan  1 01:00:00
                           1970 0ns'
0044   Atime               0000000000000000 'Mon Jan  1 00:09:21
                           1601 0ns'
004C   Ctime               0000000000000000 'Mon Jan  1 00:09:21
                           1601 0ns'

Mod Time at 00000000 instead of previous FFFFF1FA is all the plexus-archiver PR is about:

0027 Extra ID #0001        5455 'UT: Extended Timestamp'
0029   Length              0005
002B   Flags               '01 mod'
002C   Mod Time            00000000 'Thu Jan  1 01:00:00 1970'

@hboutemy
Copy link
Member Author

hboutemy commented Oct 5, 2025

superceded by #320

@hboutemy hboutemy closed this Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants