Bug 70592 - dbus-send doesn't print unix file descriptor types
Summary: dbus-send doesn't print unix file descriptor types
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: All All
: medium normal
Assignee: Havoc Pennington
QA Contact:
URL:
Whiteboard: review?
Keywords: patch
Depends on:
Blocks:
 
Reported: 2013-10-18 00:50 UTC by Robert Ancell
Modified: 2013-12-04 01:16 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Support printing unix file descriptors in dbus-send/dbus-monitor (914 bytes, patch)
2013-10-18 00:50 UTC, Robert Ancell
Details | Splinter Review
Support printing unix file descriptors in dbus-send/dbus-monitor (901 bytes, patch)
2013-10-20 21:47 UTC, Robert Ancell
Details | Splinter Review

Description Robert Ancell 2013-10-18 00:50:28 UTC
Created attachment 87806 [details] [review]
Support printing unix file descriptors in dbus-send/dbus-monitor

dbus-send doesn't print unix file descriptor types, i.e.:

$ dbus-send --system --dest=org.freedesktop.login1 --print-reply /org/freedesktop/login1 org.freedesktop.login1.Manager.Inhibit string:'handle-power-key' string:'bob' string:'Blah blah' string:'block'
method return sender=:1.2 -> dest=:1.116 reply_serial=2
    (dbus-monitor too dumb to decipher arg type 'h')

type 'h' is a Unix file descriptor.
Comment 1 Simon McVittie 2013-10-18 08:28:31 UTC
Comment on attachment 87806 [details] [review]
Support printing unix file descriptors in dbus-send/dbus-monitor

Review of attachment 87806 [details] [review]:
-----------------------------------------------------------------

::: tools/dbus-print-message.c
@@ +349,5 @@
> +
> +	case DBUS_TYPE_UNIX_FD:
> +	  {
> +	    dbus_uint32_t val;
> +	    dbus_message_iter_get_basic (iter, &val);

I think the libdbus ABI is that it's an int, not a dbus_uint32_t, on platforms where that makes a difference (but please check the source code, I could be wrong).

(I know it's a uint32 in the wire protocol, but the uint32 doesn't numerically equal the fd anyway.)
Comment 2 Robert Ancell 2013-10-20 21:47:36 UTC
Created attachment 87900 [details] [review]
Support printing unix file descriptors in dbus-send/dbus-monitor

Thanks for catching that! Looking in dbus/dbus-message.c it does indeed special case unix file descriptors and actually do the conversion from the u32 index into a file descriptor (int).
Comment 3 Chengwei Yang 2013-11-18 06:08:28 UTC
Comment on attachment 87900 [details] [review]
Support printing unix file descriptors in dbus-send/dbus-monitor

Review of attachment 87900 [details] [review]:
-----------------------------------------------------------------

looks good.
Comment 4 Chengwei Yang 2013-12-04 01:16:01 UTC
patch applied, so mark it as fixed.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.