Skip to content

dune build over RPC misresolves relative targets from client subdir #15106

@Alizter

Description

@Alizter

Sub-issue of #12230. Latent bug discovered while tracing through the
RPC dispatch sites.

When a watch server is running and a client invokes
dune build <target> from a subdirectory, the target name is sent
verbatim over RPC. The server resolves it via its own
reach_from_root_prefix (anchored at the workspace root), so a target
the user typed relative to their own cwd is misresolved. Symptom:
Error: Don't know how to build <target> even though the target is
present relative to the user's cwd.

The RPC protocol does not carry the client's cwd, so any command that
takes path-like positional arguments and runs over RPC has this shape
of bug. See sibling issues for the dune runtest and dune fmt
variants.

Fix direction is open to discussion: client-side resolution before
sending (analogous to runtest), or extending the RPC request to carry
the client's cwd so the server can resolve correctly. For dune build
the choice is less obvious than for runtest because targets are not
plain files — variable expansion (%{...}) interacts with the cwd in
ways that need to be decided before any code change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildIssue related to what dune buildrpcDune's RPC server and client support

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions