Skip to content

Commit 791238a

Browse files
committed
fix(flock): check if they are marked unsupported in libstd
Before this Cargo invokes syscalls and check whether it gets ENOTSUP to determine flock is unsupported. However, now the "unsupported platforms" are pre-defined by libstd [1]. Cargo should perhaps return unsupported if a platform is marked unsupported by libstd. Without this, some people on Termux may be affected I guess? [1]: https://github.com/rust-lang/rust/blob/e9b6085088fd671ecfbe4cbebe1d26796d8bfa30/library/std/src/sys/fs/unix.rs#L1395-L1410
1 parent 9eb3240 commit 791238a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/cargo/util/flock.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,9 @@ fn try_acquire(path: &Path, lock_try: &dyn Fn() -> Result<(), TryLockError>) ->
353353
Ok(()) => Ok(true),
354354

355355
// In addition to ignoring NFS which is commonly not working we also
356-
// just ignore locking on filesystems that look like they don't
357-
// implement file locking.
356+
// just ignore locking on filesystems that either are marked unsupported
357+
// by libstd, or look like they don't implement file locking.
358+
Err(TryLockError::Error(e)) if e.kind() == std::io::ErrorKind::Unsupported => Ok(true),
358359
Err(TryLockError::Error(e)) if error_unsupported(&e) => Ok(true),
359360

360361
Err(TryLockError::Error(e)) => {

0 commit comments

Comments
 (0)