Skip to content

exclude TERM env var by default #2018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ environment variable:
`warn` prints a full backtrace when that happen; `warn-nobacktrace` is less
verbose. `hide` hides the warning entirely.
* `-Zmiri-env-exclude=<var>` keeps the `var` environment variable isolated from the host so that it
cannot be accessed by the program. Can be used multiple times to exclude several variables. On
Windows, the `TERM` environment variable is excluded by default. This has no effect unless
cannot be accessed by the program. Can be used multiple times to exclude several variables. The
`TERM` environment variable is excluded by default to [speed up the test
harness](https://github.com/rust-lang/miri/issues/1702). This has no effect unless
`-Zmiri-disable-validation` is also set.
* `-Zmiri-env-forward=<var>` forwards the `var` environment variable to the interpreted program. Can
be used multiple times to forward several variables. This has no effect if
Expand Down
8 changes: 3 additions & 5 deletions src/shims/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ impl<'tcx> EnvVars<'tcx> {
forwarded_env_vars: Vec<String>,
) -> InterpResult<'tcx> {
let target_os = ecx.tcx.sess.target.os.as_str();
if target_os == "windows" {
// Temporary hack: Exclude `TERM` var to avoid terminfo trying to open the termcap file.
// Can be removed once https://github.com/rust-lang/miri/issues/1013 is resolved.
excluded_env_vars.push("TERM".to_owned());
}
// HACK: Exclude `TERM` var to avoid terminfo trying to open the termcap file.
// This is (a) very slow and (b) does not work on Windows.
excluded_env_vars.push("TERM".to_owned());

// Skip the loop entirely if we don't want to forward anything.
if ecx.machine.communicate() || !forwarded_env_vars.is_empty() {
Expand Down