After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 674785 - gio: Make g_dbus_get_machine_id() public
gio: Make g_dbus_get_machine_id() public
Status: RESOLVED INCOMPLETE
Product: glib
Classification: Platform
Component: gdbus
unspecified
Other All
: Normal normal
: ---
Assigned To: David Zeuthen (not reading bugmail)
gtkdev
Depends on:
Blocks: 674792
 
 
Reported: 2012-04-25 11:22 UTC by Bastien Nocera
Modified: 2012-04-25 18:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gio: Make g_dbus_get_machine_id() public (7.68 KB, patch)
2012-04-25 11:22 UTC, Bastien Nocera
none Details | Review
gio: Make g_dbus_get_machine_id() public (7.72 KB, patch)
2012-04-25 12:35 UTC, Bastien Nocera
reviewed Details | Review
gio: Make g_dbus_get_machine_id() public (7.73 KB, patch)
2012-04-25 12:37 UTC, Bastien Nocera
reviewed Details | Review

Description Bastien Nocera 2012-04-25 11:22:48 UTC
SSIA
Comment 1 Bastien Nocera 2012-04-25 11:22:50 UTC
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.
Comment 2 Alexander Larsson 2012-04-25 12:04:00 UTC
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.
Comment 3 Bastien Nocera 2012-04-25 12:35:25 UTC
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.
Comment 4 Bastien Nocera 2012-04-25 12:37:39 UTC
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.
Comment 5 Matthias Clasen 2012-04-25 12:39:44 UTC
Review of attachment 212771 [details] [review]:

Looks fine to me; but lets give David a chance to chime in.
Comment 6 Matthias Clasen 2012-04-25 12:49:12 UTC
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.
Comment 7 David Zeuthen (not reading bugmail) 2012-04-25 14:53:57 UTC
> + * 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...
Comment 8 Bastien Nocera 2012-04-25 18:52:19 UTC
Yeah, not sure I actually need all that, for my usage. Somebody will reopen when they have a use case for it.