rust-lang / miri

An interpreter for Rust's mid-level intermediate representation
Apache License 2.0
4.17k stars 320 forks source link

Add `-Zmiri-env-set` to set environment variables without modifying the host environment #3493

Closed eduardosm closed 2 months ago

eduardosm commented 2 months ago

This option allows to pass environment variables to the interpreted program without needing to modify the host environment (which may have undesired effects in some cases).

RalfJung commented 2 months ago

Doesn't rustc have some flag to sent env vars nowadays? Should we just reuse that instead of adding our own?

eduardosm commented 2 months ago

I'm not aware of such flag

RalfJung commented 2 months ago

https://github.com/rust-lang/compiler-team/issues/653 was the decision to add it. Tracking issue is at https://github.com/rust-lang/rust/issues/118372, so it seems to have been implemented.

eduardosm commented 2 months ago

Do we want the same flag for compile-time env! and run-time std::env::var?

RalfJung commented 2 months ago

Do we want the same flag for compile-time env! and run-time std::env::var?

Fair, I guess it makes sense to treat them separately.

oli-obk commented 2 months ago

@bors r+

bors commented 2 months ago

:pushpin: Commit 506ffc90c00688bd6c953ed953cf708415dc8b00 has been approved by oli-obk

It is now in the queue for this repository.

bors commented 2 months ago

:hourglass: Testing commit 506ffc90c00688bd6c953ed953cf708415dc8b00 with merge 98f3480476ece5be10616da7dca0c8d61781989a...

bors commented 2 months ago

:sunny: Test successful - checks-actions Approved by: oli-obk Pushing 98f3480476ece5be10616da7dca0c8d61781989a to master...