[ale] One home directory

Brian Pitts brian at polibyte.com
Wed Oct 14 21:35:30 EDT 2009


On 10/14/2009 09:02 AM, Jeff Lightner wrote:
> It won't delete things unless you tell it to.

True.

>  One hopes that someone
> that is using the same file on two separate systems isn't updating it
> independently on each as that is the only time it would "clobber" the
> file on one side or the other.

Not true. Look at my example again; I've left it below. File b is only
updated on one system, but it is clobbered. Rsync doesn't care that the
version of b on the target is newer than the version on the source. It
checks if the file on the target has a different size or timestamp than
the file on the source, sees that it does, and alters it to match the
source version.

THis is why you can't accomplish a bidirectional sync by "run[ning] two
separate rsync jobs - one that used one side as the source and the other
as the target and another that used the original source as target and
original target as source." After the first rsync, you've clobbered any
newer files on the original target. There's nothing for the second rsync
to do!

>   If one IS updating it on each side
> independently I doubt there is any tool that would reasonably decided
> which version is the one you want - at best it would decided based on
> which one had last been updated.

True, but unison handles this nicely by offering to show you a diff and
let you choose which version you want or to skip syncing it so you can
resolve things manually.

> 
> $ mkdir one two
> $ touch one/a one/b
> $ rsync -av one/ two/
> sending incremental file list
> ./
> a
> b
> 
> sent 138 bytes  received 53 bytes  382.00 bytes/sec
> total size is 0  speedup is 0.00
> $ ls -l one two
> one:
> total 0
> -rw-rw-r-- 1 brian brian 0 2009-10-13 20:07 a
> -rw-rw-r-- 1 brian brian 0 2009-10-13 20:07 b
> 
> two:
> total 0
> -rw-rw-r-- 1 brian brian 0 2009-10-13 20:07 a
> -rw-rw-r-- 1 brian brian 0 2009-10-13 20:07 b
> $ echo one > one/a
> $ echo two > two/b
> $ ls -l one two
> one:
> total 4
> -rw-rw-r-- 1 brian brian 4 2009-10-13 20:07 a
> -rw-rw-r-- 1 brian brian 0 2009-10-13 20:07 b
> 
> two:
> total 4
> -rw-rw-r-- 1 brian brian 0 2009-10-13 20:07 a
> -rw-rw-r-- 1 brian brian 4 2009-10-13 20:07 b
> $ cat two/b
> two
> $ rsync -av one/ two/
> sending incremental file list
> a
> b
> 
> sent 151 bytes  received 50 bytes  402.00 bytes/sec
> total size is 4  speedup is 0.02
> $ cat two/b
> $
> 


More information about the Ale mailing list