Skip to content

create the directory for a directory entry with no trailing slash - #448

Open
jmestwa-coder wants to merge 1 commit into
kuba--:masterfrom
jmestwa-coder:dirflag-entry-mkdir
Open

create the directory for a directory entry with no trailing slash#448
jmestwa-coder wants to merge 1 commit into
kuba--:masterfrom
jmestwa-coder:dirflag-entry-mkdir

Conversation

@jmestwa-coder

Copy link
Copy Markdown
Contributor

A directory entry can be spelled with the DOS directory bit instead of a trailing slash. Nothing creates that directory, so the mode restore in zip_archive_extract lands on whatever already occupies the path:

  • keep.txt carrying the dir bit and mode 0777 turns an existing 0600 keep.txt into 0777 without a byte of it being written, and zip_extract returns 0
  • with nothing at that path the chmod fails ENOENT and the extraction aborts with ZIP_ENOPERM, and the directory is never created
  • zip_mkpath only creates components that end at a separator, which is why the trailing-slash spelling is covered and this one is not

Creates the directory for that spelling, and returns ZIP_ECHKDIR when the path is held by something that is not a directory, the same as zip_mkpath does. zip_entry_fread is unaffected, it rejects directory entries before its own chmod. Two tests under test_extract cover both halves; they fail on master with 0 and ZIP_ENOPERM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant