flock tests: cover the case of asking for both locks on the same file handle#5073
Conversation
|
Thank you for contributing to Miri! A reviewer will take a look at your PR, typically within a week or two. |
|
Thank you for contributing to Miri! A reviewer will take a look at your PR, typically within a week or two. |
|
Strange, I would have expected this to work on Windows // Test that we can apply many shared locks
file1.lock_shared().unwrap();
file2.lock_shared().unwrap();
// Test that shared lock prevents exclusive lock
assert!(matches!(file1.try_lock().unwrap_err(), fs::TryLockError::WouldBlock));
// Unlock one shared lock.
file2.unlock().unwrap();
// Now just file1 has a shared lock -- and we can convert that to an exclusive lock.
file1.try_lock().unwrap(); // <-- fails hereBut it seems like somehow releasing the lock on file2 does not actually make the lock available for file1? @ChrisDenton any idea what might be happening? |
|
Oh right, sorry, it's just the exclusive lock then shared lock case that works. Doing the opposite doesn't.
|
|
Wow that's... creative. Thanks for clarifying. |
a84f61f to
8dd6005
Compare
|
FWIW I'd argue both locks were "created using the same file handle" in that example... they are both created via file1. |
f3bcce4 to
de37cc7
Compare
d6b283a to
a3bbcbf
Compare
No description provided.