From 63a732e1d48fd22afc8d515c93cba52ea5ad90c4 Mon Sep 17 00:00:00 2001 From: Pushkar Singh Date: Tue, 23 Jun 2026 19:44:58 +0000 Subject: [PATCH] show env: accept absolute workspace paths Signed-off-by: Pushkar Singh --- bin/printenv.ml | 5 ++++- .../test-cases/absolute-paths/show-env-absolute.t | 14 ++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bin/printenv.ml b/bin/printenv.ml index c4865ee6349..b0938cba704 100644 --- a/bin/printenv.ml +++ b/bin/printenv.ml @@ -93,7 +93,10 @@ let term = Build.build_memo_exn (fun () -> let open Memo.O in let* setup = Util.setup () in - let dir = Path.of_string dir in + let dir = + Path.of_string dir + |> Path.Expert.try_localize_external + in let checked = Util.check_path setup.contexts dir in let request = Action_builder.all diff --git a/test/blackbox-tests/test-cases/absolute-paths/show-env-absolute.t b/test/blackbox-tests/test-cases/absolute-paths/show-env-absolute.t index f6b5067b9e8..cedc71dbc34 100644 --- a/test/blackbox-tests/test-cases/absolute-paths/show-env-absolute.t +++ b/test/blackbox-tests/test-cases/absolute-paths/show-env-absolute.t @@ -22,24 +22,22 @@ work identically to the relative form. Today it errors as if the path were outside the project. $ dune show env $PWD --field flags - Error: Environment is not defined for external paths - [1] + (flags + (-short-paths -keep-locs -warn-error +a -w +27)) CR-someday Alizter: the same call from a subdirectory should also resolve. (--root is required because INSIDE_DUNE disables workspace auto-detection.) $ (cd subdir && dune show env --root .. $PWD --field flags) - Entering directory '..' - Error: Environment is not defined for external paths - Leaving directory '..' - [1] + (flags + (-short-paths -keep-locs -warn-error +a -w +27)) CR-someday Alizter: absolute paths to subdirectories of the workspace should be accepted. $ dune show env $PWD/subdir --field flags - Error: Environment is not defined for external paths - [1] + (flags + (-short-paths -keep-locs -warn-error +a -w +27)) Absolute paths that are genuinely outside the workspace must continue to fail with a clean error. This behaviour must not regress.