ocaml / ocaml/dune

wrong call to --ppx flags (slash issue)

Open
#5,378 18 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

windows
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

Expected Behavior

We should be able to execute test of ppx_import

Actual Behavior

We can't compile test

Reproduction

  • PR with a reproducing test: not yet
  1. clone
  2. dune runtest

Specifications

Additional information

I tried to debug:
This line seem the culprit https://github.com/ocaml/dune/blob/78fa5d22c3cc09345bfe3eb25fb57e0cd7e3c4bc/src/dune_rules/preprocessing.ml#L293

The command is: ocamldep.opt.exe -modules -ppx ".ppx/57e0400f3b219ff4fc65d1fbd820e35d/ppx.exe --as-ppx" -impl src_test/ppx_deriving_sexp/test_ppx_deriving_sexp.ml

Since -ppx go through Sys.command. So we need to not normalize:
ocamldep.opt.exe -modules -ppx ".ppx\57e0400f3b219ff4fc65d1fbd820e35d\ppx.exe --as-ppx" -impl src_test/ppx_deriving_sexp/test_ppx_deriving_sexp.ml work as intended.

I tried to replace with: Path.Build.L.relative build_dir (".ppx" :: key :: "ppx.exe" :: []) but Path module seem to like normalized path /:
https://github.com/ocaml/dune/blob/ef1ee9a0d175bb076d0debf917f7c67a3939af6a/otherlibs/stdune/path.ml#L253

Have you any pointer to continue ?

  • Link to gist with verbose output (run dune with the --verbose flag):

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/dune_rules/preprocessing.ml around line 293 and compare its path handling with otherlibs/stdune/path.ml around line 253. Run dune runtest for the ppx_import reproduction on Windows and inspect the generated ocamldep command. Done means the ppx test compiles and the command uses a Windows-compatible path without breaking other platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.