Unison fails to backup hidden dotfiles

北慕城南 提交于 2020-01-16 03:49:08

问题


I am using unison (a file synchronization tool) to sync files between my linux machine (client) and a linux ssh server (host). It will synchronize dotfiles (config files that start with .) fine, but it doesn't create backups of them at all. Is this a bug, or am I missing something obvious. I mostly want someone to re-affirm that I'm not doing something dumb before I send a bug report. Below is a minimal unison profile file and the steps to recreate the bug.

### ~/.unison/Test.prf

### Roots of Syncronization
  root = /home/username
  root = ssh://root@<host-ip-here>//root/SyncDir
  sshargs = -C -i /home/username/ssh-key

### Directories to be Synced
  path = TestDir

### Backup Settings
  backuplocation = central
  backupdir = /root/BackupDir
  backup = Name *
  maxbackups = 9
  backupprefix = 
  backupsuffix = .$VERSION

And here is what I ran on the client machine to demonstrate the bug:

~$ mkdir TestDir; 
~$ touch TestDir/testfile TestDir/.dottestfile
~$ ssh -i ssh-key root@<host-ip-here> 'mkdir SyncDir BackupDir'
~$ unison Test
~$ ssh -i ssh-key root@<host-ip-here> 'ls -A SyncDir/TestDir'
.dottestfile
testfile
~$ echo "some changes" > TestDir/testfile
~$ echo "some changes" > TestDir/.dottestfile
~$ unison Test
~$ ssh -i ssh-key root@<host-ip-here> 'ls -A SyncDir/TestDir'
.dottestfile
testfile
~$ ssh -i ssh-key root@<host-ip-here> 'ls -A BackupDir/TestDir'
testfile

回答1:


So it turns out this is not a bug and I am doing something dumb. TIL that backup = Name expects a standard globbing pattern according to the unison manual, and so the line

backup = Name *

does not match any files with a leading . in its name. The line should be

backup = Name {.*,*}


来源:https://stackoverflow.com/questions/28956691/unison-fails-to-backup-hidden-dotfiles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!