-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Labels
A-compiletestArea: The compiletest test runnerArea: The compiletest test runnerA-run-makeArea: port run-make Makefiles to rmake.rsArea: port run-make Makefiles to rmake.rsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
rust/src/tools/compiletest/src/runtest.rs
Lines 3420 to 3441 in bbe9a9c
fn aggressive_rm_rf(&self, path: &Path) -> io::Result<()> { | |
for e in path.read_dir()? { | |
let entry = e?; | |
let path = entry.path(); | |
if entry.file_type()?.is_dir() { | |
self.aggressive_rm_rf(&path)?; | |
} else { | |
// Remove readonly files as well on windows (by default we can't) | |
fs::remove_file(&path).or_else(|e| { | |
if cfg!(windows) && e.kind() == io::ErrorKind::PermissionDenied { | |
let mut meta = entry.metadata()?.permissions(); | |
meta.set_readonly(false); | |
fs::set_permissions(&path, meta)?; | |
fs::remove_file(&path) | |
} else { | |
Err(e) | |
} | |
})?; | |
} | |
} | |
fs::remove_dir(path) | |
} |
aggressive_rm_rf
seems to only account for read-only files in Windows (and tries really hard to rm -rf), but does not try as hard on Linux or macOS or other non-Windows platforms. This can pose issues to tests that modifies file or folder permissions in one way or another that could cause fs::remove_file
to fail, which can lead to artifacts lingering around and cause tests results to not be reproducible.
Metadata
Metadata
Assignees
Labels
A-compiletestArea: The compiletest test runnerArea: The compiletest test runnerA-run-makeArea: port run-make Makefiles to rmake.rsArea: port run-make Makefiles to rmake.rsC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.