gem install --user-install as root adds cached .gem file outside of HOME #71

jeremyevans opened this Issue Jun 8, 2011 · 1 comment

3 participants


I think the problem is at

Basically, in RemoteFetcher#download, it's checking whether the install_dir (Gem.dir by default) is writable, and if
so, it uses that dir. However, if the user is using the --user-install option, even if the user is root, it should
not be writing outside of HOME/.gem. Basically, if the --user-install option is given, it should always download to
HOME/.gem. This may require an API change.

This affects building OpenBSD ports for some gems, since the --user-install option is used (in combination with a fake
HOME). Usually, building is done as a regular user and is fine. However, if the builder is root, rubygems adds the
.gem files to the /usr/local/lib/ruby directory when the gem is installed to HOME/.gem. Then when the package builder
goes to install the package, the cached .gem file already exists and the package install fails.

This isn't a critical bug, as it can be trivially worked around by specifying GEM_HOME=$HOME/.gem in the environment
when using gem install --user-install (which the OpenBSD ports system now does).

RubyForge issue #28726:

@zenspider zenspider was assigned Jun 8, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment