output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gem install --no-user-install unicorn | |
{:gem_home=>#<Pathname:/usr/lib/ruby/gems/1.9.1>, "Gem.dir"=>"/usr/lib/ruby/gems/1.9.1", "options[:user_install]"=>nil} | |
WARNING: Installing to ~/.gem since /usr/lib/ruby/gems/1.9.1 and | |
/usr/bin aren't both writable. | |
I am Rubygems. I do not care if you passed --no-user-install or it's in your ~/.gemrc; | |
the option isn't set. It's nil. I am a piece of software that has | |
hated you since time immemorial. t('-'t) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -Naur rubygems-orig/installer.rb rubygems/installer.rb | |
--- rubygems-orig/installer.rb 2010-07-20 15:28:56.000000000 -0700 | |
+++ rubygems/installer.rb 2010-07-20 15:53:49.000000000 -0700 | |
@@ -122,6 +122,8 @@ | |
# We'll divert to ~/.gem below | |
end | |
+ $stderr.puts({:gem_home => @gem_home, 'Gem.dir' => Gem.dir, | |
+ 'options[:user_install]' => options[:user_install]}.inspect) | |
if not File.writable? @gem_home or | |
# TODO: Shouldn't have to test for existence of bindir; tests need it. | |
(@gem_home.to_s == Gem.dir and File.exist? Gem.bindir and | |
@@ -134,7 +136,13 @@ | |
self.class.home_install_warning = true | |
end | |
end | |
- options[:user_install] = true | |
+ if !options[:user_install] | |
+ $stderr.puts "I am Rubygems. I do not care if you passed " \ | |
+ "--no-user-install or it's in your ~/.gemrc; ", | |
+ "the option isn't set. It's nil. I am a piece of software that has ", | |
+ "hated you since time immemorial. t('-'t)" | |
+ abort | |
+ end | |
end | |
if options[:user_install] and not options[:unpack] then | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have never gotten --no-user-install to do anything, and have just now | |
determined that there is some bug in the option parsing, but the code is kind of | |
a tangled mess. This is, as far as I know, the only way to stop it installing | |
things in ~/.gem without tracking down the real bug. | |
Things I have tried: | |
* --no-user-install on the command line. | |
* --no-user-install in my ~/.gemrc. | |
* rm -rf ~/.gem; touch ~/.gem; sudo chattr +i .gem (Blows up way earlier. | |
Rubygems can't cope with not being able to make that directory.) | |
* Telling rubygems lies about $HOME. | |
* This patch. It's the only thing that has worked so far, if my goal is to make | |
Rubygems die with an error instead of just stuffing things into ~/.gem, making | |
them inaccessible when I try to run things as a different user. (This being | |
Unix and all...) |