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 768410 - Does not display font preview when launched from xdg-open
Does not display font preview when launched from xdg-open
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2016-07-04 19:14 UTC by Sam Morris
Modified: 2016-07-13 06:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
empty window (4.79 KB, image/png)
2016-07-04 19:14 UTC, Sam Morris
  Details
gvfs-open: also replace dashes when computing object path (1.07 KB, patch)
2016-07-07 21:25 UTC, Cosimo Cecchi
none Details | Review
gvfs-open: also replace dashes when computing object path (1.25 KB, patch)
2016-07-11 14:44 UTC, Cosimo Cecchi
committed Details | Review

Description Sam Morris 2016-07-04 19:14:55 UTC
Created attachment 330864 [details]
empty window

If I run `xdg-open some-font.ttf` then the font is not displayed in the gnome-font-viewer window, and the following message is printed to the console:

(gvfs-open:32339): GLib-GIO-CRITICAL **: g_dbus_connection_call_sync_internal: assertion 'object_path != NULL && g_variant_is_object_path (object_path)' failed
Comment 1 Cosimo Cecchi 2016-07-07 21:25:33 UTC
-> gvfs

This is an issue in the patch that was committed to gvfs for bug 746534. The logic in gvfs-open replaces dots (invalid in a DBus object path) with slashes, but differently from what GApplication also does, it fails to replace dashes (another invalid character in a DBus object path) with underscores.
Comment 2 Cosimo Cecchi 2016-07-07 21:25:49 UTC
Created attachment 331032 [details] [review]
gvfs-open: also replace dashes when computing object path

This is what GApplication does, and we should do it here too, or
gvfs-open won't work for DBus-activatable applications with dashses in
their app IDs.
Comment 3 Matthias Clasen 2016-07-08 14:24:00 UTC
Review of attachment 331032 [details] [review]:

grr, the hack spreads :-(
Comment 4 Cosimo Cecchi 2016-07-08 14:57:51 UTC
Yeah, not happy about this either, but the current logic is broken. Should I push this to master?
Comment 5 Matthias Clasen 2016-07-08 18:39:40 UTC
not a gvfs maintainer, but imo: yes
Comment 6 Ondrej Holy 2016-07-11 09:27:23 UTC
Review of attachment 331032 [details] [review]:

Thanks, looks good!

::: programs/gvfs-open.c
@@ +95,3 @@
+      else if (*p == '-')
+        *p = '_';
+    }

Maybe it would be good to add something like:
if (!g_variant_is_object_path (object_path))
  {
    g_warning ("Invalid object path \"%s\"", object_path);
    g_free (object_path);
    goto out;
  }
Comment 7 Cosimo Cecchi 2016-07-11 14:44:28 UTC
Created attachment 331229 [details] [review]
gvfs-open: also replace dashes when computing object path

--

Good idea -- here's an updated patch.
Comment 8 Ondrej Holy 2016-07-12 06:28:56 UTC
Review of attachment 331229 [details] [review]:

Thanks! Please push it for stable branches also...
Comment 9 Cosimo Cecchi 2016-07-12 16:42:03 UTC
Attachment 331229 [details] pushed as ad689cc - gvfs-open: also replace dashes when computing object path
Comment 10 Ondrej Holy 2016-07-13 06:58:24 UTC
Cherry-picked into stable branches: gnome-3-20 as b7e9b31, gnome-3-18 as eb7986b and gnome-3-16 as 48877cb.