[Unison-hackers] Unison Uprintf obsolete

Benjamin C. Pierce bcpierce at cis.upenn.edu
Sun Sep 28 12:48:10 EDT 2014


Thanks for the patch, Christopher.  I’ve incorporated it in the trunk and am cc’ing the unison-hackers list so that people know that there may be other issues lurking with the 4.02 OCaml update.

    - Benjamin

> From: Christopher Zimmermann <chrisz at openbsd.org>
> Subject: Unison Uprintf obsolete
> Date: Fri, 19 Sep 2014 16:36:49 +0200
> 
> Hello,
> 
> I am porting OCaml stuff for OpenBSD. We updated to OCaml 4.02 some
> weeks ago. Since the upgrade the stable unison port is segfaulting in
> different places. One place is the Uprintf module, whose use of
> Obj.magic is no longer safe. Since its only use is in ubase/util.ml
> and its additional functionality is provided by the OCaml stdlib
> since 3.09 I propose the following diff:
> 
> --- ubase/util.ml.orig	Fri Sep 19 12:38:42 2014
> +++ ubase/util.ml	Fri Sep 19 12:39:27 2014
> @@ -62,7 +62,8 @@
>   if s <> !infos then begin clear_infos (); infos := s; show_infos ()
> end 
> let msg f =
> -  clear_infos (); Uprintf.eprintf (fun () -> flush stderr; show_infos()) f
> +  clear_infos ();
> +  Printf.kfprintf (fun _ -> flush stderr; show_infos ()) stderr f
> 
> let msg : ('a, out_channel, unit) format -> 'a = msg
> 
> 
> with this diff the Uprintf module can be removed.
> 
> 
> Regards, 
> Christopher
> 
> 
> -- 
> http://gmerlin.de
> OpenPGP: http://gmerlin.de/christopher.pub
> F190 D013 8F01 AA53 E080  3F3C F17F B0A1 D44E 4FEE
> From: Christopher Zimmermann <chrisz at openbsd.org>
> Subject: Unison Uprintf obsolete
> Date: September 19, 2014 at 10:36:49 AM EDT
> To: unison-hackers at lists.seas.upenn.edu
> 
> 
> Hello,
> 
> I am porting OCaml stuff for OpenBSD. We updated to OCaml 4.02 some
> weeks ago. Since the upgrade the stable unison port is segfaulting in
> different places. One place is the Uprintf module, whose use of
> Obj.magic is no longer safe. Since its only use is in ubase/util.ml
> and its additional functionality is provided by the OCaml stdlib
> since 3.09 I propose the following diff:
> 
> --- ubase/util.ml.orig	Fri Sep 19 12:38:42 2014
> +++ ubase/util.ml	Fri Sep 19 12:39:27 2014
> @@ -62,7 +62,8 @@
>   if s <> !infos then begin clear_infos (); infos := s; show_infos ()
> end 
> let msg f =
> -  clear_infos (); Uprintf.eprintf (fun () -> flush stderr; show_infos
> ()) f
> +  clear_infos ();
> +  Printf.kfprintf (fun _ -> flush stderr; show_infos ()) stderr f
> 
> let msg : ('a, out_channel, unit) format -> 'a = msg
> 
> 
> with this diff the Uprintf module can be removed.
> 
> 
> Regards, 
> Christopher
> 
> 
> -- 
> http://gmerlin.de
> OpenPGP: http://gmerlin.de/christopher.pub
> F190 D013 8F01 AA53 E080  3F3C F17F B0A1 D44E 4FEE
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20140928/83834a83/attachment-0001.html>


More information about the Unison-hackers mailing list