Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Unison crashes on some platforms when built with 4.02 #6621
Original bug ID: 6621
I've been getting reports that Unison doesn't work when built on some platforms with 4.02 (either 4.02.0 or 4.02.1). Here's what I think I know:
A message about this from a user is in the "additional information"
Steps to reproduce
Grab Unison tarball from
Unpack. Go inside.
I'm also seeing this broken build of unison 2.40.102. It happened when
Outputting the version works, but not running unison as usual:
% ./unison -version
It outputs 15 bytes of junk for some reason:
% ./unison &> output.txt
% xxd output.txt
% lldb ./unison -c /cores/core.9045
Comment author: @yallop
This is quite likely to be a result of the change in representation of format values, which are no longer represented as strings:
The Ubase.fprintf function used in Unison accepts a format argument:
and uses an unsafe coercion to treat the format value as a string:
Replacing the coercion (Obj.magic) with a call to the string_of_format function may help:
Comment author: @damiendoligez
I've reproduced the bug (complete with 15 bytes of output that look like two pointers followed by a NUL byte) with 4.02.1 on MacOSX 10.7 (Mountain Lion) so it doesn't look like a problem with the new MacOS version.
As for uprintf.ml, you should get rid of this old unsafe code and use Printf.kfprintf instead. The only use I found in is util.ml and you can replace it with:
let msg f =
I've tested it on Mountain Lion and it seems to fix the problem.
Comment author: bcpierce
Yes, this fix seems to work. I've built a new Unison version for people to test.
I also think I was incorrect that it was working on Mavericks, so we don't need to worry about other issues for the time being. For now, this can be marked as fixed.
Comment author: macosx12345
Additionnally, when compiled with ocaml 4.02 and the X11 interface under Mac OS 10.8, unison (or lablgtk2 ?) crashes non systematically with a segmentation fault in lablgtk2's function ml_g_signal_emit_by_name.
Steps to reproduce: compile unison with Gtk2 support ("UISTYLE=gtk2"), start unison in graphics mode ("unison -ui graphic") and play with the dialog box showing the list of files to update. After a few random clicks, unison should crash. I tried both lablgtk2 2.18.0 and 2.18.2 and ocaml 4.02.0 and 4.02.1 with the same trouble.
Reverting to compiling lablgtk2 2.18.2 and unison with ocaml 4.01 solved (of course) the issue.