From 5bfe6a1c76539a8dec49ffe5da8b23c4afc7e53d Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 30 Nov 2019 22:25:06 -0700 Subject: [PATCH 1/2] Fix some race conditions in the integration tests --- test/sys/test_signal.rs | 2 ++ test/test_unistd.rs | 24 ++++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/test/sys/test_signal.rs b/test/sys/test_signal.rs index 11875750e2..4cb394cc42 100644 --- a/test/sys/test_signal.rs +++ b/test/sys/test_signal.rs @@ -18,6 +18,8 @@ fn test_killpg_none() { #[test] fn test_old_sigaction_flags() { + let _m = ::SIGNAL_MTX.lock().expect("Mutex got poisoned by another test"); + extern "C" fn handler(_: ::libc::c_int) {} let act = SigAction::new( SigHandler::Handler(handler), diff --git a/test/test_unistd.rs b/test/test_unistd.rs index e0b3ae7e51..24e0c86bec 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -101,6 +101,8 @@ fn test_mkfifo_directory() { #[test] #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "android")))] fn test_mkfifoat_none() { + let _m = ::CWD_LOCK.read().expect("Mutex got poisoned by another test"); + let tempdir = tempfile::tempdir().unwrap(); let mkfifoat_fifo = tempdir.path().join("mkfifoat_fifo"); @@ -128,11 +130,10 @@ fn test_mkfifoat() { #[test] #[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "android")))] fn test_mkfifoat_directory_none() { + let _m = ::CWD_LOCK.read().expect("Mutex got poisoned by another test"); + // mkfifoat should fail if a directory is given - assert_eq!( - mkfifoat(None, &env::temp_dir(), Mode::S_IRUSR).is_ok(), - false - ); + assert!(!mkfifoat(None, &env::temp_dir(), Mode::S_IRUSR).is_ok()); } #[test] @@ -144,10 +145,7 @@ fn test_mkfifoat_directory() { let mkfifoat_dir = "mkfifoat_dir"; stat::mkdirat(dirfd, mkfifoat_dir, Mode::S_IRUSR).unwrap(); - assert_eq!( - mkfifoat(Some(dirfd), mkfifoat_dir, Mode::S_IRUSR).is_ok(), - false - ); + assert!(!mkfifoat(Some(dirfd), mkfifoat_dir, Mode::S_IRUSR).is_ok()); } #[test] @@ -637,6 +635,8 @@ fn test_canceling_alarm() { #[test] fn test_symlinkat() { + let _m = ::CWD_LOCK.read().expect("Mutex got poisoned by another test"); + let tempdir = tempfile::tempdir().unwrap(); let target = tempdir.path().join("a"); @@ -682,6 +682,8 @@ fn test_linkat_file() { #[test] fn test_linkat_olddirfd_none() { + let _dr = ::DirRestore::new(); + let tempdir_oldfile = tempfile::tempdir().unwrap(); let oldfilename = "foo.txt"; let oldfilepath = tempdir_oldfile.path().join(oldfilename); @@ -704,6 +706,8 @@ fn test_linkat_olddirfd_none() { #[test] fn test_linkat_newdirfd_none() { + let _dr = ::DirRestore::new(); + let tempdir_oldfile = tempfile::tempdir().unwrap(); let oldfilename = "foo.txt"; let oldfilepath = tempdir_oldfile.path().join(oldfilename); @@ -727,6 +731,8 @@ fn test_linkat_newdirfd_none() { #[test] #[cfg(not(any(target_os = "ios", target_os = "macos")))] fn test_linkat_no_follow_symlink() { + let _m = ::CWD_LOCK.read().expect("Mutex got poisoned by another test"); + let tempdir = tempfile::tempdir().unwrap(); let oldfilename = "foo.txt"; let oldfilepath = tempdir.path().join(oldfilename); @@ -761,6 +767,8 @@ fn test_linkat_no_follow_symlink() { #[test] fn test_linkat_follow_symlink() { + let _m = ::CWD_LOCK.read().expect("Mutex got poisoned by another test"); + let tempdir = tempfile::tempdir().unwrap(); let oldfilename = "foo.txt"; let oldfilepath = tempdir.path().join(oldfilename); From 722fc77816fb21a70746f8f93941241ba18c6d42 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sun, 1 Dec 2019 09:02:02 -0700 Subject: [PATCH 2/2] Fix formatting in CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4fe67da4c..de46f8c7b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -73,6 +73,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Fix length of abstract socket addresses ([#1120](https://github.com/nix-rust/nix/pull/1120)) + - Fix initialization of msghdr in recvmsg/sendmsg when built with musl ([#1136](https://github.com/nix-rust/nix/pull/1136))