I believe that this bug has been reported several times before and it's a 
serious one since it results in data loss!
Please take the time to read the description and the solution.
I reported this problem for 8.2beta, I believe it was also there in 8.1. Ben 
Rieser also reported this in 8.2beta and so have other people

I want to synchronize 2 local directories, d1 and d2 and I want to copy the 
newest files.
I start with them in the following state:
[narfi@c-115082 tmp]$ ls -l d1 d2
d1:
total 8
-rw-------    1 narfi    narfi          33 Sep  7 10:41 a1.txt
-rw-------    1 narfi    narfi          15 Sep  7 10:40 a2.txt

d2:
total 8
-rw-------    1 narfi    narfi          24 Sep  7 10:34 a1.txt
-rw-------    1 narfi    narfi          24 Sep  7 10:41 a2.txt

So draksync should copy:
d1/a1.txt --> d2/a1.txt
d2/a2.txt --> d1/a2.txt
according to the timestamps on the files.
However, after synchronization, the state is:
[narfi@c-115082 tmp]$ ls -l d1 d2
d1:
total 8
-rw-------    1 narfi    narfi          24 Sep  7 10:34 a1.txt
-rw-------    1 narfi    narfi          24 Sep  7 10:41 a2.txt

d2:
total 8
-rw-------    1 narfi    narfi          24 Sep  7 10:34 a1.txt
-rw-------    1 narfi    narfi          24 Sep  7 10:41 a2.txt

so draksync copied 
d2/a1.txt --> d1/a1.txt
d2/a2.txt --> d1/a2.txt

thus overwriting the newer file d1/a1.txt !!!!!!!!!!!!!!!!!!!!!

Solution:
Look at the output from:
grep rsync /usr/lib/DrakSync/commands/none_is_newer.exp

spawn rsync -rlpgtz --progress --stats --dry-run "$src" "$dst"
spawn rsync -rlpgtz --progress --stats --dry-run "$dst" "$src"
spawn rsync -rlpgtz --progress --stats "$src" "$dst"
spawn rsync -rlpgtz --progress --stats "$dst" "$src"

and you notice that the -rlpgtz options to rsync mean:
recursive, recreate symlinks on the destination, preserve permissions,
preserve groups and use compression during transmission.

However, conspicuously missing is: [From the manpage for rsync] 
       -u, --update
              This  forces  rsync to skip any files for which the
              destination file already  exists  and  has  a  date
              later than the source file.
Adding -u to all invokations of rsync in none_is_newer.exp not only seems
like the only logical thing to do, it also solves the problem for me. 

Narfi.

Reply via email to