-
Notifications
You must be signed in to change notification settings - Fork 18k
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: duplicate entries in FS interface #45345
Comments
@gopherbot Please open backport to 1.16. This appears to be a bug in the |
Backport issue(s) opened: #45347 (for 1.16). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
related / duplicate of #43872 ? |
I think you're right, the two 'duplicate' entries are of |
Change https://golang.org/cl/311530 mentions this issue: |
Change https://golang.org/cl/315249 mentions this issue: |
…o/fs.FS While we're here fix the ModTime value for directories. For #43872 For #45345 Fixes #45347 Change-Id: I155e6517713ef6a9482b9431f1167a44337c6ad2 Reviewed-on: https://go-review.googlesource.com/c/go/+/311530 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jeremy Faller <jeremy@golang.org> (cherry picked from commit 87e4dcd) Reviewed-on: https://go-review.googlesource.com/c/go/+/315249 Trust: Jeremy Faller <jeremy@golang.org>
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?
https://play.golang.org/p/u56BwqIWsKq
In short: calling fs.ReadDir on a *zip.Reader.
What did you expect to see?
ReadDir should only return a single entry under a/, since there is only a single directory under it.
What did you see instead?
archive/zip's FS implementation seems to have treated a/b/ and a/b/c as two separate entries of the a/ directory, causing this behavior. Of course, one can work around this by creating a map of seen paths, but that just seems like extra hassle for something well-understood.
As a bonus, calling fs.WalkDir on a zip.Reader provides even more unexpected results (https://play.golang.org/p/spyKcwKc5TM):
The text was updated successfully, but these errors were encountered: