Skip to content

Commit

Permalink
fix incorrect path resolution in tidy
Browse files Browse the repository at this point in the history
Previously, reading the current path from the environment led to failure when invoking
x from outside the source root. This change fixes this issue by reading the second argument,
which always equals to the source root (see https://github.com/rust-lang/rust/blob/a655e648a9f94d74263108366b83e677af56e35d/src/bootstrap/src/core/build_steps/test.rs#L1081).

Signed-off-by: onur-ozkan <[email protected]>
  • Loading branch information
onur-ozkan committed Mar 8, 2024
1 parent 735f758 commit 356b812
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tools/tidy/src/ui_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use ignore::Walk;
use lazy_static::lazy_static;
use regex::Regex;
use std::collections::{BTreeSet, HashMap};
use std::env;
use std::ffi::OsStr;
use std::fs;
use std::io::Write;
Expand Down Expand Up @@ -184,7 +185,7 @@ pub fn check(path: &Path, bless: bool, bad: &mut bool) {
*/
[
"#;
let tidy_src = std::env::current_dir().unwrap().join("src/tools/tidy/src");
let tidy_src = PathBuf::from(env::args_os().nth(1).unwrap()).join("src/tools/tidy/src");
// instead of overwriting the file, recreate it and use an "atomic rename"
// so we don't bork things on panic or a contributor using Ctrl+C
let blessed_issues_path = tidy_src.join("issues_blessed.txt");
Expand Down

0 comments on commit 356b812

Please sign in to comment.