Repository navigation
macOS binaries: UV_FS_COPYFILE_FICLONE not supported #24521
Description
Activity
With a binary that supports this feature
I'm unclear on what you mean by that: another node binary, or another program entirely? If it's the former, where did you get it from?
Another node binary. 11.2.0, installed via
brew install node. I'd like to try building from source but I'm afraid V8 would take some time.- addedmacosIssues and PRs related to the macOS platform.Issues and PRs related to the macOS platform.
on Nov 20, 2018 Okay, I understand what you mean now. It sounds like the release binaries were built on a system whose headers don't define
COPYFILE_CLONE_FORCE. The ENOSYS comes from an #ifdef guard in libuv.@nodejs/releasers Can one of you confirm? I'm having a hard time tracking down the machine used to build them. The define should be in /usr/include/copyfile.h (that's where it is on my system anyway.)
@bnoordhuis version 11.2.0 was built on
release-macstadium-macos10.11-x64-1.
I do not have access to the machine so I can only give you a few lines from the build output that contain version numbers:21:12:59 Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 21:12:59 Apple LLVM version 8.0.0 (clang-800.0.42.1) 21:12:59 Target: x86_64-apple-darwin15.0.0Version 15.0.0 seems to be OS X El Capitan.
Yep, it's missing
COPYFILE_CLONE_FORCE. Header says/* version 0.1 */if that helps.Darwin release-macstadium-macos10.11-x64-1.nodejs.org 15.0.0 Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64Reacted by Li YuBei and antsmartianI had a look and I think it's unfixable short-term.
COPYFILE_CLONE_FORCEwas added in macos 10.12 and the release machine is 10.11.Libuv can't hard-code the value because copyfile() blissfully ignores flags it doesn't know about. That would break the API contract that states
UV_FS_COPYFILE_FICLONE_FORCEfails with an error when the file system doesn't support cloning.Theoretically, libuv could call clonefileat/fclonefileat() directly instead of going through copyfile() but that's basically reimplementing copyfile(), and probably poorly.
edit: Perhaps libuv can turn the compile-time guard into a runtime OS version check. Needs investigation.
- addedconfirmed-bugIssues and PRs for confirmed bugs.Issues and PRs for confirmed bugs.
on Nov 22, 2018 So, does this call for switching to 10.12+ for Node 12 release builds?
- added a commit that references this issue
on Nov 24, 2018 @rvagg I think we can work around this in libuv, see libuv/libuv#2092.
- added a commit that references this issue
on Nov 25, 2018 This should be fixed the next time libuv is upgraded, probably sometime next month.
- added a commit that references this issue
on Dec 19, 2018 - added a commit that references this issue
on Dec 25, 2018 - added a commit that references this issue
on Apr 5, 2019 - added a commit that references this issue
on Apr 17, 2019 - added a commit that references this issue
on Apr 28, 2019 - added a commit that references this issue
on May 10, 2019 - added a commit that references this issue
on May 16, 2019
Node binaries from the official pkg distribution do not support copy-on-write (
UV_FS_COPYFILE_FICLONE) on apfs-formatted volumes.Steps to reproduce
Generate a file (3MB here, size is not important) to clone later
In the node REPL, run:
In the official node binary, this error is raised:
With a binary that supports this feature, the file is cloned normally. You can verify that the clone call works as intended by cloning a large file and checking the volume size on Disk Utility. It doesn't create a hardlink. Changes to the clone don't affect the original file.
Implications
This bug also affects users of nvm and n who install prebuilt binaries (the default behavior). brew users are not impacted as the prebuilt binary (bottle) is built with support for this flag.
Yarn is directly affected by this.
UV_FS_COPYFILE_FICLONEfalls back to normal copying, negating the performance and disk space benefits of cloning.