On 2024-12-05 01:17:45 +0300, Michael Tokarev wrote:
> 05.12.2024 00:44, Vincent Lefevre wrote:
> > On 2024-12-04 19:46:53 +0300, Michael Tokarev wrote:
> > > cp(1) does open(O_TRUNC), write(), close().
> > 
> > AFAIK, there is no guarantee that cp(1) does a single write():
> Again, it does not matter.  Even if cp will write one byte at a
> time, all of them will write identical content anyway.  Collectively
> overriding file with the same bytes.

OK, but I'm still a bit uncomfortable with the fact that the
implementation of cp is not specified (at least some missing
guarantee that several cp's of the same file to the same target
is OK). In the past, I had bad surprised with concurrent writes,
but this could have been more complex cases (in my archives I can
only find an issue with the zsh history, but truncate operations
were also involved).

BTW, I'm wondering whether when a second interface is brought up,
/etc/resolv.conf could be modified, which would also be a problem.

-- 
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to