GNOME Bugzilla – Bug 686798
g_volume_get_uuid() returns NULL while *_get_identifiers() knows about the UUID
Last modified: 2016-11-10 08:45:49 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().
Created attachment 227153 [details] [review] proposed patch ...still waiting for jhbuild to finish this.
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 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.
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.
(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.
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.
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.
*** This bug has been marked as a duplicate of bug 772894 ***