Srijan Choudhary

Hi, I'm Srijan Choudhary.

I'm a founding member and software engineering leader at GreyOrange, working on disrupting and redefining fulfillment.

I'm interested in software team leadership, functional programming, distributed systems, artificial intelligence, and software infrastructure.

In my free time, I enjoy traveling, running, playing with technology, listening to music, creating music, and reading.

I write here when I have something to share - a personal project, some difficult problem I solved recently, or just an idea.

Take a look at the about page for more details, or follow me on mastodon.

Recent Articles

Recent Notes

Srijan Choudhary Srijan Choudhary
> Reply to Issues ยท jeanparpaillon/erlang-dbus ยท GitHub

Error when introspection results have a root node element without name attribute

The name attribute is optional for the root node element in introspection results.

From https://dbus.freedesktop.org/doc/dbus-specification.html#introspection-format :

Only the root <node> element can omit the node name, as it's known to be the object that was introspected. If the root <node> does have a name attribute, it must be an absolute object path. If child <node> have object paths, they must be relative.

When writing a test case for another issue, I found that dbus services written using C++ QT Dbus library can cause this issue.

I will raise a pull request to fix both of these issues including test cases.

Srijan Choudhary Srijan Choudhary
> Reply to Issues ยท jeanparpaillon/erlang-dbus ยท GitHub

Crash when introspecting remote service object with overloaded methods

From what I understand, the dbus spec does not explicitly allow or disallow overloading methods. But, there are instances of overloaded methods in different applications (specially KDE based), and erlang-dbus does not handle it gracefully - it crashes.

Example

org.kde.plasmashell's /org/kde/osdService path exposes two methods with the same name but different number of arguments.

Output from qdbus

$ qdbus org.kde.plasmashell /org/kde/osdService
...
method void org.kde.osdService.volumeChanged(int percent)
method void org.kde.osdService.volumeChanged(int percent, int maximumPercent)
...

erlang-dbus

> {ok, Bus} = dbus_bus_reg:get_bus(session).
{ok,<0.110.0>}
> {ok, Service} = dbus_bus:get_service(Bus, 'org.kde.plasmashell').                   
{ok,<0.112.0>}
> {ok, RemoteObject} = dbus_remote_service:get_object(Service, '/org/kde/osdService').
=ERROR REPORT==== 10-Apr-2025::06:22:35.537460 ===
Error parsing introspection infos: {case_clause,
                                    {fatal_error,
                                     {key_exists,<<"volumeChanged">>}}}

=ERROR REPORT==== 10-Apr-2025::06:22:35.537539 ===
Error introspecting object '/org/kde/osdService': parse_error

erlang-dbus crashes on this because it tries to insert an element into a gb_trees structure with a key that already exists.

I checked the behavior in pydbus, and it looks like it does not handle this fully either. It only shows the last method in the list (in this case, the one with two arguments). But, it does not crash.

This can be fixed by replacing gb_trees:insert/3 with gb_trees:enter/3 - which makes it match the behavior of pydbus.

While trying to write a test case for this issue by writing an example service using QT dbus library (which allows overloading methods), I found another issue in handling root node element without a name attribute in introspection results.

I will raise a pull request to fix both of these issues including test cases.

Srijan Choudhary Srijan Choudhary
> Reply to mms :runbsd: + :emacs:: "@ross@rossabaker.com Yes. I use elfeed-protocol wโ€ฆ" - BSD.cafe Mastodon Portal

I use this too, but elfeed-protocol does not have two-way sync built in (see FAQ#4 on https://github.com/fasheng/elfeed-protocol#qa).

However, there are workarounds, and I use this: https://github.com/fasheng/elfeed-protocol/issues/71#issuecomment-2483697511 - I call this function manually when I know I've read some things on my phone and want to re-sync read status.