GNOME Bugzilla – Bug 674785
gio: Make g_dbus_get_machine_id() public
Last modified: 2012-04-25 18:52:19 UTC
SSIA
Created attachment 212767 [details] [review] gio: Make g_dbus_get_machine_id() public So it can be used on systems with D-Bus to uniquely identify a machine.
Review of attachment 212767 [details] [review]: ::: gio/gdbusutils.c @@ +278,3 @@ + * <ulink url="http://dbus.freedesktop.org/doc/dbus-uuidgen.1.html">dbus-uuidgen</ulink> + * utility. A %NULL return value is to be expected on Unix systems + * with D-Bus setup. without setup you mean. I would rather say something like "This function may fail if dbus is not properly configured on the system" or something suchlike. @@ +280,3 @@ + * with D-Bus setup. + * + * Returns: (transfer full): a string representing the machine's machine-id Needs a since: tag too, and the new version macros thing.
Created attachment 212771 [details] [review] gio: Make g_dbus_get_machine_id() public So it can be used on systems with D-Bus to uniquely identify a machine.
Created attachment 212772 [details] [review] gio: Make g_dbus_get_machine_id() public So it can be used on systems with D-Bus to uniquely identify a machine.
Review of attachment 212771 [details] [review]: Looks fine to me; but lets give David a chance to chime in.
Review of attachment 212772 [details] [review]: ::: gio/gdbusutils.c @@ +277,3 @@ + * Returns the current machine's machine-id as generated by D-Bus' + * <ulink url="http://dbus.freedesktop.org/doc/dbus-uuidgen.1.html">dbus-uuidgen</ulink> + * utility. This function may fail on Unix systems if D-Bus is not properly I believe we capitalize it as UNIX in the docs.
> + * Returns the current machine's machine-id as generated by D-Bus' > + * <ulink url="http://dbus.freedesktop.org/doc/dbus-uuidgen.1.html">dbus-uuidgen</ulink> > + * utility. This function may fail on Unix systems if D-Bus is not properly > + * configured. First of all, I don't believe this comment is accurate - for example, on Win32 (some form of) the hwProfileGuid is returned. And on (modern) Linux it's /etc/machine-id which has nothing to do with D-Bus. Second, I'd rather we didn't expose this function.. why? Because the D-Bus machine-id is something that is specific to a) D-Bus the-protocol; and b) D-Bus the-message-bus-system 1.x... and is probably not something we want in some future 2.x series of these two things. This is mainly why this isn't a public function right now. For the record, I wouldn't mind having just const gchar *g_get_machine_id (void); Implementation-wise it would be exactly as in your patch although the docs would be closer to something like the first paragraph in this comment. Also, I wouldn't give any guarantees on its format except that it's UTF-8. I would also point out the obvious: that the id is supposed to be unique with respect to the OS instance the program is running on (should mention this is the case even on live cd's and other environments where the underlying filsystem is reused). An interesting question is what you would return on OS X... I mean, if you app is not using D-Bus (e.g. the bus daemon is not running) then current _g_dbus_get_machine_id() will return NULL...
Yeah, not sure I actually need all that, for my usage. Somebody will reopen when they have a use case for it.