-
Notifications
You must be signed in to change notification settings - Fork 44
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
fsutil: Explicit parent directory creation #76
Conversation
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 bugs 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.
bd81485
to
f85d1ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, just one naming and comment suggestion :)
332c567
to
e723ac2
Compare
18d3f3a
to
516f287
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can we please just get the docs fixed? Happy to merge this as-is if you'd rather do that separately.
0703150
to
cacbdf7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks for the iteration @woky :)
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.