简体   繁体   English

Unison无法备份隐藏的点文件

[英]Unison fails to backup hidden dotfiles

I am using unison (a file synchronization tool) to sync files between my linux machine (client) and a linux ssh server (host). 我正在使用unison (文件同步工具)在我的Linux机器(客户端)和linux ssh服务器(主机)之间同步文件。 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概要文件,以及重新创建该错误的步骤。

### ~/.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

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 TIL 根据统一手册期望使用标准的glob模式 ,因此该行

backup = Name *

does not match any files with a leading . 与任何前导.不匹配的文件. in its name. 以它的名字。 The line should be 该行应该是

backup = Name {.*,*}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM