Subject: Re: bug#11100: Racy code in copy.c

From: Paul Eggert <[email-masked]>
Date: Tue, 27 Mar 2012 09:03:30 -0700

On 03/27/2012 05:58 AM, Philipp Thomas wrote:
> The above mentioned code assumes that the file still
> exists.  This is racy - particularly for NFS where deletions from other
> clients can take a while to appear.

*NEW_DST is a bit more complicated than that.  At least for part
of the code it means the file was known not to exist, which is not
the same thing as being true if the file does not exist and false
otherwise.  (Sometimes I think I need to take a course on epistemology
to understand this code, which is not a good sign....)

In general 'cp' is not and cannot be free from races due to other
active processes.  A fix could well be needed here, to work around NFS
bugs, but it'd need to be thought through in the light of other
use cases.