Skip to content
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

Closed

Conversation

rgrinberg
Copy link
Member

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

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
@rgrinberg rgrinberg requested review from snowleopard and removed request for snowleopard August 8, 2022 23:13
@@ -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. *)
Copy link
Collaborator

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
Copy link
Collaborator

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?

Copy link
Collaborator

@snowleopard snowleopard left a 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?

@rgrinberg
Copy link
Member Author

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.

@snowleopard
Copy link
Collaborator

@rgrinberg I think I prefer the other, more general PR. Shall we close this one then?

@rgrinberg
Copy link
Member Author

Yeah, I prefer the other PR as well.

@rgrinberg rgrinberg closed this Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants