Skip to content

Commit 19cf120

Browse files
committed
build: allow the cleanup step to be non-fatal
3e8962c (Clean up dep-info files from OUT_DIR, 2024-10-22) made the cleanup step a fatal operation when cleanup fails. Some filesystems (e.g. NFS v3) can run into timing issues under load where .nfs* dummy files can still exist for a short window of time after the probe command completes. One way this can happen is when other processes, such as a malware scanner, holds the files open in the background for a short period of time. This window of time is just long enough for a failure to occur in remove_all(). Ignore DirectoryNotEmpty errors to account for this scenario.
1 parent 21f89e7 commit 19cf120

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ fn compile_probe(rustc_bootstrap: bool) -> bool {
203203
// file in OUT_DIR, which causes nonreproducible builds in build systems
204204
// that treat the entire OUT_DIR as an artifact.
205205
if let Err(err) = fs::remove_dir_all(&out_subdir) {
206-
if err.kind() != ErrorKind::NotFound {
206+
if err.kind() != ErrorKind::NotFound && err.kind() != ErrorKind::DirectoryNotEmpty {
207207
eprintln!("Failed to clean up {}: {}", out_subdir.display(), err);
208208
process::exit(1);
209209
}

0 commit comments

Comments
 (0)