问题
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