Skip to content

show env: accept absolute workspace paths#15296

Open
pushkarscripts wants to merge 1 commit into
ocaml:mainfrom
pushkarscripts:ps/fix-show-env-absolute-paths
Open

show env: accept absolute workspace paths#15296
pushkarscripts wants to merge 1 commit into
ocaml:mainfrom
pushkarscripts:ps/fix-show-env-absolute-paths

Conversation

@pushkarscripts

Copy link
Copy Markdown

Fixes #15104.

dune describe env currently rejects absolute paths even when they point inside the workspace because the argument is classified as External immediately after Path.of_string.

This change localizes workspace-relative absolute paths using Path.Expert.try_localize_external before calling Util.check_path.

Verified behavior:

  • dune describe env . continues to work
  • dune describe env "$PWD" now works
  • dune describe env "$PWD/subdir" now works
  • dune describe env /tmp continues to report Environment is not defined for external paths

The issue can be reproduced on current main and is resolved by this change.

@Alizter

Alizter commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Hi @pushkarscripts, thanks for the PR. I opened #15114 a little bit ago, could you rebase on top of that so we can see the test update?

@pushkarscripts pushkarscripts force-pushed the ps/fix-show-env-absolute-paths branch 2 times, most recently from c00a9d8 to 93cf43c Compare June 27, 2026 16:59
@pushkarscripts

Copy link
Copy Markdown
Author

Hi @pushkarscripts, thanks for the PR. I opened #15114 a little bit ago, could you rebase on top of that so we can see the test update?

Done! I've rebased it.

Signed-off-by: Pushkar Singh <pushkarkumarsingh1970@gmail.com>
@pushkarscripts pushkarscripts force-pushed the ps/fix-show-env-absolute-paths branch from 93cf43c to 63a732e Compare June 27, 2026 20:03

@Alizter Alizter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs a changes entry

(-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.)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prose needs to be updated now that the test is exhibiting the correct behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dune show env rejects absolute paths

2 participants