Skip to content

stop excluding TERM env var on Unix #2471

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 2 commits into from
Aug 8, 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: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,8 @@ environment variable. We first document the most relevant and most commonly used
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. 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-isolation` is also set.
`TERM` environment variable is excluded by default in Windows to prevent the libtest harness from
accessing the file system. This has no effect unless `-Zmiri-disable-isolation` 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 takes precedence over
`-Zmiri-env-exclude`: if a variable is both forwarded and exluced, it *will* get forwarded. This
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1f5d8d49eb6111931091f700d07518cd2b80bc18
93ab13b4e894ab74258c40aaf29872db2b17b6b4
7 changes: 4 additions & 3 deletions src/shims/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ impl<'tcx> EnvVars<'tcx> {
config: &MiriConfig,
) -> InterpResult<'tcx> {
let target_os = ecx.tcx.sess.target.os.as_ref();
// 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.
let mut excluded_env_vars = config.excluded_env_vars.clone();
excluded_env_vars.push("TERM".to_owned());
if target_os == "windows" {
// HACK: Exclude `TERM` var to avoid terminfo trying to open the termcap file.
excluded_env_vars.push("TERM".to_owned());
}

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