ocaml / ocaml/dune

env-vars ignored under exec

Open
#3,638 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected Behavior

manual says env-vars apply under exec/build but don't appear to.

Actual Behavior

env-vars are not set.

Reproduction

dune file:

(env
 (_
  (env-vars (XYZ 10))
))

(executable
 (name envar)
)

src file:

let _=
 try
  let v= Sys.getenv "XYZ" in
 print_endline@@"ENV: "^v
 with _->
        print_endline "not found"

running [dune exec ./envar.exe] gets 'not found'.

  • PR with a reproducing test:
  1. as per the example given

Specifications

  • Version of dune (output of dune --version): 2.5.1
  • Version of ocaml (output of ocamlc --version) 4.07.1
  • Operating system (distribution and version): ubuntu x86-64

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 the provided dune file and OCaml source, then run the reproduction with dune exec ./envar.exe on the stated Dune and OCaml versions. Check the env-vars behavior under exec and add a reproducing regression test following the testing guidance in HACKING.md. Done means XYZ is available to the executable and the test verifies it.

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
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.