Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rbenv violates XDG basedir spec on linux #811

Closed
sandys opened this issue Oct 27, 2015 · 11 comments
Closed

rbenv violates XDG basedir spec on linux #811

sandys opened this issue Oct 27, 2015 · 11 comments
Labels

Comments

@sandys
Copy link

sandys commented Oct 27, 2015

according to http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

rbenv is one of the most popular tools on Linux - it would be awesome if you guys could comply with the spec.

@mislav mislav added the feature label Oct 27, 2015
@mislav
Copy link
Member

mislav commented Oct 27, 2015

How do you expect rbenv to comply with the XDG spec?

@jasonkarns
Copy link
Member

@sandys rbenv can be installed anywhere. Simply export RBENV_ROOT accordingly.

Though, personally, I don't think rbenv belongs under XDG_CONFIG_HOME. rbenv is an app, not a configuration file. I set RBENV_ROOT=/usr/local/var/rbenv

@mislav
Copy link
Member

mislav commented Nov 19, 2015

Agreed. Since ~/.rbenv folder is mostly not configuration files (with exception of ~/.rbenv/version global version file), I would say this doesn't fall under what XDG_CONFIG_HOME is supposed to be used. Closing until someone can argue otherwise.

@mislav mislav closed this as completed Nov 19, 2015
@lgarron
Copy link

lgarron commented Aug 29, 2018

Since ~/.rbenv folder is mostly not configuration files (with exception of ~/.rbenv/version global version file), I would say this doesn't fall under what XDG_CONFIG_HOME is supposed to be used.

It seems like they're mostly data files? $XDG_DATA_HOME exists for that.

@lgarron
Copy link

lgarron commented May 1, 2022

It still greatly disappoints me that the folder is hardcoded to ~/.rbenv. Most programs now respect the XDG convention (or allow an env var to override their own default), and rbenv is one of the few remaining exceptions.

My last comment still feels relevant — there is an XDG convention for where to store data files. I'd love to rbenv reconsider using that.

@jasonkarns
Copy link
Member

As mentioned earlier in this thread, the installation path is not hard coded. You can install it anywhere you like and set RBENV_ROOT accordingly.

@lgarron
Copy link

lgarron commented May 1, 2022

As mentioned earlier in this thread, the installation path is not hard coded. You can install it anywhere you like and set RBENV_ROOT accordingly.

Hmm, last time I tried this, it didn't do what it was supposed to. But I think this may have been due to interactions with projects I no longer have to run locally, so I'll give it another go. 🤞

@hsbt
Copy link
Member

hsbt commented May 2, 2022

RBENV_ROOT=$XDG_DATA_HOME/rbenv is completely working on my environment.

@mislav
Copy link
Member

mislav commented May 3, 2022

rbenv's default directory ~/.rbenv contains a mixture of configuration, cache, and data:

  • The global version setting ~/.rbenv/version is configuration, in my view;
  • ~/.rbenv/cache respected by ruby-build is a cache location;
  • ~/.rbenv/versions, ~/.rbenv/shims are data.

If we wanted to support XDG, we could default to rbenv-specific locations under XDG_CONFIG_HOME, XDG_DATA_HOME, and XDG_CACHE_HOME. From what I understand about XDG, this would be following its spec to the letter.

However, I don't feel strongly that rbenv should move in this direction, mostly because of backwards compatibility and UX concerns. I do not plan large functional changes to rbenv if I can avoid it, and this would be one such change. Second, as others already pointed out, anyone can already override where rbenv stores its files by setting RBENV_ROOT and RUBY_BUILD_CACHE_PATH.

TL;DR: yes, it rbenv wanted to be a good linux citizen, we would have respected XDG, but since we historically did not and have our own environment variables for changing location, it might make the most sense for the stability of the project to not try to shoehorn XDG compatibility in.

Thoughts?

@akiva
Copy link

akiva commented Jul 20, 2022

I would vote to see these changes implemented. It is not as simple as RBENV_ROOT=$XDG_DATA_HOME/rbenv since, as @mislav mentioned, the directory is a mix of things.

@xeruf
Copy link

xeruf commented Sep 8, 2022

Using the new XDG_STATE_HOME in the meantime, but would also appreciate proper support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants