I'm trying to synchronize two directories using Unison, however if it encounters a file with an error, then it skips the entire directory! I don't believe it should skip the whole directory, and instead should just skip that file. I'm OK with that. How do I tell it to ignore the error and continue to copy the rest of the files?
The Unison is a Windows executable, not Cygwin. I can read the file with Cygwin. Unison does in fact encounter an error on the file, and I'm OK with skipping them.
Version 2.32 works better than 2.40. Version 2.40 won't even start.
I've tried adding -ignore, but that doesn't help. Here is what I tried:
$ unison 'c:\cygwin' 'socket://xps:4321/c:/cygwin'
UNISON 2.32.52 started propagating changes at 02:53:35 on 27 Feb 2013
[ERROR] Skipping etc
[root 1]: Error in digesting c:/cygwin/etc/ssh_host_dsa_key:
c:/cygwin/etc/ssh_host_dsa_key: Permission denied
[ERROR] Skipping home
[root 1]: Error in digesting c:/cygwin/home/SYSTEM/.bash_history:
c:/cygwin/home/SYSTEM/.bash_history: Permission denied
...
Saving synchronizer state
Synchronization complete at 02:53:39 (3 items transferred, 2 skipped, 0 failed)
skipped: etc
skipped: home
$ unison 'c:\cygwin' 'socket://xps:4321/c:/cygwin' -ignore 'Path etc\ssh_host_dsa_key' -ignore 'Path home\SYSTEM\.bash_history'
Contacting server...
Connected [//dumbopc/c:/cygwin -> //xps/c:/cygwin]
Looking for changes
Waiting for changes from server
Reconciling changes
local xps
error etc
[root 1]: Error in digesting c:/cygwin/etc/ssh_host_dsa_key:
c:/cygwin/etc/ssh_host_dsa_key: Permission denied
error home
[root 1]: Error in digesting c:/cygwin/home/SYSTEM/.bash_history:
c:/cygwin/home/SYSTEM/.bash_history: Permission denied
...
Proceed with propagating updates? [] g
Propagating updates
UNISON 2.32.52 started propagating changes at 04:11:26 on 27 Feb 2013
[ERROR] Skipping etc
[root 1]: Error in digesting c:/cygwin/etc/ssh_host_dsa_key:
c:/cygwin/etc/ssh_host_dsa_key: Permission denied
[ERROR] Skipping home
[root 1]: Error in digesting c:/cygwin/home/SYSTEM/.bash_history:
c:/cygwin/home/SYSTEM/.bash_history: Permission denied
...
UNISON 2.32.52 finished propagating changes at 04:11:28 on 27 Feb 2013
Saving synchronizer state
Synchronization complete at 04:11:30 (6 items transferred, 2 skipped, 0 failed)
skipped: etc
skipped: home
# Version 2.40
C:\Program Files\Unison>"Unison-2.40.102 Text.exe" 'c:\cygwin' 'socket://xps:4321/c:\cygwin'
Contacting server...
Fatal error: Wrong number of roots: 2 expected, but 4 provided ('c:\cygwin', 'socket://xps:4321/c:\cygwin', , )
(Maybe you specified roots both on the command line and in the profile?)
@REM DOS
C:\cygwin\etc>type ssh_host_dsa_key
Access is denied.
# Cygwin
$ ls -l /etc/ssh_host_dsa_key
-rw------- 1 SYSTEM None 668 Aug 30 2010 /etc/ssh_host_dsa_key
$ cat /etc/ssh_host_dsa_key
-----BEGIN DSA PRIVATE KEY-----
Command line reference:
http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#prefs
I gave up on Unison. I switched to Synchronize It, which preserves modification times and is 10x faster. However, it doesn't propagate deletes both ways.
Synchronize It: http://www.grigsoft.com/wndsync.htm
Also, regarding the error
Look at
$HOME/.unison/default.prf
or%HOME%\.unison\default.prf
, check if there are lines starting withroot=
and remove them or move them to another profile. If there are other lines, you may review them to check if they are suitable in your case. (Apart from some far-fetched cases where one is pretty sure that they ever only synchronize one set of directory trees,default.prf
should only contain options, not root specifications.)That said, you may create and use profiles (
.prf
files in .unison directory) that specify directory tree roots to synchronize. Any profile may include others and eveninclude default
. The latter case comes handy to share a set of options that you want applied to all your profiles and even when unison is launched without specifying a profile on command line. For details see Unison documentation - Profiles.