--backup leaves window where file doesn't exist.

Wayne Davison wayned at samba.org
Thu Sep 15 15:49:33 GMT 2005


On Thu, Sep 15, 2005 at 10:38:04AM -0400, Dave Mielke wrote:
> The only change, therefore, should be to replace the first rename()
> with link(). Since both yield EXDEV, I doubt any more complex change
> is necessary.

It's more complex than that.  If the temp file is not in a position
where it can be renamed into place, it is copied into place, which would
overwrite the backup without additional logic to ensure that the
newly-hard-linked destination file was removed first.  Also, the backup
calls are used for both backing up deleted files and updated files, so
the code would also need to be changed to have the delete callers remove
the destination file (as it does in the non-backup-calling case).
Finally, the code would need to handle systems where hard links don't
work by continuing to call rename() (since it is more efficient than
forcing all backups to be done with a file copy).  (At least, that's all
the side-effects I can think of off the top of my head.)

..wayne..


More information about the rsync mailing list