[Unison-hackers] patches for 2.10.2 and 2.12.0

Zvezdan Petkovic zpetkovic at acm.org
Mon May 23 18:40:29 EDT 2005


On Mon, May 23, 2005 at 03:44:11PM -0400, Zvezdan Petkovic wrote:
> Also, what about the two patches for 2.10.2 that Andrew uses for Cygwin?
> 
> dot-unison.patch - make Unison use the Unix-like behavior in looking for 
> the .unison directory (look first in $UNISON, then $HOME/.unison).
> 
> This one seems to be applied to 2.12.0.
> I assume it is safe to patch 2.10.2 with it too, isn't it?

I lied. :-)
After comparing _carefully_ the code in 2.12.0 and Andrews patch I see
that his patch still doesn't give the preference to $UNISON environment
variable although the README claims so.
I think the patch should be as attached below (just picked from 2.12.0).

> text-mode.patch - fix three places where Unison opened files in text mode
> instead of binary (http://groups.yahoo.com/group/unison-users/message/3184, 
> http://article.gmane.org/gmane.network.unison.general/2406).
> 
> I don't know about this one.
> Is this something Cygwin specific, or does it apply to all platforms?
> Should I patch OpenBSD 2.10.2 stable with this?

Well, copy.ml part of this patch is quite different (simpler) in 2.12.0
than in Andrew's patch.  The part in fingerprint.ml is identical, so I
assume it is safe to apply.  The part in update.ml is again simpler in
2.12.0 than in Andrew's patch.  Should we roll a new patch using source
from 2.12.0?

Regards,

	Zvezdan
-------------- next part --------------
$OpenBSD$
Post-release developer patch.
Make Unison look first in $UNISON, then $HOME/.unison on Windows.
See the source change in beta version 2.12.0
--- ubase/util.ml.orig	Mon Sep  6 15:15:47 2004
+++ ubase/util.ml	Mon May 23 17:28:09 2005
@@ -355,19 +355,20 @@ let padto n s = s ^ (String.make (max 0 
 (*****************************************************************************)
 
 let fileInHomeDir n =
-  match osType with
-    `Win32 ->
-      let dirString =
-        try Unix.getenv "USERPROFILE" (* Windows NT/2K *)
-        with Not_found ->
-        try Unix.getenv "HOME" (* Windows 9x with Cygwin HOME set *)
-        with Not_found ->
-        try Unix.getenv "UNISON" (* Use UNISON dir if none of
-                                    the above are set *)
-        with Not_found -> "c:/" (* Default *) in
-      Filename.concat dirString n
-  | `Unix ->
-      Filename.concat (safeGetenv "HOME") n
+  if (osType = `Unix) || isCygwin then
+    Filename.concat (safeGetenv "HOME") n
+  else if osType = `Win32 then
+    let dirString =
+      try Unix.getenv "UNISON" (* Use UNISON dir if it is set *)
+      with Not_found ->
+      try Unix.getenv "HOME" (* Windows 9x with Cygwin HOME set *)
+      with Not_found ->
+      try Unix.getenv "USERPROFILE" (* Windows NT/2K standard *)
+      with Not_found ->
+      "c:/" (* Default *) in
+    Filename.concat dirString n
+  else
+    assert false (* osType can't be anything else *)
 
 (*****************************************************************************)
 (*           "Upcall" for building pathnames in the .unison dir              *)


More information about the Unison-hackers mailing list