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
Create a zip archive containing a directory entry.
Open a zip.Reader for that archive.
Open the zip.File for the directory entry using (*zip.Reader).Open and Read it.
Open the zip.File for the directory by calling (*zip.File).Open and Read it.
What did you expect to see?
The same contents (and same error code) regardless of how the directory entry was opened.
What did you see instead?
The reader opened via (*zip.Reader).Open returns a non-nil error like read dir: is a directory.
The reader opened via (*zip.File).Open returns 0, io.EOF.
It's a clear bug for the zip.File.Open result to return io.EOF from a read on a directory. We should fix that. This is the kind of thing that can come with a GODEBUG to ease any transition (#56986).
Note that we should update HashZip (#53448) to avoid the error before or at the same time as making this change, so that module archives that work today keep hashing to the same value rather than failing to hash at all.
What version of Go are you using (
go version
)?https://pkg.go.dev/archive/zip@go1.20rc3
Does this issue reproduce with the latest release?
Yes
What did you do?
(https://go.dev/play/p/NFjouX0xrQk?v=gotip)
zip
archive containing a directory entry.zip.Reader
for that archive.zip.File
for the directory entry using(*zip.Reader).Open
andRead
it.zip.File
for the directory by calling(*zip.File).Open
andRead
it.What did you expect to see?
The same contents (and same error code) regardless of how the directory entry was opened.
What did you see instead?
The reader opened via
(*zip.Reader).Open
returns a non-nil error likeread dir: is a directory
.The reader opened via
(*zip.File).Open
returns0, io.EOF
.(attn @dsnet @bradfitz; CC @neild)
The text was updated successfully, but these errors were encountered: