Skip to content

Commit

Permalink
feature: sandbox menhir actions
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: ba679cfd-9795-4bfb-902d-24ab89eaaf39
  • Loading branch information
rgrinberg committed Aug 16, 2022
1 parent b3333f5 commit dba4e39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

- Cinaps actions are now sandboxed by default (#6062, @rgrinberg)

- Menhir rules are now sandboxed by default (#6076, @rgrinberg)

3.4.1 (26-07-2022)
------------------

Expand Down
8 changes: 7 additions & 1 deletion src/dune_rules/menhir_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ module Run (P : PARAMS) = struct

let expander = Compilation_context.expander cctx

let sandbox =
let scope = Compilation_context.scope cctx in
let project = Scope.project scope in
if Dune_project.dune_version project < (3, 5) then Sandbox_config.default
else Sandbox_config.needs_sandboxing

(* ------------------------------------------------------------------------ *)

(* Naming conventions. *)
Expand Down Expand Up @@ -109,7 +115,7 @@ module Run (P : PARAMS) = struct
let menhir (args : 'a args) :
Action.Full.t Action_builder.With_targets.t Memo.t =
Memo.map menhir_binary ~f:(fun prog ->
Command.run ~dir:(Path.build build_dir) prog args)
Command.run ~sandbox ~dir:(Path.build build_dir) prog args)

let rule ?(mode = stanza.mode) :
Action.Full.t Action_builder.With_targets.t -> unit Memo.t =
Expand Down

0 comments on commit dba4e39

Please sign in to comment.