Unable to include s-expression files in `env-vars` stanza
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 1.9k
- Forks
- 500
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 277
Description
Given a dune-workspace file as follows,
(lang dune 2.0)
(env
(_ (env-vars ("a" "a-value") (:include ./more-vars.sexp))))
... Dune is unable to include values from a sexp file
Expected Behavior
Dune includes values from the s-expression file
Actual Behavior
Dune creates and env value :include with value "./more-vars.sexp"
When extra parens are added around :include, there is a syntax error
File "dune-workspace", line 4, characters 32-59:
4 | (_ (env-vars ("a" "a-value") ((:include ./more-vars.sexp)))))
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Atom or quoted string expected
Reproduction
(happy to create a PR with a failing test if this indeed is a bug)
- Create workspace file
(lang dune 2.0)
(env
(_ (env-vars ("a" "a-value") ((:include ./more-vars.sexp)))))
- Create
more-vars.sexpwith some key value pairs (optional)
("b" "b-value"
- Run
dune exec -- envand look for environment variablesaandb(bwont be created)
Specifications
- Version of
dune(output ofdune --version): 2.8.5 - Version of
ocaml(output ofocamlc --version): 4.12.0 - Operating system (distribution and version): Linux
Additional information
Context: I was trying to work around https://github.com/ocaml/dune/issues/108 with a shell script that scans _opam and creates linker flags and hand it down to dune (via a configurator). Users would have to ./load-env.sh && dune build. This was fine and it worked. I was looking for a way to craft the new environment inside configurator but set the environment globally for the entire project, so that users dont have to run the additional ./load-env.sh script before running dune build
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
Reproduce the behavior with the shown dune-workspace and more-vars.sexp files, then run dune exec -- env and inspect how the env-vars stanza handles :include. Done means the included key-value pairs appear in the command environment without treating :include as a literal variable or raising the shown syntax error.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100