Skip to content

Commit 50fc514

Browse files
authored
Merge pull request #512 from dtolnay/enotempty
Restore support for rustc older than 1.83
2 parents ad59158 + 7cc389b commit 50fc514

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

build.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,16 @@ 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 && err.kind() != ErrorKind::DirectoryNotEmpty {
206+
// libc::ENOTEMPTY
207+
// Some filesystems (NFSv3) have timing issues under load where '.nfs*'
208+
// dummy files can continue to get created for a short period after the
209+
// probe command completes, breaking remove_dir_all.
210+
// To be replaced with ErrorKind::DirectoryNotEmpty (Rust 1.83+).
211+
const ENOTEMPTY: i32 = 39;
212+
213+
if !(err.kind() == ErrorKind::NotFound
214+
|| (cfg!(target_os = "linux") && err.raw_os_error() == Some(ENOTEMPTY)))
215+
{
207216
eprintln!("Failed to clean up {}: {}", out_subdir.display(), err);
208217
process::exit(1);
209218
}

0 commit comments

Comments
 (0)