It seems that trying to parse two opam files at the same time results in a crash:
let data = {|
opam-version: "2.0"
version: "2.1.5"
synopsis: "Format library for opam 2.1"
|}
let test () =
try
for _ = 1 to 1000 do
let file = OpamFile.OPAM.read_from_string data in
ignore file
done
with ex ->
Printexc.print_backtrace stderr;
Printf.eprintf "test.ml: %s\n%!" (Printexc.to_string ex)
let () =
Printexc.record_backtrace true; (* Does nothing?? *)
let a = Domain.spawn test in
let b = Domain.spawn test in
Domain.join a;
Domain.join b
$ dune exec ./test.exe
test.ml: At ./<none>:2:14-2:19::
Parse error
fish: Job 1, 'dune exec ./test.exe' terminated by signal SIGSEGV (Address boundary error)
Different runs produce different errors, e.g.
test.ml: At ./<none>:3:7-3:8::
Parse error
test.ml: Invalid_argument("index out of bounds")
I guess this is because it uses Stdlib.Parsing, which doesn't look thread-safe. Would be good to have some documentation on how to use the library safely with OCaml 5.
Tested with opam-format 2.1.5.
It seems that trying to parse two opam files at the same time results in a crash:
Different runs produce different errors, e.g.
I guess this is because it uses
Stdlib.Parsing, which doesn't look thread-safe. Would be good to have some documentation on how to use the library safely with OCaml 5.Tested with opam-format 2.1.5.