-
Notifications
You must be signed in to change notification settings - Fork 427
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
Cache: only store executable permission bit #11541
Conversation
I've merged #11534 so you can rebase now :-) |
2be4ff3
to
359a4ed
Compare
Done! |
{ st_kind = stats.st_kind; st_perm = stats.st_perm } | ||
(* Check if any of the +x bits are set, ignore read and write *) | ||
let executable = 0o111 land stats.st_perm <> 0 in | ||
{ st_kind = stats.st_kind; executable } |
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.
I kinda wonder whether Path.Permissions.executable
would make sense to be used here, but maybe it is not worth the hassle.
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.
Path.Permissions.(test executable)
will only test if the flag is set for the current user (u+x, or 0o100
)
I wanted here to explicitly test if that flag is set for anyone.
Granted, files with [u-x g+x o+x] are probably few and far between, but still.
Is there a discussion of this design change anywhere? I'm curious for the motivation. |
There is only the discussion happening in the issue #11533. My motivation was fixing the issue :) |
I'm curious: do we know the effect it will have on existing cache codebase? Will it retrigger the computation for the already cached elements? |
I would assume so since the change is in |
Note that we can't just change the behavior and call it a fix. This is observable from build rules. Concretely, if you have a rule like this:
The That "simplified" mode like git uses might be beneficial, but it can be surprising, and there might be build rules that depend on the full permissions. |
In such case storing and restoring the exact permissions should be 100% backwards compatible, while also solving the issue. Is it worth adjusting the cache representation to allow to store the permissions? I don't know, it could be also some change that will not make a difference in real life. @rgrinberg What's your take on this? |
I'm working on a PR to do just that, as I think the naive approach of this PR may be too naive |
Seems fine to me. CHANGES entry please. |
I've added a CHANGES entry. I tried doing what is suggested above, you can see my progress [here].(https://github.com/ocaml/dune/compare/main...ElectreAAS:dune:digest-full-perm?expand=1)
edit: I feel like I'm going somewhere with my other approach, stay tuned |
I'm not sure restoring the full permissions is desirable, as I explained in #11533 . Most notably, if dune cache still removes write permissions in hardlink mode the interaction will be weird. Using I don't think "group" and "other" permissions belong in a cache or a versioning system since they are local to each machine, I'm not sure it's worth dealing with the weird |
56b5aed
to
746d4ae
Compare
Signed-off-by: Ambre Austen Suhamy <ambre@tarides.com>
Signed-off-by: Ambre Austen Suhamy <ambre@tarides.com>
746d4ae
to
4140e38
Compare
Oh sorry I missed your message there. Even if it still feels wrong to change the behaviour, as pointed by emillon, I think you've convinced me, so let's go with this approach. |
This PR is built on top of
the not-yet-merged #11534main!, and includes the fix proposed in #11533.We just stop storing the read & write permissions bits, only store the executable one. The strategy is the same as in git, we check if any of the u+x/g+x/o+x bits are set.