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 646637 - might be nice to have g_get_user_lib_dir()
might be nice to have g_get_user_lib_dir()
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks: 646631
 
 
Reported: 2011-04-03 17:10 UTC by William Jon McCann
Modified: 2018-05-24 13:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add a way to get per user lib dir (2.18 KB, patch)
2011-04-03 17:13 UTC, William Jon McCann
none Details | Review
Add a way to get per user lib dir (3.59 KB, patch)
2011-04-03 17:53 UTC, William Jon McCann
needs-work Details | Review

Description William Jon McCann 2011-04-03 17:10:14 UTC
It might be nice to have standard way to get a location to install per user libraries, loadable modules, and plugins.  Currently, it seems that every app is doing their own thing and often installing them into the home directory. Perhaps something like g_get_user_lib_dir().  It might also be nice to add this to the XDG Basedir spec so that this directory could be relocated or be conditionally set.

Wonder if it needs to account for architecture too.
Comment 1 William Jon McCann 2011-04-03 17:13:44 UTC
Created attachment 185052 [details] [review]
Add a way to get per user lib dir
Comment 2 William Jon McCann 2011-04-03 17:53:18 UTC
Created attachment 185055 [details] [review]
Add a way to get per user lib dir
Comment 3 Allison Karlitskaya (desrt) 2011-04-03 19:17:28 UTC
hi Jon

This discussion occurred somewhere else recently when someone suggested it (either on the list or another bug, I think).  There are a few problems with it.

One of the problems is that it is generally regarded as unwise to mmap things from the user's home directory.  I don't remember exactly why -- Lennart could tell you a lot more about that.

Another is that, in the case of a shared home directory between multiple architectures (think NFS) you have quite some trouble.  This one can be solved by having subdirectories of ~/.local/lib/ named by GNU triplets or Debian arch names or similar.

I admit the idea would theoretically be nice though.
Comment 4 William Jon McCann 2011-04-03 19:24:03 UTC
Well:
 * people are already installing modules and plugins in the home dir (without regard for architecture even)
 * Using a logical value would allow us to change to location to outside the home at some point if we wish.

Currently we have modules and plugins all over the home dir in different places.  ~/.gtk-3.0, ~/.gstreamer-0.10, ~/.mozilla/{plugins,extensions} etc. :(
Comment 5 Javier Jardón (IRC: jjardon) 2011-04-03 19:29:26 UTC
Review of attachment 185055 [details] [review]:

::: glib/gutils.c
@@ +2184,3 @@
+ * On UNIX platforms this is determined using the mechanisms described in
+ * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
+ * XDG Base Directory Specification</ulink>.

It would be good to document the behaviour of this functions on win32

@@ +2190,3 @@
+ * Since: 2.30
+ **/
+G_CONST_RETURN gchar*

Do not use G_CONST_RETURN, but const instead.
See https://bugzilla.gnome.org/show_bug.cgi?id=644611
Comment 6 Lennart Poettering 2011-04-03 20:33:22 UTC
mmap() support on NFS is something that's not guaranteed to work. However, read-only mmap() is much more likely to work properly than random access mmap() is. For plugins read-only access is generally sufficient. In any case I don't think that these compat problems really should stop us from introducing such a well-known directory, since there is simply no persistent user storage outside the home directory where we could place this, and I am pretty much convinced that we should *not* define a new non-$HOME place for it, just to make broken legacy OSes happy.

So yeah, I am all for this, but please include the GNU canonical host identifier in the name, to make $HOME shareable between multiple archs.

(Mhmm, maybe there should be a glib function to determine the GNU canonical host identifier?)
Comment 7 Lennart Poettering 2011-04-03 20:46:32 UTC
Oh, and the gtkdocs for the new function (and the spec too) should ask that people create a dir for their project beneath the lib dir, and that this dir should include the package version, to avoid API versioning problems.

e.g.:

~/.local/lib-linux-x86_64/gstreamer-0.11/

or something like that.
Comment 8 William Jon McCann 2011-04-03 20:50:53 UTC
I've been thinking the same thing for the other xdg dirs too.  Not only for the version problems.  I'm starting to wonder if we should really start namespacing everything with a fully qualified id (eg. org.freedesktop.Gstreamer). And require that apps use the same id that they use for dbus and desktop files.
Comment 9 Lennart Poettering 2011-04-03 20:56:21 UTC
Introducing org.freedesktop.GStreamer and suchlike would be quite a departure from how things have been traditionally done beneath /usr/lib and /usr/share, and as I understand it ~/.local tries to mimic those directories.
Comment 10 William Jon McCann 2011-04-04 04:27:56 UTC
Yeah the FQN is orthogonal to this anyway.
Comment 11 Lennart Poettering 2011-04-04 19:29:57 UTC
Something to think about: should this be a pair XDG_LIB_HOME + XDG_LIB_DIRS, like XDG_DATA_HOME + XDG_DATA_DIRS?
Comment 12 Allison Karlitskaya (desrt) 2011-04-07 02:51:38 UTC
It's worth thinking about the per-architecture questions even for the non-home version of this too.  On Debian (Ubuntu, at least) we are already starting to see /usr/lib/x86_64-linux-gnu/ for example...

Their primary use case there is cross-compiling (doesn't impact plugins) but it's quite easy to see it can help in the qemu CPU transparency case as well, which does impact plugins.

The whole lib-vs-share thing is becoming increasingly weird....
Comment 13 Allison Karlitskaya (desrt) 2011-04-07 03:09:09 UTC
Matthias has registered some rather strong objections to this proposal both on IRC and in email.  I record those here (summarising):

  * we have too many special dirs already, and adding new ones doesn't help

  * putting executable code in ~ is dangerous from a security standpoint

I don't disagree with his objections.  Overall, I'm sort of ambivalent about this proposal.
Comment 14 GNOME Infrastructure Team 2018-05-24 13:01:12 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/401.