fsutil: Explicit parent directory creation#76
Merged
jnsgruk merged 4 commits intocanonical:mainfrom Aug 29, 2023
Merged
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
Member
TheSignPainter98
left a comment
There was a problem hiding this comment.
Code looks good, just one naming and comment suggestion :)
332c567 to
e723ac2
Compare
jnsgruk
approved these changes
Aug 10, 2023
18d3f3a to
516f287
Compare
TheSignPainter98
approved these changes
Aug 10, 2023
rebornplusplus
approved these changes
Aug 10, 2023
cjdcordeiro
approved these changes
Aug 15, 2023
niemeyer
approved these changes
Aug 28, 2023
Contributor
niemeyer
left a comment
There was a problem hiding this comment.
LGTM. Can we please just get the docs fixed? Happy to merge this as-is if you'd rather do that separately.
niemeyer
reviewed
Aug 28, 2023
Collaborator
0703150 to
cacbdf7
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.