Re: [Libguestfs] libldm crashes in a linux-sandbox context

2023-06-21 Thread Vincent MAILHOL
Hi Richard and Lersek, Thanks for your help on this issue and thanks for picking up my patch and applying it upstream! On Tue. 20 June 2023 à 17:10, Richard W.M. Jones wrote: > I think you've solved the problem now, but for future reference you > can run: > > $ virt-rescue Perfect! This last

[Libguestfs] [PATCH nbdkit 2/6] tests/test_ocaml_plugin.ml: Print a message when test plugin initializes

2023-06-21 Thread Richard W.M. Jones
It's useful to have a message which is printed as the top level statements in the plugin module are being initialized, for debugging purposes. --- tests/test_ocaml_plugin.ml | 5 + 1 file changed, 5 insertions(+) diff --git a/tests/test_ocaml_plugin.ml b/tests/test_ocaml_plugin.ml index 561a8

[Libguestfs] [PATCH nbdkit 4/6] ocaml: Replace caml_leave_blocking_section with caml_acquire_runtime_system

2023-06-21 Thread Richard W.M. Jones
Replace: caml_leave_blocking_section ... caml_enter_blocking_section with the more sensibly named (and equivalent): caml_acquire_runtime_system ... caml_release_runtime_system In addition we must release the runtime system just after caml_startup and only acquire it around callbacks

[Libguestfs] [PATCH nbdkit 3/6] ocaml: Add -I +unix before using unix.cmxa

2023-06-21 Thread Richard W.M. Jones
In OCaml 5.0 you will see this warning: Alert ocaml_deprecated_auto_include: OCaml's lib directory layout changed in 5.0. The unix subdirectory has been automatically added to the search path, but you should add -I +unix to the command-line to silence this alert (e.g. by adding unix to the

[Libguestfs] [PATCH nbdkit 6/6] ocaml: Fix thread registration for OCaml 5

2023-06-21 Thread Richard W.M. Jones
OCaml 5 is strict about registering threads before calling OCaml heap functions, and will abort the program with this error if you don't do this correctly: Fatal error: no domain lock held Fix this as explained in the comment. Note (as it's not explained well in the documentation): Threads cre

[Libguestfs] [PATCH nbdkit 0/6] Various fixed for OCaml 5

2023-06-21 Thread Richard W.M. Jones
(Not for review, I've already pushed this upstream as commits 35db543e3..9d4b87e03) This series fixes nbdkit for OCaml 5 (thanks Jerry James for providing the Fedora packages necessary), and I tested it and it compiles and tests fine at least as far back as OCaml 4.05. It was quite complicated an

[Libguestfs] [PATCH nbdkit 5/6] ocaml: Always unregister the global root and free the handle

2023-06-21 Thread Richard W.M. Jones
If the OCaml code did not provide a close method, we would never call close_wrapper, and then we ended up leaking the global root and handle. --- plugins/ocaml/plugin.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/plugins/ocaml/plugin.c b/plugins/ocaml/pl

[Libguestfs] [PATCH nbdkit 1/6] configure: Recommend using -g with OCAMLOPTFLAGS

2023-06-21 Thread Richard W.M. Jones
--- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c1d83a568..39b58b44e 100644 --- a/configure.ac +++ b/configure.ac @@ -935,8 +935,8 @@ AC_SUBST([PYTHON_LDFLAGS]) dnl For the OCaml plugin, you can set OCAMLOPTFLAGS before

[Libguestfs] [PATCH libnbd] ocaml: Release runtime lock around call to nbd_close

2023-06-21 Thread Richard W.M. Jones
OCaml 5 is stricter than earlier versions about correct locking. We must release the OCaml runtime lock when calling nbd_close since it may do some long-running operations and we want to allow concurrent threads to run. However specifically if there are callbacks (eg. a debug callback) then we wo