Skip to content

std: Limit the read/write size on Darwin - #6333

Merged
andrewrk merged 1 commit into
ziglang:masterfrom
LemonBoy:fix-6332
Sep 13, 2020
Merged

std: Limit the read/write size on Darwin#6333
andrewrk merged 1 commit into
ziglang:masterfrom
LemonBoy:fix-6332

Conversation

@LemonBoy

Copy link
Copy Markdown
Contributor

It turns out that the kernel won't read or write more than 0x7fffffff
bytes in a single call, failing with EINVAL when trying to do so.

Adjust the limit and curse whoever is responsible for this.

Closes #6332

See also rust-lang/rust#38590 and python/cpython#9937, the man pages don't mention this limitation at all...

It turns out that the kernel won't read or write more than 0x7fffffff
bytes in a single call, failing with EINVAL when trying to do so.

Adjust the limit and curse whoever is responsible for this.

Closes ziglang#6332
@daurnimator daurnimator added os-macos macOS standard library This issue involves writing Zig code for the standard library. labels Sep 13, 2020
@andrewrk

Copy link
Copy Markdown
Member

Argh, the API supports short writes, they could have just written 0x7fffffff bytes and returned that value!

@andrewrk andrewrk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just waiting on a confirmation from @gaultier (or anyone who can test on a mac) to make sure the value is correct here

@gaultier

Copy link
Copy Markdown

Nice to see such a fast fix!
I have built the fix locally and can confirm it works !
Awesome 👍

As an aside it is non trivial to build zig from source on OSX these days due to llvm shenanigans.

Thanks!

@andrewrk

andrewrk commented Sep 13, 2020

Copy link
Copy Markdown
Member

As an aside it is non trivial to build zig from source on OSX these days due to llvm shenanigans.

Yep. We'll get there. Unfortunately with LLVM as a dependency, they have the power to mess up our build. If this doesn't get worked out with the next release cycle then it may be worth promoting our bootstrap repository as the main way to get up and running. Here's hoping that LLVM 11 fixes all the problems introduced with LLVM 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

os-macos macOS standard library This issue involves writing Zig code for the standard library.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Read whole file fails on OSX if the file is ~5Gb in size and above

4 participants