[dnm] testing if FileMode is affected by umask #4936
Draft
+2
−2
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.
I was trying to run a build stage as non-root user, but it uses some cache mounts. So I tried to mount the cache-mount with a specific group (gid), and set permissions to 0775 (instead of the default 0755) to allow the stage to write, but it looks like it still ends up with 0755 permissions.
Most minimal reproducer;
Which shows that the target has 0755 permissions;
Looking at that
settings cache mount permissions
message brings me to this code, which usesllb.Mkdir
;buildkit/frontend/dockerfile/dockerfile2llb/convert_runmount.go
Line 60 in 4b5bf7e
My initial assumption is that possibly the given filemode still gets an umask applied, causing the effective permissions to be different.
It's a bit hard to find where the actual
Mkdir
happens, because that function returns aFileOp
(which only contains the options), but looking through tests I see that there's various tests setting a mode, but all of them seem to use a mode that's not affected by umask (assuming default022
umask); most (if not "all") of them seem to be using (e.g.)0700
or0600
.Let's change a test to see if it fails, which may confirm my suspicion.