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

From: George Valkov <[email-masked]>
Date: Sat, 11 Feb 2023 01:48:38 +0200

> On 2023-02-10, at 11:46 PM, Pádraig Brady <[email-masked]> wrote:
> 
> On 10/02/2023 20:45, Paul Eggert wrote:
>> On 2/10/23 10:58, Pádraig Brady wrote:
>>> I was considering "touch"ing the timestamps after also,
>>> but it's better to just maintain them as we're
>>> pointing to the same data after all.
>> For POSIX conformance we must touch if the user has specified only POSIX
>> options (and has not specified -p).
>> And it's not just a POSIX conformance issue. Ordinary users will be
>> surprised if plain 'cp A B' creates a file B with a timestamp from last
>> year.
> 
> Maybe. Though POSIX says cp "shall copy" and we're not making a copy, we're making a reflink.
> So technically we're violating POSIX already in that regard.

A hard link is when we have two or more names for the same file.
We can read or write and it affects the same disk content.
That would violate POSIX shall copy, but we are not doing a hard link.
A clone behaves exactly like a copy. Reads and writes affect only
the selected file. It’s rather an optimised copy.

> One might take the view that the fact we write no new data
> means we should not update the data modification time etc. by default,
> and this may be more signal to a user that new data has not in fact been written.

We can describe the changes in the documentation. From a user perspective,
everything works exactly as before, only faster. Some users might get surprised
the first time they copy several gigabytes and we finish instantly. If will check:
the copy is there and it works. So they’ll get used to it and be happy about the change.
I always wanted a tool that does CoW. I knew APFS supports it.

Georgi Valkov
httpstorm.com
nano RTOS