diff --git a/Cargo.lock b/Cargo.lock index 95a6bcb..b9af8d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -84,7 +84,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -95,7 +95,7 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -682,7 +682,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -1857,7 +1857,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2089,7 +2089,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2390,7 +2390,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -2501,7 +2501,7 @@ dependencies = [ "getrandom 0.3.4", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] @@ -2542,9 +2542,9 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" [[package]] name = "tokio" -version = "1.53.1" +version = "1.54.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" dependencies = [ "bytes", "libc", @@ -2736,7 +2736,7 @@ checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" dependencies = [ "memoffset", "tempfile", - "windows-sys 0.61.2", + "windows-sys 0.60.2", ] [[package]] @@ -2961,7 +2961,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.52.0", ] [[package]] diff --git a/src/agent/tests.rs b/src/agent/tests.rs index c4dd235..6b59835 100644 --- a/src/agent/tests.rs +++ b/src/agent/tests.rs @@ -5,6 +5,7 @@ use std::io::{self, BufRead, Cursor, Read}; use std::path::{Path, PathBuf}; use std::process::Command; use std::sync::{Arc, Barrier}; +use std::time::{Duration, Instant}; #[cfg(unix)] use std::os::unix::fs::{MetadataExt as _, PermissionsExt as _, symlink}; @@ -523,10 +524,20 @@ fn a_separate_writer_lock_refuses_without_replacement_and_retry_converges() { assert_eq!(fs::read_dir(path.parent().unwrap()).unwrap().count(), 2); #[cfg(unix)] let lock_inode = fs::metadata(&lock_path).unwrap().ino(); - assert_eq!( - confirmed(home.path(), Client::Cursor).result.unwrap(), - Outcome::Installed - ); + // Another test in this process can spawn a process while the worker holds + // the lease. The child keeps an inherited copy of the lock descriptor + // until its exec, so the first retry can still find the lock taken. Retry + // within a bound; a lock that stays held still fails. + let deadline = Instant::now() + Duration::from_secs(10); + let retried = loop { + match confirmed(home.path(), Client::Cursor).result { + Err(InstallError::Busy(_)) if Instant::now() < deadline => { + std::thread::park_timeout(Duration::from_millis(20)); + } + result => break result, + } + }; + assert_eq!(retried.unwrap(), Outcome::Installed); assert_eq!( confirmed(home.path(), Client::Cursor).result.unwrap(), Outcome::Existing