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 617555 - match XDG freedesktop directories specification
match XDG freedesktop directories specification
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
2.29.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
: 598102 (view as bug list)
Depends on:
Blocks: 523057
 
 
Reported: 2010-05-03 18:21 UTC by Jean-François Fortin Tam
Modified: 2010-05-09 04:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[ShellGlobal] Change config_dir to use XDG_CONFIG_HOME (1.14 KB, patch)
2010-05-04 23:40 UTC, Florian Müllner
needs-work Details | Review
[ShellGlobal] Change location for user files to XDG_DATA_HOME (5.18 KB, patch)
2010-05-05 17:52 UTC, Florian Müllner
committed Details | Review
Fix userdata directory creation (1.42 KB, patch)
2010-05-06 07:36 UTC, Florian Müllner
committed Details | Review

Description Jean-François Fortin Tam 2010-05-03 18:21:01 UTC
GNOME Shell jhbuild still incorrectly saves some stuff in ~/.gnome2/shell, such as "~/.gnome2/shell/application_state".

It should use its XDG directory like the rest (on my computer, I see a ~/.config/gnome-shell/ directory).
Comment 1 Florian Müllner 2010-05-04 23:40:07 UTC
Created attachment 160305 [details] [review]
[ShellGlobal] Change config_dir to use XDG_CONFIG_HOME

While the extension system already uses that location, other
components use the deprecated $HOME/.gnome2 directory.
The existing data (app usage stats and looking glass history) is not
migrated to the new location.

Actually I'm a little uncertain whether XDG_CONFIG_HOME really is the correct location for the kind of data we store - possibly XDG_DATA_HOME would be more appropriate (especially for extensions).
Comment 2 Owen Taylor 2010-05-05 14:10:15 UTC
Review of attachment 160305 [details] [review]:

There's certainly some confusion between config_home and data_home - but these two usages do seem more like Empathy logs or the Tracker database than some of the things that are put in ~/.config.

(Obviously if we switch to using data_home, the variable and property shouldn't be 'configdir')
Comment 3 Florian Müllner 2010-05-05 17:52:21 UTC
Created attachment 160368 [details] [review]
[ShellGlobal] Change location for user files to XDG_DATA_HOME

While the extension system already uses an XDG location (XDG_CONFIG_HOME),
other components use the deprecated $HOME/.gnome2 directory.
The existing data (app usage stats and looking glass history) is not
migrated to the new location.

Not sure about the extensions - should those go to XDG_DATA_HOME as well?
Comment 4 Owen Taylor 2010-05-05 18:09:22 UTC
Review of attachment 160368 [details] [review]:

Looks good to me. On extensions, thinks there isn't a right answer, but:

<owen> walters: You have an opinion on fmuellner's question of ~/.config/gnome-shell/extensions vs. ~/.local/share/gnome-shell/extensions ?
<walters> i would prefer the latter
<walters> but not strongly so
<drago01> yeah extensions aren't really "configuration"
<owen> walters: if we move them there, then we have the advantage of not having stuff in both places
Comment 5 Florian Müllner 2010-05-05 18:33:48 UTC
Attachment 160368 [details] pushed as b1486f5 - [ShellGlobal] Change location for user files to XDG_DATA_HOME

The path for extensions has be updated to use XDG_DATA_HOME as well.
Comment 6 Christian Persch 2010-05-05 18:43:56 UTC
+  global->userdatadir = g_build_filename (g_get_user_data_dir (), "gnome-shell", NULL);
+  userdata_dir = g_file_new_for_path (global->userdatadir);
+  g_file_make_directory (userdata_dir, NULL, NULL);

This is doubly wrong. First, you need to use g_file_make_directory_with_parents() since you cannot guarantee the toplevel g_get_user_data_dir() dir already exists. Secondly, g_file_make_directory[_with_parents] creates the directories with permissions 0777, while the XDG standard mandates 0700 for the g_get_user_data_dir() part at least.
Comment 7 Florian Müllner 2010-05-06 07:36:56 UTC
Created attachment 160400 [details] [review]
Fix userdata directory creation

When creating the directory to store user data, XDG_DATA_HOME is
not guaranteed to exist. Also, the standard mandates permissions
of 0700 for the directory.
Comment 8 Owen Taylor 2010-05-06 11:23:56 UTC
Comment on attachment 160400 [details] [review]
Fix userdata directory creation

Looks good.

(I briefly wondered if we we should use 0700 for the parent and 0777 for the subdir but I can't think of any real advantage of that.)
Comment 9 Florian Müllner 2010-05-06 11:36:52 UTC
(In reply to comment #8)
> (I briefly wondered if we we should use 0700 for the parent and 0777 for the
> subdir but I can't think of any real advantage of that.)

Mmmh, if access to the parent directory is denied, permissions of subsequent directories don't matter anyway, right?

Attachment 160400 [details] pushed as b09b306 - Fix userdata directory creation
Comment 10 Owen Taylor 2010-05-06 12:13:34 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > (I briefly wondered if we we should use 0700 for the parent and 0777 for the
> > subdir but I can't think of any real advantage of that.)
> 
> Mmmh, if access to the parent directory is denied, permissions of subsequent
> directories don't matter anyway, right?

Yes. 

Sometimes in similar situations you want the restrictive permissions only on the toplevel so that the user can easily change the overall permissions by changing just the toplevel. But I can't see it matters here.
Comment 11 Florian Müllner 2010-05-09 04:41:42 UTC
*** Bug 598102 has been marked as a duplicate of this bug. ***