-
Notifications
You must be signed in to change notification settings - Fork 412
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
fix: relax sandboxing check for dir targets #6054
Conversation
when a rule doesn't need sandboxing, it should still be able to produce directory targets. Signed-off-by: Rudi Grinberg <me@rgrinberg.com> ps-id: ca89fead-e8c3-41f1-a861-3916267fa439
@@ -476,10 +482,12 @@ end = struct | |||
in | |||
let produced_targets = | |||
match sandbox with | |||
| None -> | |||
| None -> ( | |||
(* Directory targets are not allowed for non-sandboxed actions, so | |||
the call below should not raise. *) |
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.
That's a stale comment, right? The above change allows directory targets for some non-sandboxed actions.
@@ -434,7 +434,13 @@ end = struct | |||
without sandboxing. We just need to make sure we clean up all stale | |||
directory targets before running the rule and then we can discover | |||
all created files right in the build directory. *) | |||
if not (Path.Build.Set.is_empty targets.dirs) then | |||
if |
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.
As the above comment says, we might need to do some preparation before running a non-sandboxed action that produces directory targets. What if those directories already contain some files, for example?
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.
Thanks for factoring out this change! It's much easier for me to think about it in isolation.
Could you add a test to make sure this relaxation actually works?
Thanks for reviewing. I've also made an alternative to this PR: #6056 It's a bit more complex, but also much more useful in general. In that PR I've allowed all non sandboxed actions to produce directory targets. |
@rgrinberg I think I prefer the other, more general PR. Shall we close this one then? |
Yeah, I prefer the other PR as well. |
when a rule doesn't need sandboxing, it should still be able to produce
directory targets.
Signed-off-by: Rudi Grinberg me@rgrinberg.com
ps-id: ca89fead-e8c3-41f1-a861-3916267fa439