[Rubygems-developers] Installing Rubygems in User's Local Directory to fix Gem on Memory-Limited Systems

Randy Parker randy.j.parker at gmail.com
Thu Jun 7 13:27:23 EDT 2007


These two bugs currently prevent all memory-restricted shared hosting users
from using "gem install" or "gem update".
*
*[ support-Bugs-11406 ] "gem install" takes more memory than some hosting
companies allow

[ rubygems-Bugs-10491 ] "gem update" fails with SEG FAULT while trying to
update it's gem list from the server

Several threads on this list deal with the problem:
http://rubyforge.org/pipermail/rubygems-developers/2007-May/002789.html
http://rubyforge.org/pipermail/rubygems-developers/2007-May/002798.html
http://rubyforge.org/pipermail/rubygems-developers/2007-May/002803.html

Jim produced a beta gem that reduces the problem - rubygems-update-0.9.4.2:
http://rubyforge.org/pipermail/rubygems-developers/2007-June/002811.html

I don't think we yet know what fraction of the victims can use gem again
with this improvement.  It depends on what the hoster's memory limits are,
and how they are implemented.  Some hosters sell accounts will with less
than 48MB.  I'm trying to test three hosters myself.  In the long run,
several other approaches have been discussed, perhaps using some kind of
rsync.

The only way to use the fix is to "gem update --system --source
http://onestepback.org/betagems".  This requires the shared hosting gem
environment to be configured so that the "gem system" dirs are in the user's
local account.  I'm having trouble with that.

shell-prompt$ gem env
RubyGems Environment:
  - VERSION: 0.9.2 (0.9.2)
  - INSTALLATION DIRECTORY: /users/home/randy/gems
  - GEM PATH:
     - /users/home/randy/gems
     - /usr/local/lib/ruby/gems/1.8
  - REMOTE SOURCES:
     - http://gems.rubyforge.org


shell-prompt$ env | grep -e GEM -e RUBY
GEM_HOME=/users/home/randy/gems
GEM_PATH=/users/home/randy/gems:/usr/local/lib/ruby/gems/1.8
RUBYLIB=/users/home/randy/gems/lib/ruby/site_ruby/1.8:/usr/local/lib/ruby/site_ruby/1.8

shell-prompt$ gem update --system --source http://onestepback.org/betagems
Updating RubyGems...
Attempting remote update of rubygems-update
Successfully installed rubygems-update-0.9.4.2
Updating version of RubyGems to 0.9.4.2
Installing RubyGems 0.9.4.2
---> bin
<--- bin
---> lib
---> lib/rbconfig
<--- lib/rbconfig
---> lib/rubygems
---> lib/rubygems/digest
<--- lib/rubygems/digest
---> lib/rubygems/commands
<--- lib/rubygems/commands
<--- lib/rubygems
<--- lib
---> bin
updating shebang: gem
updating shebang: gemri
updating shebang: gemlock
updating shebang: index_gem_repository.rb
updating shebang: gem_server
updating shebang: gemwhich
updating shebang: gem_mirror
updating shebang: update_rubygems
<--- bin
---> lib
---> lib/rbconfig
<--- lib/rbconfig
---> lib/rubygems
---> lib/rubygems/digest
<--- lib/rubygems/digest
---> lib/rubygems/commands
<--- lib/rubygems/commands
<--- lib/rubygems
<--- lib
rm -f InstalledFiles
---> bin
mkdir -p /usr/local/bin/
install gem /usr/local/bin/
setup.rb:633:in `initialize': Permission denied - /usr/local/bin/gem
(Errno::EACCES)
        from setup.rb:633:in `open'
        from setup.rb:633:in `install'
        from setup.rb:1377:in `install_files'
        from setup.rb:1376:in `each'
        from setup.rb:1376:in `install_files'
        from setup.rb:1346:in `install_dir_bin'
        from setup.rb:1532:in `__send__'
        from setup.rb:1532:in `traverse'
         ... 6 levels...
        from setup.rb:1000:in `exec_install'
        from setup.rb:814:in `invoke'
        from setup.rb:773:in `invoke'
        from setup.rb:1578
RubyGems system software updated


So I also tried

gem update --system --source
http://onestepback.org/betagems--install-dir=$GEM_HOME

with the exact same effect.  After some searching, I found
[rubygems #8470] gem update --system should take the prefix at which
rubygems is installed into accountwhich advises

To workaround, switch to the downloaded rubygem update (e.g.
GEM_HOME/gems/rubygems-update-0.9.2/), then run the install sequence
again:

   ruby setup.rb config --prefix=$GEM_HOME
   ruby setup.rb setup
   ruby setup.rb install

I did this, and even added

   ruby setup.rb install --prefix=$GEM_HOME

But in all cases the install step insisted on trying (and naturally failing)
to install to the hosting computer's system dir, with the same line as
included above:

setup.rb:633:in `initialize': Permission denied - /usr/local/bin/gem
(Errno::EACCES)

Why is it attempting to install to the system when I'm telling it not to?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rubygems-developers/attachments/20070607/8ee5851b/attachment-0001.html 


More information about the Rubygems-developers mailing list