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 686798 - g_volume_get_uuid() returns NULL while *_get_identifiers() knows about the UUID
g_volume_get_uuid() returns NULL while *_get_identifiers() knows about the UUID
Status: RESOLVED DUPLICATE of bug 772894
Product: gvfs
Classification: Core
Component: general
1.12.x
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2012-10-24 14:32 UTC by Mathias Hasselmann (IRC: tbf)
Modified: 2016-11-10 08:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (1.50 KB, patch)
2012-10-24 14:33 UTC, Mathias Hasselmann (IRC: tbf)
rejected Details | Review

Description Mathias Hasselmann (IRC: tbf) 2012-10-24 14:32:07 UTC
g_volume_get_uuid() returns NULL while *_get_identifiers() knows about the UUID. This bug also seems to affect g_mount_get_uuid() and g_volume_monitor_get_{mount,volume}_for_uuid().
Comment 1 Mathias Hasselmann (IRC: tbf) 2012-10-24 14:33:39 UTC
Created attachment 227153 [details] [review]
proposed patch

...still waiting for jhbuild to finish this.
Comment 2 Mathias Hasselmann (IRC: tbf) 2012-10-24 14:37:56 UTC
test code fragment:

    GVolumeMonitor *monitor = g_volume_monitor_get();

    for (GList *l = g_volume_monitor_get_mounts(monitor.get());
         l; l = l->next) {
        g_print("M:%s:%s:%s\n",
                g_print("M:%s:%s:%s\n",
                G_OBJECT_TYPE_NAME(l->data),
                g_file_get_path(g_mount_get_root(G_MOUNT(l->data))),
                g_mount_get_uuid(G_MOUNT(l->data)));
    }

    for (GList *l = g_volume_monitor_get_volumes(monitor.get());
         l; l = l->next) {
        g_print("V:%s:%s:%s:%s:%s\n",
                G_OBJECT_TYPE_NAME(l->data),
                g_volume_get_name(G_VOLUME(l->data)),
                g_volume_get_uuid(G_VOLUME(l->data)),
                g_volume_get_identifier(G_VOLUME(l->data),
                                        G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE),
                g_volume_get_identifier(G_VOLUME(l->data),
                                        G_VOLUME_IDENTIFIER_KIND_UUID));
    }
Comment 3 David Zeuthen (not reading bugmail) 2012-10-24 14:38:58 UTC
Comment on attachment 227153 [details] [review]
proposed patch

Careful, g_volume_get_uuid() and G_VOLUME_IDENTIFIER_KIND_UUID does *not* necessarily mean the same thing - I can't remember the distinction and don't have time to look up the archives right now. Anyway, if a backend returns something different for each of them, we should probably fix that backend.
Comment 4 Mathias Hasselmann (IRC: tbf) 2012-10-24 14:47:17 UTC
This also might affect g_file_find_enclosing_mount(): At least getting "g-io-error-quark(1): Containing mount does not exist" for regular files.
Comment 5 Mathias Hasselmann (IRC: tbf) 2012-10-24 14:49:22 UTC
(In reply to comment #3)
> (From update of attachment 227153 [details] [review])
> Careful, g_volume_get_uuid() and G_VOLUME_IDENTIFIER_KIND_UUID does *not*
> necessarily mean the same thing - I can't remember the distinction and don't
> have time to look up the archives right now. Anyway, if a backend returns
> something different for each of them, we should probably fix that backend.

Well. Even getting NULL. For local files.

Still considering how old the GVFS version on Ubuntu is (1.12.1) I (the Ubuntu fan) even wonder something went wrong while back porting.

My jhbuild fails for obscure reasons.
Comment 6 Martin Pitt 2013-01-09 16:38:02 UTC
I confirmed this for current gvfs trunk. With my USB stick I get:

$ test/run-in-tree.sh python3
>>> from gi.repository import Gio
>>> vm = Gio.VolumeMonitor.get()
>>> vm.get_volumes()
[<__main__.GProxyVolume object at 0x7ffc33d36aa0 (GProxyVolume at 0x1609090)>]
>>> vm.get_volumes()[0].get_name()
'PittiUSB'
>>> vm.get_volumes()[0].get_identifier('uuid')
'8F47-6A55'
>>> vm.get_volumes()[0].get_uuid()
>>>

I made a quick attempt of checking UUIDs in the testsuite, but it seems our current genisoimage fake CD-ROM doesn't have a UUID in the first place; so we need to extend our test cases to try other file systems.
Comment 7 Martin Pitt 2013-01-10 07:12:45 UTC
I updated the Drive tests to be able to use various kinds of images on the test devices; now this bug is very simple to test with adding this call to the end of the test_system_partition_api() check:

  self.assertEqual(self.volume.get_uuid(), self.volume.get_identifier('uuid'))

Right now, self.volume.get_uuid() is None.
Comment 8 Ondrej Holy 2016-11-10 08:45:49 UTC

*** This bug has been marked as a duplicate of bug 772894 ***