letoh / ocaml-usb Goto Github PK
View Code? Open in Web Editor NEWOCaml bindings for libusb-1.0
License: Other
OCaml bindings for libusb-1.0
License: Other
Camlp4 release for OCaml 4.08 is the last release ever - see the official announcement. Since the project already dropped camlp4 dependency it would be good to make the release for opam as well: http://opam.ocaml.org/packages/usb/
The following pretty simple program segfaults
let main () =
try_lwt
(* open some non-existent device *)
let _ = USB.open_device_with 0x04b4 0x1002 in
Lwt_io.eprintl "Successful"
with Failure descr -> Lwt_io.eprintl descr
let () = Lwt_main.run (main ())
... and gdb
Program terminated with signal 11, Segmentation fault.
#0 0x00007f54b7f37f57 in libusb_get_next_timeout () from /lib/libusb-1.0.so.0
(gdb) bt
#0 0x00007f54b7f37f57 in libusb_get_next_timeout () from /lib/libusb-1.0.so.0
#1 0x0000000000480438 in ml_usb_get_next_timeout ()
#2 0x00000000004324ac in camlUSB__enter_iter_1134 () at src/USB.ml:201
#3 0x000000000045272d in camlLwt_sequence__loop_1066 ()
at src/core/lwt_sequence.ml:149
#4 0x00000000004384c3 in camlLwt_main__run_1012 () at src/unix/lwt_main.ml:39
#5 0x0000000000461998 in camlPervasives__fun_1466 () at pervasives.ml:449
#6 0x00000000004313b1 in camlStd_exit__entry () at std_exit.ml:16
#7 0x000000000042e229 in caml_program ()
#8 0x00000000004a5892 in caml_start_program ()
#9 0x00000000004a5a35 in __libc_csu_init ()
#10 0x00007f54b754dc8d in __libc_start_main (main=<value optimized out>,
argc=<value optimized out>, ubp_av=<value optimized out>,
init=<value optimized out>, fini=<value optimized out>,
rtld_fini=<value optimized out>, stack_end=0x7fff9467fb58)
at libc-start.c:228
#11 0x000000000042dea9 in _start ()
It is interesting, that the same program, but with printf's substituted with Lwt_log primitives works fine.
The system under test is Debian 6.0.6 with libusb 1.0.8-2 and latest OCaml, installed from opam.
To easily reproduce the bug, you can save the provided code to a file "crash.ml" and compile the following command
$ echo "<*.*>: package(lwt.unix),package(lwt.syntax),package(usb),syntax(camlp4o)" > _tags && ocamlbuild -use-ocamlfind crash.native --
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.