Skip to content

Commit

Permalink
Do not allow actions to create dirs outside of build dir
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
  • Loading branch information
rgrinberg committed May 15, 2019
1 parent 12a7489 commit 25cf2a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ unreleased

- Add a 'cookies' option to ppx_rewriter/deriver flags in library stanzas
(#2106, @mlasson @diml). This allow to specify cookie requests from
variables expanded at each invocation of the preprocessor.
variables expanded at each invocation of the preprocessor.

- Add more opam metadata and use it to generate `.opam` files. In particular, a
`package` field has been added to specify package specific information.
Expand Down Expand Up @@ -65,6 +65,10 @@ unreleased
- Make `dune subst` add a `(version ...)` field to the `dune-project`
file (#2148, @diml)

- Fine tune directory creation in dune. Dune will never complain if the
directory exists but forbid the user from creating source or external
directories with the `mkdir` action. (#2159, fix #2158, @rgrinberg)

1.9.3 (06/05/2019)
------------------

Expand Down
9 changes: 8 additions & 1 deletion src/action_exec.ml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,14 @@ let rec exec t ~ectx ~dir ~env ~stdout_to ~stderr_to =
Path.rm_rf path;
Fiber.return ()
| Mkdir path ->
Path.mkdir_p path;
begin
if Path.is_in_build_dir path then
Path.mkdir_p path
else if Path.exists path then
()
else
die "action attempted to create %a outside the build dir" Path.pp path
end;
Fiber.return ()
| Digest_files paths ->
let s =
Expand Down

0 comments on commit 25cf2a9

Please sign in to comment.