matt at mattmccutchen.net
Fri Nov 16 22:02:54 GMT 2007
On Fri, 2007-11-16 at 13:22 -0800, Charles Polisher wrote:
> I am experimenting with Matt McCutchen's excellent continusync script,
> and I'm having an issue. (My copy of continusync has been modified from
> the original
> http://mattmccutchen.net/utils/continusync by adding this @ line 227:
> as suggested by Matt.)
Good, so you got this part to work.
> The problem is easily reproduced:
> # mkdir ~/foo
> # continusync ~/foo root at remotehost:~/foo &
> # vi ~/foo/bar.txt
> This generates an immediate exit from continusync with the following 3
> "rsync: link_stat "/root/foo/.bar.txt.swx" failed: No such file or
> directory (2)
> rsync error: some files could not be transferred (code 23) at
> + Broken pipe continusync ~/foo root at remotehost:~/foo"
> This is using slackware 11, on which vi is a link to vim version 7.0.
> By strace'ing vi I can see that it rapidly creates then destroys the
> I suspect there may be a race in continusync somewhere, but I
> haven't been successful at narrowing it down. I am using rsync v2.6.9,
> latest stable version.
Yes. Continusync gets the event for the creation of .bar.txt.swx and
invokes rsync to have it sent, but the file is deleted before rsync can
send it. There's no way to avoid this race completely. However, any of
three changes to continusync would make it much less of a problem, and I
will make all three if and when I have the time:
1. Wait for a short time after a change to the source occurs before
propagating it. If a file is created and then rapidly deleted, no
action is necessary. Implementing this fully would require a data
structure to remember pending changes; it would have to be somewhat
sophisticated to handle moves optimally.
2. Somehow get rsync to treat disappearance of the source file as "file
has vanished" rather than an error. This could be done inelegantly by
running rsync on the top source directory but excluding everything
except the changed file(s). It might be better to use a modified rsync
with an option that causes it to treat any and all missing source
args/--files-from entries as "file has vanished".
3. Figure out why continusync is exiting altogether when rsync returns
error 23 and stop it from doing that.
More information about the rsync