[Unison-hackers] PATCH: Bugfix unison -times support for directories
Benjamin Pierce
bcpierce at cis.upenn.edu
Fri Mar 20 17:57:22 EDT 2009
> Sorry it took so long to reply. It seems you are right, while this
> does work
> for the initial replication, if a file changes the parent's
> directory's
> modtime will be changed to the wrong time. Any idea how we can fix the
> -times option properly?
I don't remember what was the issue with OCaml for propagating
directory modtimes. Maybe Trevor or Jerome does?
Best,
- Benjamin
>
>
> # mkdir -p test1/test2 test1/test3
>
> # cp -a /tmp/49c2fbf3855bd /tmp/7XEMQU.tmp /tmp/jar_cache27933.tmp /
> tmp/test1/test2
> # ls -l /tmp/test1/test2
> total 20
> -rw------- 1 rhardy rhardy 12057 Mar 19 22:14 49c2fbf3855bd
> -rw------- 1 rhardy rhardy 1711 Mar 16 10:12 7XEMQU.tmp
> -rw-r--r-- 1 rhardy rhardy 1047 Mar 15 13:33 jar_cache27933.tmp
> test2/ test3/
>
> # cp -a /tmp/49c2fbf3855bd /tmp/7XEMQU.tmp /tmp/jar_cache27933.tmp /
> tmp/test1/test3
> # ls -la /tmp/test1/test3
> total 20
> drwxr-xr-x 2 root root 152 Mar 20 12:50 ./
> drwxr-xr-x 4 root root 96 Mar 20 12:49 ../
> -rw------- 1 rhardy rhardy 12057 Mar 19 22:14 49c2fbf3855bd
> -rw------- 1 rhardy rhardy 1711 Mar 16 10:12 7XEMQU.tmp
> -rw-r--r-- 1 rhardy rhardy 1047 Mar 15 13:33 jar_cache27933.tmp
> # touch /tmp/test1/test3
> vortex:/tmp/test1 12:51 {0}# ls -la /tmp/test1
> total 1
> drwxr-xr-x 4 root root 96 Mar 20 12:49 ./
> drwxrwxrwt 17 root root 1344 Mar 20 12:51 ../
> drwxr-xr-x 2 root root 152 Mar 20 12:50 test2/
> drwxr-xr-x 2 root root 152 Mar 20 12:51 test3/
> vortex:/tmp 12:51 {0}# ls -la
> total 342
> drwxrwxrwt 17 root root 1344 Mar 20 12:51 ./
> drwxr-xr-x 25 root root 680 Mar 2 18:37 ../
> -rw------- 1 rhardy rhardy 12057 Mar 19 22:14 49c2fbf3855bd
> -rw------- 1 rhardy rhardy 12057 Mar 19 22:14 49c2fbf39ec83
> -rw------- 1 rhardy rhardy 12057 Mar 19 22:14 49c2fbfa288a3
> -rw------- 1 rhardy rhardy 1711 Mar 16 10:12 7XEMQU.tmp
> drwxr-xr-x 2 rhardy rhardy 48 Mar 19 23:45 acroread_500_500/
> -rw-r--r-- 1 root root 32227 Mar 11 23:44 alsa-info.txt
> drwxrwxrwt 2 root root 72 Mar 1 12:41 .font-unix/
> drwx------ 3 rhardy rhardy 72 Mar 20 12:45 gconfd-rhardy/
> srw-rw-rw- 1 root root 0 Mar 2 09:40 .gdm_socket=
> -rw------- 1 rhardy rhardy 117 Mar 20 12:45 .gdmYEH1QU
> drwxr-xr-x 2 rhardy rhardy 48 Mar 20 00:01 hsperfdata_rhardy/
> drwxr-xr-x 2 root root 48 Mar 15 13:29 hsperfdata_root/
> drwxrwxrwt 2 root root 112 Mar 20 12:45 .ICE-unix/
> -rw-r--r-- 1 rhardy rhardy 0 Mar 15 13:32 jar_cache27926.tmp
> -rw-r--r-- 1 rhardy rhardy 1054 Mar 15 13:32 jar_cache27927.tmp
> -rw-r--r-- 1 rhardy rhardy 0 Mar 15 13:32 jar_cache27929.tmp
> -rw-r--r-- 1 rhardy rhardy 1054 Mar 15 13:32 jar_cache27930.tmp
> -rw-r--r-- 1 rhardy rhardy 0 Mar 15 13:33 jar_cache27932.tmp
> -rw-r--r-- 1 rhardy rhardy 1047 Mar 15 13:33 jar_cache27933.tmp
> -rw-r--r-- 1 rhardy rhardy 0 Mar 15 13:33 jar_cache27935.tmp
> -rw-r--r-- 1 rhardy rhardy 1054 Mar 15 13:33 jar_cache27936.tmp
> -rw-r--r-- 1 rhardy rhardy 65598 Mar 15 13:33 jar_cache27937.tmp
> -rw-r--r-- 1 rhardy rhardy 0 Mar 15 13:33 jar_cache27938.tmp
> -rw-r--r-- 1 rhardy rhardy 1046 Mar 15 13:33 jar_cache27939.tmp
> -rw-r--r-- 1 rhardy rhardy 167887 Mar 15 13:33 jar_cache27940.tmp
> -rw-r--r-- 1 rhardy rhardy 0 Mar 15 13:33 jar_cache27941.tmp
> -rw-r--r-- 1 rhardy rhardy 1054 Mar 15 13:33 jar_cache27942.tmp
> drwx------ 2 rhardy rhardy 72 Mar 20 12:51 kde-rhardy/
> drwx------ 3 rhardy rhardy 592 Mar 20 12:45 ksocket-rhardy/
> -rw-r----- 1 rhardy rhardy 6 Mar 11 21:24 .ktorrent_500.lock
> drwx------ 2 root root 48 Feb 12 01:55 lost+found/
> drwx------ 2 rhardy rhardy 360 Mar 20 12:45 orbit-rhardy/
> drwx------ 2 rhardy rhardy 80 Mar 20 12:45 ssh-ICvvB13260/
> drwxr-xr-x 4 root root 96 Mar 20 12:49 test1/
> -r--r--r-- 1 root root 11 Mar 20 00:03 .X0-lock
> drwxrwxrwt 2 root root 72 Mar 20 00:03 .X11-unix/
>
> vortex:/tmp 12:53 {0}# unison -owner -group -times test1 dest
> Contacting server...
> Connected [//vortex//tmp/dest -> //vortex//tmp/test1]
> Looking for changes
>
> Press return to continue.[<spc>] scanning test2/7XEMQU.tmp
> Reconciling changes
>
> test1 dest
> props ====> props / [] .
> dir ----> test2 [f] .
> dir ----> test3 [f] .
>
> Proceed with propagating updates? [] y
> Propagating updates
>
> UNISON 2.27.57 started propagating changes at 12:54:40 on 20 Mar 2009
> [BGN] Copying properties for from /tmp/test1 to /tmp/dest
> [END] Copying properties for
> [BGN] Copying test2 from /tmp/test1 to /tmp/dest
> [END] Copying test2
> [BGN] Copying test3 from /tmp/test1 to /tmp/dest
> [END] Copying test3
> UNISON 2.27.57 finished propagating changes at 12:54:40 on 20 Mar 2009
>
> Saving synchronizer state
> Synchronization complete (3 items transferred, 0 skipped, 0 failures)
> vortex:/tmp 12:54 {0}# ls -l
> total 329
> drwxr-xr-x 4 root root 96 Mar 20 12:54 dest/
> drwxr-xr-x 4 root root 96 Mar 20 12:49 test1/
> vortex:/tmp 12:54 {0}# ls -l dest/
> total 0
> drwxr-xr-x 2 root root 152 Mar 20 12:50 test2/
> drwxr-xr-x 2 root root 152 Mar 20 12:51 test3/
>
> 49c2fbf3855bd 7XEMQU.tmp jar_cache27933.tmp
>
> # cp -a /tmp/jar_cache27940.tmp /tmp/test1/test3/jar_cache27933.tmp
>
> vortex:/tmp 12:55 {0}# unison -owner -group -times test1 dest
> Contacting server...
> Connected [//vortex//tmp/dest -> //vortex//tmp/test1]
> Looking for changes
> scanning
> Reconciling changes
>
> test1 dest
> ====> props / [f] .
> changed ----> test3/jar_cache27933.tmp [f] .
>
> Proceed with propagating updates? [] y
> Propagating updates
>
>
> UNISON 2.27.57 started propagating changes at 12:56:05 on 20 Mar 2009
> [BGN] Copying properties for from /tmp/test1 to /tmp/dest
> [END] Copying properties for
> [BGN] Updating file test3/jar_cache27933.tmp from /tmp/test1 to /tmp/
> dest
> [END] Updating file test3/jar_cache27933.tmp
> UNISON 2.27.57 finished propagating changes at 12:56:05 on 20 Mar 2009
>
>
> Saving synchronizer state
> Synchronization complete (2 items transferred, 0 skipped, 0 failures)
> # ls -la /tmp/
> total 342
> drwxrwxrwt 18 root root 1368 Mar 20 12:55 ./
> drwxr-xr-x 25 root root 680 Mar 2 18:37 ../
> drwxr-xr-x 4 root root 96 Mar 20 12:49 dest/
> drwxr-xr-x 4 root root 96 Mar 20 12:49 test1/
>
> # ls -la test1 dest/
> dest/:
> total 1
> drwxr-xr-x 4 root root 96 Mar 20 12:49 ./
> drwxrwxrwt 18 root root 1368 Mar 20 12:55 ../
> drwxr-xr-x 2 root root 152 Mar 20 12:50 test2/
> drwxr-xr-x 2 root root 152 Mar 20 12:56 test3/
> ******* WRONG TIME *************
>
> test1:
> total 1
> drwxr-xr-x 4 root root 96 Mar 20 12:49 ./
> drwxrwxrwt 18 root root 1368 Mar 20 12:55 ../
> drwxr-xr-x 2 root root 152 Mar 20 12:50 test2/
> drwxr-xr-x 2 root root 152 Mar 20 12:51 test3/
>
> # ls -la test1 dest/test3/
> dest/test3/:
> total 180
> drwxr-xr-x 2 root root 152 Mar 20 12:56 ./
> drwxr-xr-x 4 root root 96 Mar 20 12:49 ../
> -rw------- 1 rhardy rhardy 12057 Mar 19 22:14 49c2fbf3855bd
> -rw------- 1 rhardy rhardy 1711 Mar 16 10:12 7XEMQU.tmp
> -rw-r--r-- 1 rhardy rhardy 167887 Mar 15 13:33 jar_cache27933.tmp
>
> test1:
> total 1
> drwxr-xr-x 4 root root 96 Mar 20 12:49 ./
> drwxrwxrwt 18 root root 1368 Mar 20 12:55 ../
> drwxr-xr-x 2 root root 152 Mar 20 12:50 test2/
> drwxr-xr-x 2 root root 152 Mar 20 12:51 test3/
>
>
> Regards,
> Rob
>
> --
> Robert Hardy, B.Eng Computer Systems
> Systems Analyst/Software Developer/I.T. Specialist
> Teledyne Controls Simulation
> 105-2255 St Laurent Blvd
> Ottawa, ON K1G 4K3 Canada
> +16135262059 ex 355
> Fax +16135265751
>
> On Mon, 2 Feb 2009, Benjamin Pierce wrote:
>> Hi Rob,
>>
>> With just this patch, if an updated file is transferred by Unison,
>> won't its parent directory's modtime then be wrong on the receiving
>> host?
>>
>> Best,
>>
>> - Benjamin
>>
>>
>> On Feb 2, 2009, at 6:20 PM, Robert Hardy wrote:
>>> There seems to be a bug in the unison -times option in that it
>>> ignores
>>> directory times. I found some comments in BUGS.txt that suggests
>>> this
>>> needed OCAML changes. I can't see why that comment is there. With
>>> some
>>> suggestions from freenode's #ocaml I came up with this patch which
>>> works
>>> on Linux.
>>>
>>> I was syncing large quanties of data between an el4 and el5 box.
>>> Ignoring
>>> the directory times caused me a lot of problems.
>>>
>>> I suspect this patch should also be extended for Unix.S_LNK as
>>> currently
>>> unison with -owner -group -times should set the user/owner for
>>> links and
>>> it does not.
>>>
>>> Here is a simple patch which in basic testing under el5 seems to fix
>>> this problem:
>>>
>>> http://webcon.ca/~rhardy/utmp/unison-2.27.57-dir_times.patch
>>>
>>> diff -urNbBp unison-2.27.57/props.ml.orig unison-2.27.57/props.ml
>>> --- unison-2.27.57/props.ml.orig 2007-04-01 23:03:20.000000000 -0400
>>> +++ unison-2.27.57/props.ml 2009-02-02 14:22:07.000000000 -0500
>>> @@ -501,6 +501,8 @@ let get stats _ =
>>> let v = stats.Unix.LargeFile.st_mtime in
>>> if stats.Unix.LargeFile.st_kind = Unix.S_REG && Prefs.read sync
>>> then
>>> Synced v
>>> + else if stats.Unix.LargeFile.st_kind = Unix.S_DIR && Prefs.read
>>> sync then
>>> + Synced v
>>> else
>>> NotSynced v
>
> _______________________________________________
> Unison-hackers mailing list
> Unison-hackers at lists.seas.upenn.edu
> http://lists.seas.upenn.edu/mailman/listinfo/unison-hackers
More information about the Unison-hackers
mailing list