Skip to content

support leading "./" in filenames #29

@christianscott

Description

@christianscott

Bazel's zipper tool (@bazel_tools//tools/zip:zipper) can create archives that contain entries with a leading ./:

$ echo './README.md' > files.txt $ ./bazel-bin/external/bazel_tools/third_party/ijar/zipper cC archive.zip @files.txt $ unzip -l archive.zip Archive: archive.zip Length Date Time Name --------- ---------- ----- ---- 26319 2010-01-01 00:00 ./README.md --------- ------- 26319 1 file 

These entries are skipped by mount-zip because Path::Normalize fails: https://github.com/google/mount-zip/blob/main/lib/path.cc#L205-L206

$ ./mount-zip /tmp/archive.zip /tmp/mount/ mount-zip: Skipped File [0]: Cannot normalize path './mount-zip.1' 

It works if I skip these segments instead of failing:

 if (part == ".") continue; if (part.empty() || part == "..") return false;
$ ll /tmp/mount/ total 26K -rw-r--r-- 1 user user 26K Jan 1 2010 README.md 

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions