Bug 200809 - Eclipse does not follow the XDG Base Directory Specification
Summary: Eclipse does not follow the XDG Base Directory Specification
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.2   Edit
Hardware: All Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: platform-runtime-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
: 453878 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-08-22 08:16 EDT by Mariot Chauvin CLA
Modified: 2020-01-25 03:32 EST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mariot Chauvin CLA 2007-08-22 08:16:08 EDT
Build ID: M20070212-1330 (Fedora Core release 6 (Zod))

Steps To Reproduce:

Eclipse seems to store information on ~/.eclipse whithout to care about $XDG* environment variables

More information:
See http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html
Comment 1 Alex Blewitt CLA 2007-08-22 10:35:52 EDT
You might want to change it against 3.3 (or even 3.4), since no further work is likely to be done on 3.2.

In any case, it's customisable. The property is taken from the entry in config.ini, which usually points to @user.data/workspace, but in your case sounds like it might be @user.data/.eclipse. The @ refers to a Java system property; I don't know if environment variables such as the one you quote might be there or not. It would be simple to launch Eclipse with "eclipse -data $XDB_BASE/.eclipse" if you wanted.

This might well be a packaging issue for your distro, rather than Eclipse per se. 
Comment 2 John Arthorne CLA 2007-09-10 21:56:56 EDT
As Alex says, the directories where Eclipse writes data can be configured via command line arguments and/or system properties. Eclipse isn't going to build in special awareness of $XDG environment variables.
Comment 3 Eric Heintzmann CLA 2012-12-05 16:00:31 EST
What is planned now about FreeDesktop XDG basedir specification for Eclipse?


http://ploum.net/post/207-modify-your-application-to-use-xdg-folders
https://live.gnome.org/GnomeGoals/XDGConfigFolders
http://standards.freedesktop.org/basedir-spec/latest/
Comment 4 Pascal Rapicault CLA 2012-12-05 20:49:36 EST
From the point of view of the committers involved, the plans have not evolved since the bug has been closed as wontfix.
For my own education which linux distro implement this spec?

Now by curiosity I glanced through the requirements (http://standards.freedesktop.org/basedir-spec/latest/ar01s02.html) to see what it required. My overall feeling is that from a pure runtime point of view, some things could be supported, however this would not make all the plugins work. This is because there are concepts that do not explicitely exist in eclipse as API and as such various plugins rolled out their own implementation (e.g. runtime caches). Here is a quick review of the reqs:

> There is a single base directory relative to which user-specific data files should be written. This directory is defined by the environment variable $XDG_DATA_HOME. 
  For eclipse I'm not sure what this folder would be. I would assume that this is the "workspace" in which case having just one does not make sense. For example when I work on two different projects, I need two different workspaces. 
  The other thing that comes in mind are the preferences stored in the configuration folder.

> There is a single base directory relative to which user-specific configuration files should be written. This directory is defined by the environment variable $XDG_CONFIG_HOME. 
  This is supported by the -configuration option and which would immediately change the config scope in eclipse prefs.

> There is a set of preference ordered base directories relative to which data files should be searched. This set of directories is defined by the environment variable $XDG_DATA_DIRS. 
  Eclipse preference mechanism has the concept of scope, I suppose that additional scopes could be created and added to the default lookup order. However many plugins just look in one scope so they would not be affected.

> There is a set of preference ordered base directories relative to which configuration files should be searched. This set of directories is defined by the environment variable $XDG_CONFIG_DIRS. 
  Not sure how this would go with as Eclipse way of doing things that consists in loading configuration information on startup from two places and merge values. The only potential way would be to limit the config dirs to 2 and have the first one refer to -configuration and the other to the base configuration. 
  Also if there is expectation around a merge or precedence this may not work.

> There is a single base directory relative to which user-specific non-essential (cached) data should be written. This directory is defined by the environment variable $XDG_CACHE_HOME.
  There is no such concept. Currently application level caches are stored in sub folders of the configuration location. This is the responsibility of each plugin. A new concept would need to be added to Eclipse and adopted.
  

> There is a single base directory relative to which user-specific runtime files and other file objects should be placed. This directory is defined by the environment variable $XDG_RUNTIME_DIR.
  This would apply to p2 for the dropins folder and for the location where bundles get downloaded when running in a shared install.
Comment 5 Eric Heintzmann CLA 2012-12-07 14:37:34 EST
>For my own education which linux distro implement this spec?

This spec is implemented by a lot of upstream applications including GNOME/GTK, KDE, XFCE, LXDE .... Thus nearly all distributions implement this spec.

>> There is a single base directory relative to which user-specific configuration
>>files should be written. This directory is defined by the environment variable 
>>$XDG_CONFIG_HOME. 
>  This is supported by the -configuration option and which would immediately 
>change the config scope in eclipse prefs.

-configuration option should default to $XDG_CONFIG_HOME/eclipse

>> There is a single base directory relative to which user-specific non-essential 
>>(cached) data should be written. This directory is defined by the environment 
>>variable $XDG_CACHE_HOME.
>  There is no such concept. Currently application level caches are stored in sub 
>folders of the configuration location. This is the responsibility of each 
>plugin. A new concept would need to be added to Eclipse and adopted.

A sigle cache dir is very important, because it can be easily excluded from backup
Comment 6 Pascal Rapicault CLA 2012-12-07 19:12:54 EST
Thanks for the details. Given that the compliance would not be a matter of just settings a few flags (because concepts are missing). At this point I think that nothing will happen on this front unless a contribution is a done.
Comment 7 Eric Heintzmann CLA 2012-12-10 07:21:23 EST
If you are waiting for a contrib, I suggest to reopen this bug.
Comment 8 Pascal Rapicault CLA 2012-12-10 10:08:03 EST
Re-opening and flagging helpwanted
Comment 9 Mikhail Kalkov CLA 2013-07-03 12:29:06 EDT
Ok, so it seems a thorough compliance would be difficult to achieve, but some parts are relatively easy.

To start with, it should be simple
 - to make osgi.instance.area default to $XDG_DATA_HOME/eclipse/workspace_appId instead of @osgi.install.area/workspace
 - to make osgi.configuration.area default to $XDG_CONFIG_HOME/eclipse/appId_appVersion_installDirHash instead of $HOME/.eclipse/appId_appVersion_installDirHash (see bug 329587)
 - to make osgi.user.area default to $XDG_CONFIG_HOME/eclipse/common instead of $HOME/user

Supporting $XDG_DATA_DIRS and $XDG_CONFIG_DIRS sounds feasible but would require more work, and introducing support for $XDG_CACHE_HOME and $XDG_RUNTIME_DIR sounds like a lot more work.

Finally, I guess osgi.install.area also has to be split into $XDG_DATA_HOME and $XDG_CONFIG_HOME parts but that looks like yet one more separate work item that would have to take into account shared installations.

I am writing this down to increase the chances that "simple" fixes make it into the code, and adding myself to cc in case I eventually get time to do them.
Comment 10 Jon McCann CLA 2013-07-03 14:48:50 EDT
Would it make things easier from the Eclipse perspective if the XDG spec was modified to have one configuration and data directory instead of separate XDG_DATA_HOME and XDG_CONFIG_HOME? (cache would remain unchanged)
Comment 11 Mikhail Kalkov CLA 2013-07-04 09:10:53 EDT
Disclaimer: I'm not an Eclipse committer but have experience of Eclipse plug-in development and use it regularly.

Equinox platform, on top of which Eclipse is built, requires one to specify the following areas (see [1]):
 - instance, which is roughly equivalent to XDG_DATA_HOME + XDG_CACHE_HOME + XDG_RUNTIME_DIR, and which has to stay the same during application runtime but may change between startups. 
 - configuration, which is equivalent to XDG_CONFIG_HOME and should be unique for each eclipse installation.
 - user, which is also equivalent to XDG_CONFIG_HOME and should be shared between different eclipse installations.
So, I don't think merging XDG_DATA_HOME and XDG_CONFIG_HOME would help in any way, and I don't think it would create problems either.

On a side note, there is also support for several hierarchical configuration areas, but I don't know if and how it can be integrated with XDG_CONFIG_DIRS. On the other hand, instance areas cannot be hierarchical as of now, and I am not sure there is need to support XDG_DATA_DIRS.

[1] http://help.eclipse.org/kepler/topic/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html#locations
Comment 12 Szymon Ptaszkiewicz CLA 2014-12-05 04:47:45 EST
*** Bug 453878 has been marked as a duplicate of this bug. ***
Comment 13 Alexander Kurtakov CLA 2020-01-25 03:32:09 EST
No plans to work on that.