race condition bugs

Paul Green Paul_Green at charter.net
Mon Aug 9 19:27:56 GMT 2004


Wayne Davison wrote:

> On Mon, Aug 09, 2004 at 12:12:16PM +0100, Tony Finch wrote:
> > This is because of race conditions in finish_transfer() which mean
> > that it does not update files atomically.
> 
> There is a diff in the "patches" dir named early-chmod.diff 
> that changes
> this behavior.  It sets the permissions prior to the robust_rename()
> call, and the copy-when-rename-fails logic is extended to ensure that
> these final permissions on the temp file don't interfere with rsync's
> reading of the file for the copy.
> 
> The only reason this patch hasn't already been applied is that I'm not
> 100% sure of the reasons that rsync was written to do the 
> chmod() after
> the rename().  For instance, do we need to worry about some strange
> system that drops the setuid bits on rename()?  Is there a (relevant)
> system that prevents the rename() if the file is read-only?  
> (I seem to
> recall that MS DOS has this behavior, but cygwin probably 
> hides it if it does.)
> 
> Any comments on how portable it would be to apply the final 
> permissions before calling rename()?

Can we make up a test case that the build farm can execute?

I know of no issues from the POSIX standard that would prevent applying
this mod.

PG




More information about the rsync mailing list