You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context: I'm working on some software which uses rubyzip in order to
stream files from zip archives. I am able to handle archives created by the zip command line utility,
but archives created by Go cannot be read because of missing local headers.
I archived the same file using the zip command line utility and with zip/archive.
$ zipdetails created_with_go.zip
0000 LOCAL HEADER #1 04034B50
0004 Extract Zip Spec 14 '2.0'
0005 Extract OS 00 'MS-DOS'
0006 General Purpose Flag 0008
[Bit 3] 1 'Streamed'
0008 Compression Method 0000 'Stored'
000A Last Mod Time 5518A8DA 'Wed Aug 24 21:06:52 2022'
000E CRC 00000000
0012 Compressed Length 00000000
0016 Uncompressed Length 00000000
001A Filename Length 0004
001C Extra Length 0009
001E Filename 'file'
0022 Extra ID #0001 5455 'UT: Extended Timestamp'
0024 Length 0005
0026 Flags '01 mod'
0027 Mod Time 630692ED 'Wed Aug 24 16:06:53 2022'
002B PAYLOAD file content.
0038 STREAMING DATA HEADER 08074B50
003C CRC 03695B76
0040 Compressed Length 0000000D
0044 Uncompressed Length 0000000D
0048 CENTRAL HEADER #1 02014B50
004C Created Zip Spec 14 '2.0'
004D Created OS 03 'Unix'
004E Extract Zip Spec 14 '2.0'
004F Extract OS 00 'MS-DOS'
0050 General Purpose Flag 0008
[Bit 3] 1 'Streamed'
0052 Compression Method 0000 'Stored'
0054 Last Mod Time 5518A8DA 'Wed Aug 24 21:06:52 2022'
0058 CRC 03695B76
005C Compressed Length 0000000D
0060 Uncompressed Length 0000000D
0064 Filename Length 0004
0066 Extra Length 0009
0068 Comment Length 0000
006A Disk Start 0000
006C Int File Attributes 0000
[Bit 0] 0 'Binary Data'
006E Ext File Attributes 81A40000
0072 Local Header Offset 00000000
0076 Filename 'file'
007A Extra ID #0001 5455 'UT: Extended Timestamp'
007C Length 0005
007E Flags '01 mod'
007F Mod Time 630692ED 'Wed Aug 24 16:06:53 2022'
ADD 0 13 CENTRAL HEADER ref Local #1: file
0083 END CENTRAL HEADER 06054B50
0087 Number of this disk 0000
0089 Central Dir Disk no 0000
008B Entries in this disk 0001
008D Total Entries 0001
008F Size of Central Dir 0000003B
0093 Offset to Central Dir 00000048
0097 Comment Length 0000
Done
$ zipdetails created_with_zip_utility.zip
0000 LOCAL HEADER #1 04034B50
0004 Extract Zip Spec 0A '1.0'
0005 Extract OS 00 'MS-DOS'
0006 General Purpose Flag 0000
0008 Compression Method 0000 'Stored'
000A Last Mod Time 551880DB 'Wed Aug 24 16:06:54 2022'
000E CRC 03695B76
0012 Compressed Length 0000000D
0016 Uncompressed Length 0000000D
001A Filename Length 000C
001C Extra Length 001C
001E Filename 'archive/file'
002A Extra ID #0001 5455 'UT: Extended Timestamp'
002C Length 0009
002E Flags '03 mod access'
002F Mod Time 630692ED 'Wed Aug 24 16:06:53 2022'
0033 Access Time 630692EE 'Wed Aug 24 16:06:54 2022'
0037 Extra ID #0002 7875 'ux: Unix Extra Type 3'
0039 Length 000B
003B Version 01
003C UID Size 04
003D UID 000001F5
0041 GID Size 04
0042 GID 00000014
0046 PAYLOAD file content.
0053 CENTRAL HEADER #1 02014B50
0057 Created Zip Spec 1E '3.0'
0058 Created OS 03 'Unix'
0059 Extract Zip Spec 0A '1.0'
005A Extract OS 00 'MS-DOS'
005B General Purpose Flag 0000
005D Compression Method 0000 'Stored'
005F Last Mod Time 551880DB 'Wed Aug 24 16:06:54 2022'
0063 CRC 03695B76
0067 Compressed Length 0000000D
006B Uncompressed Length 0000000D
006F Filename Length 000C
0071 Extra Length 0018
0073 Comment Length 0000
0075 Disk Start 0000
0077 Int File Attributes 0001
[Bit 0] 1 Text Data
0079 Ext File Attributes 81A40000
007D Local Header Offset 00000000
0081 Filename 'archive/file'
008D Extra ID #0001 5455 'UT: Extended Timestamp'
008F Length 0005
0091 Flags '03 mod access'
0092 Mod Time 630692ED 'Wed Aug 24 16:06:53 2022'
0096 Extra ID #0002 7875 'ux: Unix Extra Type 3'
0098 Length 000B
009A Version 01
009B UID Size 04
009C UID 000001F5
00A0 GID Size 04
00A1 GID 00000014
ADD 0 13 CENTRAL HEADER ref Local #1: archive/file
00A5 END CENTRAL HEADER 06054B50
00A9 Number of this disk 0000
00AB Central Dir Disk no 0000
00AD Entries in this disk 0001
00AF Total Entries 0001
00B1 Size of Central Dir 00000052
00B5 Offset to Central Dir 00000053
00B9 Comment Length 0000
Done
What did you expect to see?
The local headers on created_with_go.zip should have the CRC, Uncompressed Length, and Compressed Length fields filled in:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Context: I'm working on some software which uses rubyzip in order to
stream files from zip archives. I am able to handle archives created by the
zip
command line utility,but archives created by Go cannot be read because of missing local headers.
I archived the same file using the
zip
command line utility and withzip/archive
.Create the file:
mkdir archive && echo 'file content' > archive/file'
Create an archive using
zip
:zip created_with_zip_utility archive/file
Create an archive using this go program:
Use
zipdetails
to inspect both archives:What did you expect to see?
The local headers on
created_with_go.zip
should have the CRC, Uncompressed Length, and Compressed Length fields filled in:What did you see instead?
Instead, the fields are filled with zeroes:
The text was updated successfully, but these errors were encountered: