Closed
Description
Expected Behavior
I would expect dune exec ./main.exe
to be equivalent to dune build ./main.exe && _build/default/main.exe
(assuming main.ml
is at the root).
(dune exec --help
says that it should actually be equivalent to dune install; COMMAND
, which is close enough.)
Actual Behavior
Filename.get_temp_file_name
returns something like/tmp/build_596b2c_dune
instead of/tmp
.- Moreover, this temporary directory seems to be deleted after the process exits. This is a breaking change for the
--keep-temp
flag of Tezt. Sys.argv.(0)
is an absolute path (it used to typically be relative, starting with_build
). This broke Tezt's cram tests in a way that is hard to fix for both Dune 3.19.0 and Dune 3.18.2.- Some other environment variables are modified (but this was already the case before 3.19.0 so this is out of scope for this issue — in case you're curious, this breaks this script in some cases).
I would suggest to at least document those changes in the changelog. The absolute path is probably not worth a fix, but the behavior of the temporary directory is puzzling.
Maybe 2603202 fixes some of the issues, but I failed to compile Dune (I tried something like ./configure && make bootstrap && make install
, the latter step failed because of a lack of .install
; and make release
failed with an uncaught Not_found
).
Reproduction
main.ml
:
let () =
Printf.printf "argv0 = %S\n%!" Sys.argv.(0);
let tmp = Filename.get_temp_dir_name () in
Printf.printf "tmp = %S\n%!" tmp;
let ch = open_out (Filename.concat tmp "dune-test") in
close_out ch
dune
:
(executable (name main))
dune-project
:
(lang dune 3.19)
Then run:
dune exec ./main.exe
ls /tmp/build*dune
For instance, I got:
cd /tmp/abc/ && dune exec ./main.exe && ls /tmp/build*dune
argv0 = "/tmp/abc/_build/default/main.exe"
tmp = "/tmp/build_596b2c_dune"
zsh:1: no matches found: /tmp/build*dune
Specifications
- Version of
dune
(output ofdune --version
): 3.19.0 - Version of
ocaml
(output ofocamlc --version
): 5.2.1 - Operating system (distribution and version): Debian testing
Additional information
- Link to gist with verbose output (run
dune
with the--verbose
flag): (none)