The following message is a courtesy copy of an article that has been posted to gmane.linux.debian.devel.ocaml as well.
Christian PERRIER <[email protected]> writes: > Dear Ocaml maintainers, [...] > Still, my clues in Ocaml are close to zero....and #557553 can't be > solved by myself alone. > The following patch seem to do the trick but need testing: --8<---------------cut here---------------start------------->8--- --- geneweb-5.02~cvs20091031.orig/src/iovalue.ml +++ geneweb-5.02~cvs20091031/src/iovalue.ml @@ -10,7 +10,7 @@ value fun_tag = Obj.tag (Obj.repr (fun x read inside a value output by output_value (no headers) must match OCaml's input_value system (intern.c) *) -value sizeof_long = Sys.word_size / 8; +value sizeof_long = 32 / 8; value sign_extend_shift = (sizeof_long - 1) * 8 - 1; value sign_extend x = (x lsl sign_extend_shift) asr sign_extend_shift; --8<---------------cut here---------------end--------------->8--- The problem seem to be that the author assume that the input_binary_int/output_binary_int standard function use different size for writing on different arch, when they are specified as to be using 4 bytes, big-endian, and to be compatible across all machines for a given version of Objective Caml. This NEED testing. (Having a stack frame has been difficult, finding the problem has been then easy. for reference, here is the patch for producing the stack frame, some change might be unneeded). --8<---------------cut here---------------start------------->8--- --- geneweb-5.02~cvs20091031.orig/wserver/wserver.ml +++ geneweb-5.02~cvs20091031/wserver/wserver.ml @@ -176,6 +176,7 @@ value print_exc exc = prerr_char '\n' } | x -> do { + raise x; prerr_string "Wserver: uncaught exception: "; prerr_string (Obj.magic (Obj.field (Obj.field (Obj.repr x) 0) 0)); if Obj.size (Obj.repr x) > 1 then do { @@ -666,7 +667,7 @@ value f addr_opt port tmout max_clients | Unix.Unix_error (Unix.EBADF | Unix.ENOTSOCK) "accept" _ as x -> (* oops! *) raise x | Sys_error "Broken pipe" -> () - | exc -> print_err_exc exc ]; + | exc -> raise exc ]; try wflush () with [ Sys_error _ -> () ]; try flush stdout with [ Sys_error _ -> () ]; flush stderr; --- geneweb-5.02~cvs20091031.orig/tools/Makefile.inc.opt +++ geneweb-5.02~cvs20091031/tools/Makefile.inc.opt @@ -5,8 +5,8 @@ CAMLP5_COMM=TOP=$(TOP) $(TOP)/tools/caml CAMLP5F=-DUNIX CAMLP5D=+camlp5 LIBUNIX=-cclib -lunix -OCAMLC=ocamlc.opt -OCAMLOPT=ocamlopt.opt +OCAMLC=ocamlc.opt -g +OCAMLOPT=ocamlopt.opt -g OCAMLI= OCAMLD= STRIP=strip --- geneweb-5.02~cvs20091031.orig/tools/Makefile.inc.out +++ geneweb-5.02~cvs20091031/tools/Makefile.inc.out @@ -2,14 +2,14 @@ TOP=.. CAMLP5_COMM=TOP=$(TOP) $(TOP)/tools/camlp5_comm.sh CAMLP5F=-DUNIX CAMLP5D=+camlp5 LIBUNIX=-cclib -lunix -OCAMLC=ocamlc +OCAMLC=ocamlc -g OCAMLOPT=ocamlopt OCAMLI= OCAMLD= -STRIP=strip +STRIP= RM=/bin/rm -f EXE= STATIC=-ccopt -static --8<---------------cut here---------------end--------------->8--- -- Rémi Vanicat -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

