Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore file locks on OSX NFS mounts #2720

Merged
merged 1 commit into from
Jun 12, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/cargo/util/flock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use std::path::{Path, PathBuf, Display};

use term::color::CYAN;
use fs2::{FileExt, lock_contended_error};
#[allow(unused_imports)]
use libc;

use util::{CargoResult, ChainError, Config, human};

Expand Down Expand Up @@ -267,6 +269,13 @@ fn acquire(config: &Config,

match try() {
Ok(()) => return Ok(()),

// Like above, where we ignore file locking on NFS mounts on Linux, we
// do the same on OSX here. Note that ENOTSUP is an OSX_specific
// constant.
#[cfg(target_os = "macos")]
Err(ref e) if e.raw_os_error() == Some(libc::ENOTSUP) => return Ok(()),

Err(e) => {
if e.raw_os_error() != lock_contended_error().raw_os_error() {
return Err(human(e)).chain_error(|| {
Expand All @@ -287,7 +296,6 @@ fn acquire(config: &Config,
use std::ffi::CString;
use std::mem;
use std::os::unix::prelude::*;
use libc;

let path = match CString::new(path.as_os_str().as_bytes()) {
Ok(path) => path,
Expand Down