Too much escaping when printing paths on Windows
Open
Nobody has claimed this yet.
windows
- Dominant language
- OCaml
- Stars
- 1.9k
- Forks
- 500
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 277
Description
I ran into an overlapped dependency issue and was surprised by the error message:
Error: Conflict between the following libraries:
- "extunix" in _build/default/extunix/src
- "extunix" in
"C:\\\\Users\\\\antonin\\\\.opam\\\\ocaml-variants.4.12.0+socketpair+mingw64\\lib\\extunix"
-> required by library "capnp-rpc-unix" in
"C:\\\\Users\\\\antonin\\\\.opam\\\\ocaml-variants.4.12.0+socketpair+mingw64\\lib\\capnp-rpc-unix"
-> required by library "shared" in _build/default/bin
-> required by executables client and admin in bin/dune:10
Error: Conflict between the following libraries:
- "extunix" in _build/default/extunix/src
- "extunix" in
"C:\\\\Users\\\\antonin\\\\.opam\\\\ocaml-variants.4.12.0+socketpair+mingw64\\lib\\extunix"
-> required by library "capnp-rpc-unix" in
"C:\\\\Users\\\\antonin\\\\.opam\\\\ocaml-variants.4.12.0+socketpair+mingw64\\lib\\capnp-rpc-unix"
-> required by library "shared" in _build/default/bin
-> required by library "worker" in _build/default/bin
-> required by executables scheduler_windows and worker_windows in
bin/dune:35
Error: Conflict between the following libraries:
- "extunix" in _build/default/extunix/src
- "extunix" in
"C:\\\\Users\\\\antonin\\\\.opam\\\\ocaml-variants.4.12.0+socketpair+mingw64\\lib\\extunix"
-> required by library "capnp-rpc-unix" in
"C:\\\\Users\\\\antonin\\\\.opam\\\\ocaml-variants.4.12.0+socketpair+mingw64\\lib\\capnp-rpc-unix"
- The first part of the path (to the Opam switch root) is escaped twice, it should be only once;
- My guess is that
String.escapeescapes each backslash with a second backslash. However for the case of printing file paths that's unneeded and rather ugly.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the error-message path formatting and inspect String.escape, using the Windows dependency-conflict output in the issue as the reproduction. Check how backslashes are represented in printed paths and add or run a focused regression test if the relevant test entry point is found. Done means Windows paths are readable without unnecessary double escaping while other escaped output remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100