Skip to content

Conversation

@jhenstridge
Copy link
Contributor

I'm proposing this in response to some discussion on IRC. While writing snapd spread tests for some D-Bus related features, I found myself running into limitations on what I could do with the dbus-send utility. The gdbus utility could handle those cases as it can represent arbitrary types when making method calls, but is not included in any of our base snaps. That means using it would require the tests use snaps published to the store, which increases the maintenance burden and makes updates more difficult. @anonymouse64 also noted that he'd run into similar limitations when writing tests.

I believe the gdbus utility would also be generally useful in testing D-Bus related faults on Ubuntu Core systems, so it would make sense to include for similar reasons to the dbus-send utility.

This PR adds the whole libglib2.0-bin package. I don't expect it to make a large difference to the size of the snap since its dependencies are already included, but I'll check the result of CI. We could trim some of the other utilities from the package if you think that would be appropriate.

@anonymouse64
Copy link
Contributor

lgtm, thanks for this

@jhenstridge
Copy link
Contributor Author

The snap spat out by CI is 65536 bytes larger than the core20 snap currently on the edge channel. The new files are:

+squashfs-root/usr/bin/gapplication
+squashfs-root/usr/bin/gdbus
+squashfs-root/usr/bin/gio
+squashfs-root/usr/bin/gio-querymodules
+squashfs-root/usr/bin/glib-compile-schemas
+squashfs-root/usr/bin/gresource
+squashfs-root/usr/bin/gsettings
+squashfs-root/usr/share/bash-completion/completions/gapplication
+squashfs-root/usr/share/bash-completion/completions/gdbus
+squashfs-root/usr/share/bash-completion/completions/gio
+squashfs-root/usr/share/bash-completion/completions/gresource
+squashfs-root/usr/share/bash-completion/completions/gsettings
+squashfs-root/usr/share/doc/libglib2.0-bin
+squashfs-root/usr/share/doc/libglib2.0-bin/changelog.Debian.gz
+squashfs-root/usr/share/doc/libglib2.0-bin/copyright
+squashfs-root/usr/share/doc/libglib2.0-data
+squashfs-root/usr/share/doc/libglib2.0-data/changelog.Debian.gz
+squashfs-root/usr/share/doc/libglib2.0-data/copyright
+squashfs-root/usr/share/lintian/overrides/libglib2.0-bin

The gio-querymodules and glib-compile-schemas tools looked like they wouldn't be particularly useful, but it seems we're just adding symlinks to the tools already shipped in $SNAP/lib/x86_64-linux-gnu/glib-2.0.

@jhenstridge jhenstridge marked this pull request as ready for review May 19, 2021 07:14
@xnox
Copy link
Contributor

xnox commented May 19, 2021

busctl would be smaller than both dbus-send & gdbus utility and is already available in core20.

Is busctl from systemd not sufficient for you?

@xnox xnox added the question Further information is requested label May 19, 2021
@jhenstridge
Copy link
Contributor Author

I hadn't played much with busctl, but it looks like it should fit the bill. In my case, I had a D-Bus method call with an (sa{sv}) argument (i.e. variant embedded in dict embedded in struct), and it looks like its syntax is expressive enough to marshal an argument like that:

'(sa{sv})' unix-process 3 pid u "$pid" start-time t "$pid_start" uid u "$uid"

I think that covers pretty much everything I would have wanted to use gdbus for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants