我正在尝试使用 Unison 同步两个目录,但是如果它遇到一个有错误的文件,它就会跳过整个目录!我认为它不应该跳过整个目录,而应该只跳过那个文件。我同意。我该如何告诉它忽略错误并继续复制其余文件?
Unison 是 Windows 可执行文件,而不是 Cygwin。我可以使用 Cygwin 读取文件。Unison 确实在文件上遇到了错误,我可以跳过它们。
2.32 版比 2.40 版运行得更好。2.40 版甚至无法启动。
我尝试添加 -ignore,但没有用。以下是我尝试的方法:
$ 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-----
命令行参考:
http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#prefs
答案1
我认为您必须使用版本 2.40。我认为版本 2.40 会出错,因为 default.pref 不为空。删除 %HOME%.unison\default.pref 或 $HOME/.unison/default.pref。您还必须使用 --times 明确告知它保留修改时间。