[Unison-hackers] patches for 2.10.2 and 2.12.0

Zvezdan Petkovic zpetkovic at acm.org
Fri May 27 20:24:54 EDT 2005


On Fri, May 27, 2005 at 02:55:11PM +0200, Jerome Vouillon wrote:
> Actually, Unison always gives the preference to $UNISON.  It searches
> in the user's home directory only when $UNISON is not set.
> So, Andrew's patch for 2.10.2 is correct, but the fix in 2.12.0 is
> wrong (using $UNISON as a home dir should be a last resort option)...

Then we need a patch for 2.12.0.
It is attached (combined with your localtime patch).
I've already included it in my port.

Thank you very much for responding.
Regards,

	Zvezdan Petkovic
-------------- next part --------------
$OpenBSD$
Post-release developer patch.
o Catch failure of localtime library call.
  See http://lists.seas.upenn.edu/pipermail/unison-hackers/2005-May/000092.html
o Fix the order of looking for home directory.
  See http://lists.seas.upenn.edu/pipermail/unison-hackers/2005-May/000088.html
--- ubase/util.ml.orig	Sat Mar 12 11:17:58 2005
+++ ubase/util.ml	Fri May 27 18:07:18 2005
@@ -244,14 +244,18 @@ let time () =
   convertUnixErrorsToTransient "time" Unix.time
 
 let time2string timef =
-  let time = localtime timef in
-  Printf.sprintf
-    "%2d:%.2d on %2d %3s, %4d"
-    time.Unix.tm_hour
-    time.Unix.tm_min
-    time.Unix.tm_mday
-    (monthname time.Unix.tm_mon)
-    (time.Unix.tm_year + 1900)
+  try
+    let time = localtime timef in
+    Printf.sprintf
+      "%2d:%.2d:%.2d on %2d %3s, %4d"
+      time.Unix.tm_hour
+      time.Unix.tm_min
+      time.Unix.tm_sec
+      time.Unix.tm_mday
+      (monthname time.Unix.tm_mon)
+      (time.Unix.tm_year + 1900)
+  with Transient _ ->
+    "(invalid date)"
 
 let percentageOfTotal current total =
   (int_of_float ((float current) *. 100.0 /. (float total)))
@@ -364,11 +368,11 @@ let fileInHomeDir n =
     Filename.concat (safeGetenv "HOME") n
   else if osType = `Win32 then
     let dirString =
-      try Unix.getenv "UNISON" (* Use UNISON dir if it is set *)
+      try Unix.getenv "USERPROFILE" (* Windows NT/2K standard *)
       with Not_found ->
       try Unix.getenv "HOME" (* Windows 9x with Cygwin HOME set *)
       with Not_found ->
-      try Unix.getenv "USERPROFILE" (* Windows NT/2K standard *)
+      try Unix.getenv "UNISON" (* Use UNISON dir if it is set *)
       with Not_found ->
       "c:/" (* Default *) in
     Filename.concat dirString n


More information about the Unison-hackers mailing list