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 691618 - avoid initialising gvfs for local files
avoid initialising gvfs for local files
Status: RESOLVED DUPLICATE of bug 665092
Product: glib
Classification: Platform
Component: gio
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-01-12 17:38 UTC by Allison Karlitskaya (desrt)
Modified: 2018-02-09 12:33 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Allison Karlitskaya (desrt) 2013-01-12 17:38:46 UTC
g_file_new_for_path() is (reasonably) implemented as:

  return g_vfs_get_file_for_path (g_vfs_get_default (), path);

which is just a vcall:

  return (* class->get_file_for_path) (vfs, path);

In gvfs this is:

  file = g_vfs_get_file_for_path (G_DAEMON_VFS (vfs)->wrapped_vfs, path);
  file = convert_fuse_path (vfs, file);
  return file;


with

  vfs->wrapped_vfs = g_vfs_get_local ();



In short: we spin up the entire GIOModule/GIOExtensionPoint framework, load a lot of modules, initialise gvfs and call into it just for the purpose of calling back into the 'local' VFS module in GIO.

The only case where gvfs does anything at all is if we are giving it a path inside of the fuse root.  In that case, it appears to be attempting to convert it back to a native GIO URI.

I propose modifying g_file_new_for_path() to short-circuit this insanity and go straight to the local vfs implementation.  We can deal with the FUSE case by avoiding the short-circuit for anything that looks like it might be a FUSE path (which we could just determine using the same algorithm gvfs does).

We could also possibly modify the for_uri case as well, for file:/// URIs.

I suppose it's also possible that we could have a non-gvfs gvfs implementation that does something stranger with local paths...
Comment 2 Allison Karlitskaya (desrt) 2013-01-13 00:29:04 UTC
Ouch.  The problem is bigger than I thought -- even with my workaround to create a GFile directly using the local vfs I could still end up loading gvfs depending on how I use it?  Ugh...

In light of that, I'm not sure what I'm proposing here is much help.

If the issue in the other bug is really hinging on the back-mapping of FUSE-backed filenames to native URIs (as this bug is as wel) then maybe we should just consider moving the functionality to *detect* these URIs to GLib and only call into gvfs code in the case that one of them pops up...
Comment 3 Matthias Clasen 2013-01-14 01:36:03 UTC
Can we stop for a moment and clarify why avoiding gvfs is a good thing ? 
I understand that we want to avoid it in system daemons and commands run as root, but in a full desktop session, there is nothing wrong with using gvfs, imo.
Comment 4 Allison Karlitskaya (desrt) 2013-01-14 03:37:26 UTC
I was just a bit surprised to see dconf-service indirectly loading the dconf client library into itself as a side effect...
Comment 5 Matthias Clasen 2013-01-15 11:15:25 UTC
yeah, I agree. that is bad
Comment 6 Philip Withnall 2018-02-09 12:33:35 UTC
I think we can consider this a duplicate of bug #665092.

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