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

cp: provide --reflink on macOS #1773

Closed
Artoria2e5 opened this issue Mar 9, 2021 · 4 comments
Closed

cp: provide --reflink on macOS #1773

Artoria2e5 opened this issue Mar 9, 2021 · 4 comments

Comments

@Artoria2e5
Copy link

Artoria2e5 commented Mar 9, 2021

macOS has a similar file-cloning mechanic since APFS became a thing. An implementation for GNU Coreutils is at Artoria2e5/coreutils@e25bfa5.

Note that Apple in its infinite wisdom provides a syscall that takes the filename instead of the ioctl-on-fd approach that Linux and to an extent Windows ReFS uses. This... might make the code a bit messier and even racier.

@nthery
Copy link
Contributor

nthery commented Apr 17, 2021

I'm in the process of adding clonefile() to libc: rust-lang/libc#2147.

@nthery
Copy link
Contributor

nthery commented Apr 17, 2021

clonefile() was added in macOS 10.12.

Do we want to maintain compatibility with pre-10.12?
If so, is there any prior art to invoke a syscall only if available?

I'm prototyping something with libc::dlsym() but I'm not sure if this is the Right Way to go.

@Artoria2e5
Copy link
Author

That's a great question (lolsob). According to https://users.rust-lang.org/t/compile-rust-binary-for-older-versions-of-mac-osx/38695/3 Rust goes down to 10.7, but the policy might be different on uutils.

@nthery
Copy link
Contributor

nthery commented Apr 19, 2021

Thanks. I'll stick to the dlsym approach for the time being.

sylvestre added a commit that referenced this issue Apr 25, 2021
cp: add  --reflink support to macos, fixes #1773
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants