You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 1458 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
Hi,
When I marshal a simple value to a file and read it back again, from a
bytecode enabled toplevel, i get a segfault.
The simple code is as such:
type mytype = T of (float * float)
let fd = open_out_bin "/tmp/file.mld"
let myval = T (1.0, 1.0)
Marshal.to_channel fd myval []
close_out fd
let fd = open_in_bin "/tmp/file.mld"
let myval = (Marshal.from_channel fd: mytype)
match myval with
T bla -> bla
In fact, entering the code line-by-line in the toplevel shows that the
type of myval is not recognized:
let myval = (Marshal.from_channel fd : mytype)
val myval : mytype =
The toplevel is made as such:
%ocamlmktop -thread /usr/lib/ocaml/threads/unix.cma
/usr/lib/ocaml/threads/threads.cma -o ocaml-th
When I marshal a simple value to a file and read it back again, from a
bytecode enabled toplevel, i get a segfault.
The simple code is as such:
type mytype = T of (float * float)
let fd = open_out_bin "/tmp/file.mld"
let myval = T (1.0, 1.0)
Marshal.to_channel fd myval []
close_out fd
let fd = open_in_bin "/tmp/file.mld"
let myval = (Marshal.from_channel fd: mytype)
match myval with
T bla -> bla
The bytecode thread-safe version of Marshal.from_channel is indeed
broken. A simple workaround is to use Pervasives.input_value, which
is functionally equivalent but not broken. The fix that is now in the
CVS development version is simply to replace the wrong definition of
from_channel in otherlibs/threads/marshal.ml by the simpler and more
correct
Original bug ID: 1458
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Hi,
When I marshal a simple value to a file and read it back again, from a
bytecode enabled toplevel, i get a segfault.
The simple code is as such:
type mytype = T of (float * float)
let fd = open_out_bin "/tmp/file.mld"
let myval = T (1.0, 1.0)
Marshal.to_channel fd myval []
close_out fd
let fd = open_in_bin "/tmp/file.mld"
let myval = (Marshal.from_channel fd: mytype)
match myval with
T bla -> bla
In fact, entering the code line-by-line in the toplevel shows that the
type of myval is not recognized:
let myval = (Marshal.from_channel fd : mytype)
val myval : mytype =
The toplevel is made as such:
%ocamlmktop -thread /usr/lib/ocaml/threads/unix.cma
/usr/lib/ocaml/threads/threads.cma -o ocaml-th
Ocaml 3.06, RH7.2
best regards
henri
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
The text was updated successfully, but these errors were encountered: