canonical / chisel

GNU Affero General Public License v3.0
270 stars 42 forks source link

fsutil: Explicit parent directory creation #76

Closed woky closed 1 year ago

woky commented 1 year ago

Currently fsutil.Create() always creates missing parent directories with 0755 mode. While this is handy for some use cases, during extraction we want to create every path with attributes from the tarball and having parent directories created automatically hides the bugs where we fail to create some directories from the tarball.

One such bug is when a glob matches. In this case, the directories before wildcards are created by os.MkdirAll() in fsutil.Create().

Don't fix the bug now but make the creation of the parent directories explicit in CreateOptions with the Dirs attribute. Later, we will drop it from call sites where appropriate.

cjdcordeiro commented 1 year ago

thanks @niemeyer .

LGTM. Can we please just get the docs fixed? Happy to merge this as-is if you'd rather do that separately.

@woky let's fix it here if possible, and only then merge ;)

woky commented 1 year ago

thanks @niemeyer .

LGTM. Can we please just get the docs fixed? Happy to merge this as-is if you'd rather do that separately.

@woky let's fix it here if possible, and only then merge ;)

Updated comments.