Auto merge of #2471 - RalfJung:term, r=RalfJung

stop excluding TERM env var on Unix

Effectively reverts https://github.com/rust-lang/miri/pull/2018.
Needs https://github.com/rust-lang/rust/pull/100206 to not be terribly slow.
Fixes https://github.com/rust-lang/miri/issues/2292.
This commit is contained in:
bors 2022-08-08 00:38:17 +00:00
commit 654e15b51c
3 changed files with 7 additions and 7 deletions

View File

@ -282,9 +282,8 @@ environment variable. We first document the most relevant and most commonly used
verbose. `hide` hides the warning entirely. verbose. `hide` hides the warning entirely.
* `-Zmiri-env-exclude=<var>` keeps the `var` environment variable isolated from the host so that it * `-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 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 `TERM` environment variable is excluded by default in Windows to prevent the libtest harness from
harness](https://github.com/rust-lang/miri/issues/1702). This has no effect unless accessing the file system. This has no effect unless `-Zmiri-disable-isolation` is also set.
`-Zmiri-disable-isolation` is also set.
* `-Zmiri-env-forward=<var>` forwards the `var` environment variable to the interpreted program. Can * `-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 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 `-Zmiri-env-exclude`: if a variable is both forwarded and exluced, it *will* get forwarded. This

View File

@ -1 +1 @@
1f5d8d49eb6111931091f700d07518cd2b80bc18 93ab13b4e894ab74258c40aaf29872db2b17b6b4

View File

@ -42,10 +42,11 @@ pub(crate) fn init<'mir>(
config: &MiriConfig, config: &MiriConfig,
) -> InterpResult<'tcx> { ) -> InterpResult<'tcx> {
let target_os = ecx.tcx.sess.target.os.as_ref(); 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(); 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. // Skip the loop entirely if we don't want to forward anything.
if ecx.machine.communicate() || !config.forwarded_env_vars.is_empty() { if ecx.machine.communicate() || !config.forwarded_env_vars.is_empty() {