-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
archive/zip: improve Zip64 compatibility with 7z #69415
Comments
I'd like to propose the potential fix for this issue. |
CC @dsnet, @bradfitz, @ianlancetaylor. |
Quoting https://go.dev/cl/612595: Symptoms: Reasons:
Solution:
|
CC @dsnet |
Note that changing this might invalidate checksums based on the full content of zip files for files created before this change. Go modules containing files greater than 4 GB could be affected. That behavior can be made opt-in or at least needs a Go experiment flag to opt out. |
Go version
go1.23.1
Output of
go env
in your module/workspace:What did you do?
** Prepare two files with each size of 5G, 1M
$ touch test_5G
$ shred -n 1 -s 5G test_5G
$ touch test_1M
$ shred -n 1 -s 1M test_1M
** Create zipfile to have 5G file
zipfile, err := os.Create("s5G.zip")
zipWriter := zip.NewWriter(zipfile)
newfile, err := os.Open("test_5G")
fileInfo, err := newfile.Stat()
header, err := zip.FileInfoHeader(fileInfo)
header.Name = "test_5G"
header.Method = zip.Deflate
writer, err := zipWriter.CreateHeader(header)
_, err = io.Copy(writer, newfile)
** Get 7z from https://sourceforge.net/projects/sevenzip/files/7-Zip/23.01/ or higher
and try to add 1M file to created zip
$ 7zz a s5G.zip test_1M
What did you see happen?
7-Zip (z) 23.01 (x86) : Copyright (c) 1999-2023 Igor Pavlov : 2023-06-20
32-bit ILP32 locale=en_US.utf8 Threads:96 OPEN_MAX:131072, ASM
Open archive: s5G.zip
WARNINGS:
Headers Error
--
Path = s5G.zip
Type = zip
WARNINGS:
Headers Error
Physical Size = 5370519708
64-bit = +
Characteristics = Zip64
Scanning the drive:
1 file, 1048576 bytes (1024 KiB)
Updating archive: s5G.zip
Keep old data in archive: 1 file, 5368709120 bytes (5120 MiB)
Add new data to archive: 1 file, 1048576 bytes (1024 KiB)
System ERROR:
E_NOTIMPL : Not implemented
What did you expect to see?
Everything is OK without errs and the contents should be listed
$ unzip -l 5G.zip
Archive: 5G.zip
Length Date Time Name
1048576 2024-09-11 07:47 test_1M
5368709120 2024-09-11 07:50 test_5G
5369757696 2 files
The text was updated successfully, but these errors were encountered: