Skip to content

Place default trace file in the build directory#13735

Open
vouillon wants to merge 3 commits intoocaml:mainfrom
vouillon:trace
Open

Place default trace file in the build directory#13735
vouillon wants to merge 3 commits intoocaml:mainfrom
vouillon:trace

Conversation

@vouillon
Copy link
Member

@vouillon vouillon commented Mar 5, 2026

The default trace file path was hardcoded to _build/trace.csexp, resolved relative to the initial working directory. This meant it could end up outside the build directory when invoking dune from a subdirectory or when using a custom --build-dir.

Use Path.Build.root to resolve the default trace file path, placing it correctly inside the workspace's build directory. dune trace cat and dune trace commands now also find the trace file at the workspace root.

@Alizter
Copy link
Collaborator

Alizter commented Mar 5, 2026

@rgrinberg @shonfeder I think this can be considered a regression for 3.22. Probably best we include this fix for the release.

@Alizter Alizter requested a review from rgrinberg March 5, 2026 15:16
@shonfeder shonfeder mentioned this pull request Mar 5, 2026
15 tasks
@vouillon vouillon force-pushed the trace branch 2 times, most recently from ac1c30f to 1052c72 Compare March 5, 2026 17:39
@shonfeder
Copy link
Member

Anything preventing us merging here? It looks like its been approved, and it is marked as blocking the release.

@rgrinberg
Copy link
Member

This PR should not block the release. There's no rush in merging it. I'd prefer if collaborators were to look at it more closely.

Copy link
Collaborator

@Alizter Alizter left a comment

Choose a reason for hiding this comment

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

Can you rebase on top of:

So we can observe the fix a bit more clearly. We don't have to fix dune trace cat just yet however.

Signed-off-by: Ali Caglayan <alizter@gmail.com>
Copy link
Collaborator

@Alizter Alizter left a comment

Choose a reason for hiding this comment

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

If you can update the test I introduced with the changes, and modify the prose, also getting rid of the dune trace cat in the subdirectory, that would be great.

Rest looks good to me.

vouillon added 2 commits March 9, 2026 11:54
The default trace file path was hardcoded to `_build/trace.csexp`,
resolved relative to the initial working directory. This meant it
could end up outside the build directory when invoking dune from a
subdirectory or when using a custom `--build-dir`.

Use `Path.Build.root` to resolve the default trace file path, placing
it correctly inside the workspace's build directory. `dune trace cat`
and `dune trace commands` now also find the trace file at the
workspace root.

Signed-off-by: Jérôme Vouillon <jerome.vouillon@gmail.com>
`dune trace cat` from a subdirectory failed to find the trace file
because `Workspace_root.create` short-circuits to CWD when running
inside dune. Walk up from CWD looking for an existing
`_build/trace.csexp` instead.
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.

4 participants