-
Notifications
You must be signed in to change notification settings - Fork 18k
archive/zip: File's reader returns io.EOF prematurely #32858
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
Comments
Usually Gerrit changesets also contain test(s) for the fix. |
@av86743 ok. I will add it tomorrow morning. Thanks |
archive/zip: zip.OpenReader panics when opened .zip file does not exist as shown by provided example https://play.golang.org/p/JvKpGINHHBY Panics similarly on |
Hello @odeke-em The underlying problem is that the Read function in a zip.File returns the io.EOF error in the last read call, when I think that the current behavior is wrong based on how other Readers works. Also, the io.Reader doc says:
|
Perhaps @odeke-em was going to suggest to add verbal description of a problem and/or solution to Gerrit issue, to facilitate the process of review? |
@dgrr I'm sorry, I don't understand. The docs for The docs for
It's not clear to me that there is any bug here. |
Yes, you are right. But it's kind of weird to see how this Reader works as other readers works. From my point of view, I see that maybe the best option should be to return the io.EOF error in the subsequent call. But it's just a suggestion here. |
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
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
What did you do?
The code: https://play.golang.org/p/JvKpGINHHBY
What did you expect to see?
Not a panic.
The panic doesn't happen if you read from an *os.File, *bufio.Reader or *bytes.Reader, it only happens with the Zip files because it prematurely returns the io.EOF error.
What did you see instead?
A panic.
Edit
https://go-review.googlesource.com/c/go/+/184122
The text was updated successfully, but these errors were encountered: