diff --git a/CHANGES.md b/CHANGES.md index 828240cce389..c3cf0a5e9246 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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. @@ -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) ------------------ diff --git a/src/action_exec.ml b/src/action_exec.ml index 0c591e1fa02a..045d72244464 100644 --- a/src/action_exec.ml +++ b/src/action_exec.ml @@ -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 =