[BUG] [stdlib] Stop passing assert_aborts child state through environment variables
Nobody has claimed this yet.
- Dominant language
- Mojo
- Stars
- 29.8k
- Forks
- 3.2k
- PR merge metrics
- No merged PRs in 30d
Description
Review Mojo's priorities
- I have read the roadmap and priorities and I believe this request falls within the priorities.
What is your request?
_assert_aborts currently coordinates parent/child state (which call site to run, where to redirect output, etc..) by setenv-ing on the current process and relying on Process.run to inherit it into the child.
- Mutating our own env before spawning and unsetting after is a TOCTOU hazard! Anything else touching the environment concurrently can race with it.
- The output path goes through an env var + a file on disk, when it could just be an fd passed directly to the child.
Process.runcould growenvpsupport so we don't have to mutate our own process environment at all. And fd-passing so we don't need a temp file path either and would also likely be more portable. - There's also a real correctness gap from relying on envvar presence. If the location var is ever pre-set to a string that happens to match a real call site, the top-level process mistakes itself for the child and abort the whole suite in place instead of a child.
Ideally we could add envp (and ideally fd-passing) support to Process.run, then switch assert_aborts to use that instead of mutating/reading its own environment.
What is your motivation for this change?
N/A
Any other details?
No response
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 stdlib's _assert_aborts and Process.run paths, focusing on how child state, environment variables, output redirection, and call-site selection are passed. Done means assert_aborts no longer mutates or relies on the parent environment, and Process.run provides the needed child-process configuration without the described temporary-file path.
Written by the indexing model from the issue text.
Assessment
- Domain
- operating-systems, testing
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100