authorgravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-04-08 16:29:44-06:00
committergravatar for leroycepearson@geemili.xyzLeRoyce Pearson <leroycepearson@geemili.xyz> 2020-04-08 16:38:58-06:00
log772bb1ade372ad625381ccee198c812fcccc0e3d
treeec3a89f121add79385317e49052047d908856c99
parentd0d7895d3308763422e4da0eb5d6e03c445f1b08

Disable open flock flags on darwin

The tests were put into a deadlock, and it seems that darwin doesn't support `O_SYNC`, though it supports `O_NONBLOCK`. It shouldn't block even with that, but I'm not sure why else it would fail.

1 files changed, 4 insertions(+), 2 deletions(-)

lib/std/fs.zig+4-2
...@@ -596,7 +596,8 @@ pub const Dir = struct {...@@ -596,7 +596,8 @@ pub const Dir = struct {
596 }596 }
597597
598 // Use the O_ locking flags if the os supports them598 // Use the O_ locking flags if the os supports them
599 const has_flock_open_flags = @hasDecl(os, "O_EXLOCK");599 // (Or if it's darwin, as darwin's `open` doesn't support the O_SYNC flag)
600 const has_flock_open_flags = @hasDecl(os, "O_EXLOCK") and !builtin.os.tag.isDarwin();
600 const nonblocking_lock_flag = if (has_flock_open_flags and flags.lock_nonblocking) (os.O_NONBLOCK | os.O_SYNC) else @as(u32, 0);601 const nonblocking_lock_flag = if (has_flock_open_flags and flags.lock_nonblocking) (os.O_NONBLOCK | os.O_SYNC) else @as(u32, 0);
601 const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) {602 const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) {
602 .None => @as(u32, 0),603 .None => @as(u32, 0),
...@@ -678,7 +679,8 @@ pub const Dir = struct {...@@ -678,7 +679,8 @@ pub const Dir = struct {
678 }679 }
679680
680 // Use the O_ locking flags if the os supports them681 // Use the O_ locking flags if the os supports them
681 const has_flock_open_flags = @hasDecl(os, "O_EXLOCK");682 // (Or if it's darwin, as darwin's `open` doesn't support the O_SYNC flag)
683 const has_flock_open_flags = @hasDecl(os, "O_EXLOCK") and !builtin.os.tag.isDarwin();
682 const nonblocking_lock_flag = if (has_flock_open_flags and flags.lock_nonblocking) (os.O_NONBLOCK | os.O_SYNC) else @as(u32, 0);684 const nonblocking_lock_flag = if (has_flock_open_flags and flags.lock_nonblocking) (os.O_NONBLOCK | os.O_SYNC) else @as(u32, 0);
683 const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) {685 const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) {
684 .None => @as(u32, 0),686 .None => @as(u32, 0),