[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61386: [PATCH] cp,mv,install: Disable sparse copy on macOS

From: Paul Eggert
Subject: bug#61386: [PATCH] cp,mv,install: Disable sparse copy on macOS
Date: Fri, 10 Feb 2023 13:50:46 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

On 2/10/23 13:35, George Valkov wrote:

Since the source and it’s clone have separate metadata,
it should be possible to change it on the clone, to comply with standards.

Attached is a hacky patch to do that. It also uses the new CLONE_ACL flag. The old code apparently mishandled ACLs; the new code tries to do a better job.

This whole area is a mess, but the patch should improve correctness on macOS, while also being efficient in the usual case.

It feels more natural when the metadata is kept intact for the two files.

That depends on the application. The longstanding tradition for cp is to preserve metadata if you use 'cp -p', and to not preserve with plain cp. For interactive use you can use an alias or a little script if you prefer -p to be enabled by default.

Here is a good example: I create a tarball on my OpenWRT router. Extract on the 

That's fine, because 'tar' historically has preserved the timestamp and (if you're root) permissions. Plain cp has not.

I found this link in one of the mailing lists you sent, it explains what was 
with the original SEEK_DATA and SEEK_HOLE approach on macOS

GNU cp does a pass over the file with SEEK_HOLE and SEEK_DATA, so if I understand things correctly it shouldn't run into the problem mentioned there.

In other words, that email doesn't appear to explain our current problem.

Attachment: 0001-cp-improve-use-of-fclonefileat.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]