Unisonは-force newerオプションを使用して、最新のシンボリックリンクを古いファイルに置き換えます。

Unisonは-force newerオプションを使用して、最新のシンボリックリンクを古いファイルに置き換えます。

Unisonとシンボリックリンクに問題があります。より簡単に理解し、自分で試すことができるようにテストケースを作成しました。

まず、同期する2つのディレクトリを作成します。最初のディレクトリにもいくつかのファイルがあります。

~/testdir$ mkdir a
~/testdir$ mkdir b
~/testdir$ echo "hello" > a/one
~/testdir$ echo "goodbye" > a/two

これらのパラメータを使用して一貫して動作します。修正時間を保存し、最新のファイルに強制更新する必要があります。

~/testdir$ unison -force newer -times -auto -batch a b

実行後、同じコピーを取得しました。

a:
total 16K
drwx------ 2 pruebas.ubuntu citius 4,0K oct  8 16:51 .
drwx------ 4 pruebas.ubuntu citius 4,0K oct  8 16:50 ..
-rw------- 1 pruebas.ubuntu citius    6 oct  8 16:52 one
-rw------- 1 pruebas.ubuntu citius    8 oct  8 16:52 two

b:
total 16K
drwx------ 2 pruebas.ubuntu citius 4,0K oct  8 16:52 .
drwx------ 4 pruebas.ubuntu citius 4,0K oct  8 16:50 ..
-rw------- 1 pruebas.ubuntu citius    6 oct  8 16:52 one
-rw------- 1 pruebas.ubuntu citius    8 oct  8 16:52 two

ここに問題があります。ファイルの1つを削除し、シンボリックリンクに置き換えました。

~/testdir/a$ rm one
~/testdir/a$ ln -s two one
~/testdir/a$ ls -lah
total 12K
drwx------ 2 pruebas.ubuntu citius 4,0K oct  8 16:55 .
drwx------ 4 pruebas.ubuntu citius 4,0K oct  8 16:54 ..
lrwxrwxrwx 1 pruebas.ubuntu citius    3 oct  8 16:55 one -> two
-rw------- 1 pruebas.ubuntu citius    8 oct  8 16:54 two

その後、Unisonはシンボリックリンクを削除し、それを以前のバージョンのファイルに置き換えます。

~/testdir$ unison -force newer -times -auto -batch a b
Contacting server...
Looking for changes
Reconciling changes
new link <====            one  
Propagating updates
UNISON 2.40.102 started propagating changes at 16:56:25.03 on 08 Oct 2014
[BGN] Copying one from /home/remoto/pruebas.ubuntu/testdir/b to /home/remoto/pruebas.ubuntu/testdir/a
[END] Copying one
UNISON 2.40.102 finished propagating changes at 16:56:25.03 on 08 Oct 2014
Saving synchronizer state
Synchronization complete at 16:56:25  (1 item transferred, 0 skipped, 0 failed)
~/testdir$ ls -lah a
total 16K
drwx------ 2 pruebas.ubuntu citius 4,0K oct  8 16:56 .
drwx------ 4 pruebas.ubuntu citius 4,0K oct  8 16:54 ..
-rw------- 1 pruebas.ubuntu citius    6 oct  8 16:54 one
-rw------- 1 pruebas.ubuntu citius    8 oct  8 16:54 two

そのオプションを使用しないと、これは発生しません-force newer。しかし、これは私にとって奇妙な行動のようです。これ手動説明する:

-force newer(または-force old)を指定して、Unisonに最新の(以前の)modtimeファイルを選択させることもできます。この場合、-timesのデフォルト設定も有効にする必要があります。

Unisonはシンボリックリンクを介してこの動作に従わないようです。これはあなたに間違って見えますか?それとも私が何かを見逃しているのでしょうか?

ベストアンサー1

おすすめ記事