archive/zip: Reader.Open lies about directory fs.FileMode #48106
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
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/-MVV8qRhxxC roughly:
What did you expect to see?
drw-rw-rw-
(as derived fromzip.File.FileHeader.Mode()
)What did you see instead?
dr-xr-xr-x
Additional context?
It appears that the implementation of
Reader.Open
, specificallyfileListEntry.Mode
, instead of returning the actual mode contained infileListEntry.file.FileHeader.Mode
, will returns a hardcodedfs.FileMode
:I am guessing, but it seems like this was done since
fileListEntry.file
can benil
when the directory entry is synthetic, e.g. the zip contains a file without directory files leading to it, see #48084.If we wanted to hit two birds with one stone, since this would be a clear signal that "the directory file is missing", I think it would be reasonable to: (though it is a breaking change)
The text was updated successfully, but these errors were encountered: