Unison은 -force newer 옵션을 사용하여 최신 심볼릭 링크를 이전 파일로 대체합니다.

Unison은 -force newer 옵션을 사용하여 최신 심볼릭 링크를 이전 파일로 대체합니다.

Unison과 심볼릭 링크에 문제가 있습니다. 이를 더 쉽게 이해하고 직접 시도해 볼 수 있도록 테스트 케이스를 만들었습니다.

먼저 동기화할 두 개의 디렉터리를 만듭니다. 그리고 첫 번째 디렉터리에 있는 일부 파일.

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

여기에 문제가 있습니다. 해당 파일 중 하나를 삭제하고 심볼릭 링크로 대체합니다.

~/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은 심볼릭 링크를 사용하여 이 동작을 따르지 않는 것 같습니다. 이것이 버그처럼 보입니까? 아니면 내가 뭔가를 놓치고 있는 걸까?

관련 정보