ocaml-community / obus Goto Github PK
View Code? Open in Web Editor NEWPure OCaml implementation of the D-Bus protocol
License: Other
Pure OCaml implementation of the D-Bus protocol
License: Other
While making #8, I noticed that at https://github.com/diml/obus/blob/master/src/oBus_value.ml#L342 we have:
try
let _ = length_validate_signature in
str
with Failure msg ->
raise (Invalid_signature(str, msg))
The length_validate_signature
function isn't called here, which seems wrong.
This is a wishlist forwarded from https://bugs.debian.org/836118 :
The major D-Bus implementations (libdbus, GDBus, sd-bus) now have a fallback code path, before trying X11 autolaunch, when DBUS_SESSION_BUS_ADDRESS is unset: if XDG_RUNTIME_DIR
is set, and XDG_RUNTIME_DIR/bus exists, is a socket and is owned by the process's uid, then they will use it. In particular, dbus-user-session sets up that situation.
It would be nice if obus implemented this fallback as well.
Hi,
I'm the creator of pydbus, DBus bindings for Python. I've stumbled upon the case of bytestrings - ay - which are commonly used to send non-Unicode data over DBus.
Because of the GDBus's API, apps commonly require these strings to be '\0'-terminated. And that's completely unintuitive for high-level languages, and something that requires the user to read API docs.
I'm thinking about solving the problem automatically, and I see two solutions:
Whatever we choose, the solution should be agreed upon by authors of bindings for all languages. That's why I'm here.
Do you have any experience with "ay"-encoded bytestrings?
Relevant discussion: LEW21/pydbus#27 (please reply there, I've opened similar issues in 8 different projects to get attention of bindings authors)
compiling obus fails for me:
./setup-dev.exe -build
W: Field XMETAType is set but matching plugin is not enabled.
W: No exported module defined for library obus-syntax
W: Field XMETAType is set but matching plugin is not enabled.
W: No exported module defined for library obus-syntax
W: Cannot find source file matching module 'Policy_kit_interfaces' in library obus-policykit
W: Cannot find source file matching module 'Policy_kit_interfaces' in library obus-policykit
W: Cannot find source file matching module 'UDisks_interfaces' in library obus-udisks
W: Cannot find source file matching module 'UDisks_interfaces' in library obus-udisks
W: Cannot find source file matching module 'UPower_interfaces' in library obus-upower
W: Cannot find source file matching module 'UPower_interfaces' in library obus-upower
W: Cannot find source file matching module 'Nm_interfaces' in library obus-network-manager
W: Cannot find source file matching module 'Nm_interfaces' in library obus-network-manager
W: Cannot find source file matching module 'Notification_interfaces' in library obus-notification
W: Cannot find source file matching module 'Notification_interfaces' in library obus-notification
W: Cannot find source file matching module 'Hal_interfaces' in library obus-hal
W: Cannot find source file matching module 'Hal_interfaces' in library obus-hal
W: Cannot find source file matching module 'OBus_interfaces' in library obus
W: Cannot find source file matching module 'OBus_interfaces' in library obus
/opt/godi/bin/ocamlopt.opt -I /opt/godi/lib/ocaml/std-lib/ocamlbuild unix.cmxa /opt/godi/lib/ocaml/std-lib/ocamlbuild/ocamlbuildlib.cmxa myocamlbuild.ml /opt/godi/lib/ocaml/std-lib/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
ocamlfind ocamldep -package xmlm -package type_conv -package lwt.unix -package lwt.syntax.log -package lwt.syntax -package lwt.react -package camlp4.quotations.o -package camlp4.lib -package camlp4.extend -modules src/oBus_address.mli > src/oBus_address.mli.depends
ocamlfind ocamldep -package xmlm -package type_conv -package lwt.unix -package lwt.syntax.log -package lwt.syntax -package lwt.react -package camlp4.quotations.o -package camlp4.lib -package camlp4.extend -modules src/oBus_uuid.mli > src/oBus_uuid.mli.depends
ocamlfind ocamlc -c -g -I src -package xmlm -package type_conv -package lwt.unix -package lwt.syntax.log -package lwt.syntax -package lwt.react -package camlp4.quotations.o -package camlp4.lib -package camlp4.extend -I src -o src/oBus_uuid.cmi src/oBus_uuid.mli
ocamlfind ocamlc -c -g -I src -package xmlm -package type_conv -package lwt.unix -package lwt.syntax.log -package lwt.syntax -package lwt.react -package camlp4.quotations.o -package camlp4.lib -package camlp4.extend -I src -o src/oBus_address.cmi src/oBus_address.mli
ocamlfind ocamldep -package type_conv -package camlp4.quotations.o -package camlp4 -syntax camlp4o -modules syntax/pa_obus.ml > syntax/pa_obus.ml.depends
ocamlfind ocamlc -c -g -package type_conv -package camlp4.quotations.o -package camlp4 -syntax camlp4o -I syntax -o syntax/pa_obus.cmo syntax/pa_obus.ml
+ ocamlfind ocamlc -c -g -package type_conv -package camlp4.quotations.o -package camlp4 -syntax camlp4o -I syntax -o syntax/pa_obus.cmo syntax/pa_obus.ml
File "syntax/pa_obus.ml", line 16, characters 9-1049:
Error: This function expects too many arguments, it should have type
Camlp4.PreCast.Syntax.Ast.expr option ->
Camlp4.PreCast.Ast.ctyp -> Camlp4.PreCast.Ast.str_item
Command exited with code 2.
E: Failure("Command '/opt/godi/bin/ocamlbuild src/obus.cma src/obus.cmxs src/obus.cmxa src/obus.a src/obus-idl.cma src/obus-idl.cmxs src/obus-idl.cmxa src/obus-idl.a syntax/obus-syntax.cma bindings/hal/obus-hal.cma bindings/hal/obus-hal.cmxs bindings/hal/obus-hal.cmxa bindings/hal/obus-hal.a bindings/notification/obus-notification.cma bindings/notification/obus-notification.cmxs bindings/notification/obus-notification.cmxa bindings/notification/obus-notification.a bindings/network-manager/obus-network-manager.cma bindings/network-manager/obus-network-manager.cmxs bindings/network-manager/obus-network-manager.cmxa bindings/network-manager/obus-network-manager.a bindings/upower/obus-upower.cma bindings/upower/obus-upower.cmxs bindings/upower/obus-upower.cmxa bindings/upower/obus-upower.a bindings/udisks/obus-udisks.cma bindings/udisks/obus-udisks.cmxs bindings/udisks/obus-udisks.cmxa bindings/udisks/obus-udisks.a bindings/policykit/obus-policykit.cma bindings/policykit/obus-policykit.cmxs bindings/policykit/obus-policykit.cmxa bindings/policykit/obus-policykit.a tools/obus_gen_interface.native tools/obus_dump.native tools/obus_gen_client.native tools/obus_gen_server.native tools/obus_xml2idl.native tools/obus_idl2xml.native tools/obus_introspect.native examples/bus_functions.native examples/eject.native examples/hello.native examples/list_services.native examples/monitor.native examples/notify.native examples/ping.native examples/pong.native examples/signals.native examples/network_manager.native examples/battery_monitoring.native -tag debug' terminated with error code 10")
make: *** [build] Fehler 1
ocaml 3.12.1, oasis 0.3.0.
I came across this problem after invoking obus-introspect -system -rec org.bluez /org/bluez
and then obus-gen-client
. The generated code required some manual tweaking for two different reasons:
class
(reserved word in OCaml).UUID
(yep, uppercase).Nothing major. Nevertheless, it would be nice if the auto-generated code would be free from such issues.
So after a brief conversation it seems we are more or less agree on obus' future. Since it's a community project, and the goal is to provide a simple and robust interface to standard D-Bus IPC facilities, obus needs some simplifications.
In particular, it would be prudent to remove fancy yet unnecessary features, like IDL proxy language and PPX syntax extensions, and disentangle internal libraries and bindings.
Since these changes are quite invasive, they should go to 2.0 release. This issue is to track the progress.
.obus
files with D-Bus' native XML.obus
and bindings (obus-notifications
, obus-network-manager
etc) into separate libraries.mli
, making obus
odoc/odig friendlyIf a D-Bus server sends a signal message containing destination and file descriptor,
OBus closes the file descriptor in the message.
https://github.com/ocaml-community/obus/blob/master/src/protocol/oBus_connection.ml#L459
match apply_filters "incoming" message active.incoming_filters with
| None -> ...
| Some message ->
(* The internal dispatcher accepts only messages destined to
the current connection: *)
if active.name = "" || OBus_message.destination message = active.name then ignore (
(try%lwt
dispatch_message active message
with exn ->
Lwt_log.error ~section ~exn "message dispatching failed with")
[%lwt.finally
OBus_value.V.sequence_close (OBus_message.body message)]
);
If a signal message doesn't contain destination, " OBus_value.V.sequence_close" is not called.
But If a signal message contains destination, " OBus_value.V.sequence_close" is called, file descriptor is closed.
@talex5 Could you release 4.06 compatible version please?
Its trivial but a note in the README would be useful for newcomers (like me) trying to install obus for spotify-cli.
Recently tried to install obus 1.1.6 on the 4.03.0+flambda opam switch, and got the following error:
#=== ERROR while installing obus.1.1.6 ========================================#
# opam-version 1.2.2
# os linux
# command ocaml setup.ml -build
# path /home/guigui/.opam/4.03.0+flambda/build/obus.1.1.6
# compiler 4.03.0+flambda
# exit-code 1
# env-file /home/guigui/.opam/4.03.0+flambda/build/obus.1.1.6/obus-21851-d2c37b.env
# stdout-file /home/guigui/.opam/4.03.0+flambda/build/obus.1.1.6/obus-21851-d2c37b.out
# stderr-file /home/guigui/.opam/4.03.0+flambda/build/obus.1.1.6/obus-21851-d2c37b.err
### stdout ###
# [...]
# Error: Multiple definition of the extension constructor name Service_unknown.
# Names must be unique in a given structure or signature.
# Command exited with code 2.
# + /home/guigui/.opam/4.03.0+flambda/bin/ocamlopt.opt unix.cmxa -I /home/guigui/.opam/4.03.0+flambda/lib/ocamlbuild /home/guigui/.opam/4.03.0+flambda/lib/ocamlbuild/ocamlbuildlib.cmxa myocamlbuild.ml /home/guigui/.opam/4.03.0+flambda/lib/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
# File "myocamlbuild.ml", line 492, characters 43-62:
# Warning 3: deprecated: Ocamlbuild_plugin.String.uncapitalize
# Use String.uncapitalize_ascii instead.
# File "myocamlbuild.ml", line 505, characters 51-70:
# Warning 3: deprecated: Ocamlbuild_plugin.String.uncapitalize
# Use String.uncapitalize_ascii instead.
### stderr ###
# [...]
# W: Cannot find source file matching module 'UPower_interfaces' in library obus-upower
# W: Cannot find source file matching module 'Nm_interfaces' in library obus-network-manager
# W: Cannot find source file matching module 'Nm_interfaces' in library obus-network-manager
# W: Cannot find source file matching module 'Notification_interfaces' in library obus-notification
# W: Cannot find source file matching module 'Notification_interfaces' in library obus-notification
# W: Cannot find source file matching module 'Hal_interfaces' in library obus-hal
# W: Cannot find source file matching module 'Hal_interfaces' in library obus-hal
# W: Cannot find source file matching module 'OBus_interfaces' in library obus
# W: Cannot find source file matching module 'OBus_interfaces' in library obus
# E: Failure("Command ''/home/guigui/.opam/4.03.0+flambda/bin/ocamlbuild' src/obus.cma src/obus.cmxa src/obus.a src/obus.cmxs src/obus-idl.cma src/obus-idl.cmxa src/obus-idl.a src/obus-idl.cmxs syntax/obus-syntax.cma bindings/hal/obus-hal.cma bindings/hal/obus-hal.cmxa bindings/hal/obus-hal.a bindings/hal/obus-hal.cmxs bindings/notification/obus-notification.cma bindings/notification/obus-notification.cmxa bindings/notification/obus-notification.a bindings/notification/obus-notification.cmxs bindings/network-manager/obus-network-manager.cma bindings/network-manager/obus-network-manager.cmxa bindings/network-manager/obus-network-manager.a bindings/network-manager/obus-network-manager.cmxs bindings/upower/obus-upower.cma bindings/upower/obus-upower.cmxa bindings/upower/obus-upower.a bindings/upower/obus-upower.cmxs bindings/udisks/obus-udisks.cma bindings/udisks/obus-udisks.cmxa bindings/udisks/obus-udisks.a bindings/udisks/obus-udisks.cmxs bindings/policykit/obus-policykit.cma bindings/policykit/obus-policykit.cmxa bindings/policykit/obus-policykit.a bindings/policykit/obus-policykit.cmxs tools/obus_gen_interface.native tools/obus_dump.native tools/obus_gen_client.native tools/obus_gen_server.native tools/obus_xml2idl.native tools/obus_idl2xml.native tools/obus_introspect.native examples/bus_functions.native examples/eject.native examples/hello.native examples/list_services.native examples/monitor.native examples/notify.native examples/ping.native examples/pong.native examples/signals.native examples/network_manager.native examples/battery_monitoring.native -tag debug' terminated with error code 10")
Travis CI is no longer free. Maybe worthing switching to another platform? e.g.
I want to implement D-Bus service (daemon) using OBus but my manager demands code to be GPLv2+ licensed and OBus is MIT-licensed. Is it possible to write GPLed software using OBus?
P. S.: It would be nice if you point me to example of service implementation.
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.