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 613644 - gnome-keyring should match FreeDesktop directories specs (actually it hard codes .gnome2)
gnome-keyring should match FreeDesktop directories specs (actually it hard co...
Status: RESOLVED FIXED
Product: gnome-keyring
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
Depends on: 672155
Blocks: 523057
 
 
Reported: 2010-03-22 21:48 UTC by Ray Strode [halfline]
Modified: 2014-04-22 15:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
look at environment variable (2.36 KB, patch)
2010-03-22 21:48 UTC, Ray Strode [halfline]
none Details | Review
Use the XDG directories for storing keys (5.50 KB, patch)
2012-08-11 06:10 UTC, Stef Walter
none Details | Review
Use the XDG directories for storing keys (5.57 KB, patch)
2012-08-13 08:17 UTC, Stef Walter
none Details | Review
Use the XDG directories for storing keys (6.66 KB, patch)
2012-08-16 04:19 UTC, Stef Walter
committed Details | Review

Description Ray Strode [halfline] 2010-03-22 21:48:03 UTC
Created attachment 156814 [details] [review]
look at environment variable

libgnome suppports and environment variable for relocating .gnome2.  gnome-keyring currently hard codes .gnome2.

Red Hat has a customer that would like to use the environment variable.
Comment 1 Javier Jardón (IRC: jjardon) 2010-03-24 18:54:52 UTC
I think is better to use the freedesktop directory specification.

See http://live.gnome.org/GnomeGoals/XDGConfigFolders
Comment 2 Stef Walter 2010-04-28 15:23:21 UTC
Thanks for this patch. Sorry for not looking at it earlier. This patch is against an old version of gnome-keyring, and is no longer relevant. Could you prepare a new patch?

In the future we'd certainly like to use the XDG folders. This will probably done at a point in time when we update the keyring format, and break forwards compatibility in one of the releases.
Comment 3 Sebastian 2011-06-01 17:58:20 UTC
Hi, from what i can see in the source this bug seems to be fixed.

Can someone confirm and close this bug?
Comment 4 Stef Walter 2011-06-01 18:03:51 UTC
There's a new backend module that stores stuff in XDG directories, but it isn't yet complete, and the old one is still in use.
Comment 5 Sebastian 2011-06-01 18:13:53 UTC
Looks like I missed that. It looks like there is still mention of .gnome2 in:
Comment 6 Sebastian 2011-06-01 18:16:30 UTC
pkcs11/secret-store/gkm-secret-module.c
pkcs11/gnome2-store/gkm-gnome2-module.c
and daemon/dbus/gkd-secret-service.c

Wouldn't it be possible to just replace the calls to g_get_home_dir() with some calls to g_get_user_data_dir() at these three locations? Or do you plan to use the new backend module you mentioned?
Comment 7 Stef Walter 2011-06-01 18:18:12 UTC
Planning on using a new backend module. In addition some of teh old file formats are old and crufty and hard to support new features on. So as part of the migration to the new directory, the new file formats need to be completed.
Comment 8 Javier Jardón (IRC: jjardon) 2012-02-23 15:15:06 UTC
Hello Stef, what is the status of this? Could you link here the blocker bugs to fix this one?
Comment 9 Sebastian 2012-03-16 17:24:40 UTC
Any chance this gets fixed for 3.4?
Comment 10 Stef Walter 2012-03-16 21:08:15 UTC
Is this an emergency or problem for users? If so we could rush in a fix for the keyring files.

But I'm hesitant to do this without knowing what the new keyring file format and migration plan is going to look like: bug #672155
Comment 11 Sebastian 2012-03-17 13:30:36 UTC
I didnt know about #672155. I agree it should be fixed first. So no need to rush this.  It would just be nice to get rid of the remaining items in .gnome2 so users get a more cleaned up and consistent home folder.
Comment 12 Simon Schampijer 2012-06-11 17:08:44 UTC
Hey Stef, it would be sooo great to fix this :) We want to run Sugar under GNOME in a jhbuild session and for that it would be great to specify an alternative path for the keyring so we don't conflict with the GNOME one. Using the XDg folders would be just great.
Comment 13 Stef Walter 2012-08-11 06:10:07 UTC
Created attachment 220918 [details] [review]
Use the XDG directories for storing keys

Here's a patch which uses g_get_user_data_dir(). If the old 
~/.gnome2/keyrings directories exist on the system, then they are
used exclusively. So new accounts will use the XDG dir.

Are we sure that g_get_user_data_dir() is the right one? It uses
$XDG_DATA_HOME, which according to the spec (and glib documentation)
looks like the location for application data (ie: icons, interface 
etc.) not necessarily user data/databases. However given the state
of ~/.local/share on my system, it seems to have been coopted for
the latter.
Comment 14 Stef Walter 2012-08-13 08:17:03 UTC
Created attachment 220972 [details] [review]
Use the XDG directories for storing keys

 * If the old .gnome2/keyrings exists, then continue to use that
 * Otherwise create the new directory in g_get_user_data_dir() as
   appropriate.
Comment 15 Stef Walter 2012-08-16 04:19:32 UTC
Created attachment 221338 [details] [review]
Use the XDG directories for storing keys

Need to fine tune the logic here, because there can be cases where
the old ~/.gnome2/keyrings directory can be created unconditionally
(ie: by old versions of gnome-keyring sharing a home directory)
in an account that otherwise uses the new XDG based location.

So:

 * If the new XDG directory doesn't exist, and the old
   ~/.gnome2/keyrings does exist, then continue to use that
 * Otherwise create the new directory in g_get_user_data_dir() as
   appropriate.
Comment 16 Stef Walter 2012-08-17 08:33:12 UTC
Well, nobody has stepped up to review or test this yet. But I've been
testing it, and after fixing the logic, it seems to work well.

Normally I would wait until the people requesting the feature take the
time to test it and make sure it works. But in this case maybe we can
get more testing by merging it in and including it in the next unstable
release.

Attachment 221338 [details] pushed as 747b37b - Use the XDG directories for storing keys
Comment 17 Carl George 2014-04-21 20:53:45 UTC
This is not properly fixed as of version 3.12.0.  The XDG Base Directory specification states that user data should be located in XDG_DATA_HOME, with a default value of ~/.local/share.  On my Arch Linux system, I have set that environment variable, but gnome-keyring is still using the default location.

$ grep XDG_DATA_HOME= /etc/profile.d/custom.sh 
export XDG_DATA_HOME="${HOME}/.xdg/data"
$ echo ${XDG_DATA_HOME}
/home/carl/.xdg/data
$ ls ~/.xdg/data/keyrings
ls: cannot access /home/carl/.xdg/data/keyrings: No such file or directory
$ ls ~/.local/share/keyrings
login.keyring  user.keystore

Please re-open this bug.
Comment 18 Stef Walter 2014-04-21 21:13:48 UTC
You may want to check the environment of gnome-keyring-daemon to see if it has XDG_DATA_HOME set. See /proc/xxx/environ.
Comment 19 Ray Strode [halfline] 2014-04-21 21:46:42 UTC
gnome-keyring is started way early in the login process, before your script will be run. I'd recommend putting

XDG_DATA_HOME=${HOME}/.xdg/data

in /etc/environment instead (or don't override it at all and stick with the defaults unless you have a really good reason to change it)
Comment 20 Carl George 2014-04-22 15:29:58 UTC
As suspected, /proc/xxx/environ for the keyring daemon's pid did not reflect my variable.  I tried moving it to /etc/environment, but that pam files does not support variable expansion, so the variable does not expand ${HOME}.  I was finally able to correct this by moving my XDG variables from /etc/profile.d/custom.sh to ~/.pam_environment, with hard-coded paths.

$ cat .pam_environment
XDG_CONFIG_HOME=/home/carl/.xdg/config
XDG_CACHE_HOME=/home/carl/.xdg/cache
XDG_DATA_HOME=/home/carl/.xdg/data

Gnome-keyring is now placing data at /home/carl/.xdg/data/keyrings as desired.  Thanks for tips Stef and Ray!