Bug 862876 - ruby-1.9 (maybe 1.8) will throw errors about not being able to write to ~/.gem/
Summary: ruby-1.9 (maybe 1.8) will throw errors about not being able to write to ~/.gem/
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: Containers
Version: 2.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Jhon Honce
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-03 19:52 UTC by Mike McGrath
Modified: 2015-05-14 23:00 UTC (History)
3 users (show)

Fixed In Version: devenv_2301
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-11-06 18:48:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Mike McGrath 2012-10-03 19:52:16 UTC
Description of problem:

Some common operations with bundler will throw an error.  I'm completely willing to accept that this may not actually be a bug, if it's not close it as wontfix


How reproducible:

Every time


Steps to Reproduce:
1.  Create a ruby 1.9 install
2.  Throw a valid Gemfile on the filesystem
3.  Run bundle install
  
Actual results:

[fun-happytimes.rhcloud.com repo]\> bundle install
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/opt/rh/ruby193/root/usr/share/ruby/fileutils.rb:247:in `mkdir': Permission denied - /var/lib/stickshift/a66f44ef6d0d4e9099f597b5ae240abf/.gem (Errno::EACCES)
        from /opt/rh/ruby193/root/usr/share/ruby/fileutils.rb:247:in `fu_mkdir'
        from /opt/rh/ruby193/root/usr/share/ruby/fileutils.rb:221:in `block (2 levels) in mkdir_p'
        from /opt/rh/ruby193/root/usr/share/ruby/fileutils.rb:219:in `reverse_each'
        from /opt/rh/ruby193/root/usr/share/ruby/fileutils.rb:219:in `block in mkdir_p'
        from /opt/rh/ruby193/root/usr/share/ruby/fileutils.rb:205:in `each'
        from /opt/rh/ruby193/root/usr/share/ruby/fileutils.rb:205:in `mkdir_p'
        from /opt/rh/ruby193/root/usr/share/ruby/pathname.rb:514:in `mkpath'
        from /opt/rh/ruby193/root/usr/share/gems/gems/bundler-1.1.4/lib/bundler/installer.rb:19:in `run'
        from /opt/rh/ruby193/root/usr/share/gems/gems/bundler-1.1.4/lib/bundler/installer.rb:12:in `install'
        from /opt/rh/ruby193/root/usr/share/gems/gems/bundler-1.1.4/lib/bundler/cli.rb:220:in `install'
        from /opt/rh/ruby193/root/usr/share/gems/gems/thor-0.15.4/lib/thor/task.rb:27:in `run'
        from /opt/rh/ruby193/root/usr/share/gems/gems/thor-0.15.4/lib/thor/invocation.rb:120:in `invoke_task'
        from /opt/rh/ruby193/root/usr/share/gems/gems/thor-0.15.4/lib/thor.rb:275:in `dispatch'
        from /opt/rh/ruby193/root/usr/share/gems/gems/thor-0.15.4/lib/thor/base.rb:425:in `start'
        from /opt/rh/ruby193/root/usr/share/gems/gems/bundler-1.1.4/bin/bundle:13:in `<top (required)>'
        from /opt/rh/ruby193/root/usr/bin/bundle:23:in `load'
        from /opt/rh/ruby193/root/usr/bin/bundle:23:in `<main>'

Comment 1 Jhon Honce 2012-10-05 00:05:44 UTC
Configure hook enhanced to create ~/.gem directories code will be pushed once repositories are open for business.

Comment 3 Jianwei Hou 2012-10-09 05:34:05 UTC
Tested on devenv_2301

Steps:
1. Create a ruby-1.9 app
2. ssh into app, cd $OPENSHIFT_REPO_DIR
3. Create a valid Gemfile under $OPENSHIFT_REPO_DIR
[r19-2301t.dev.rhcloud.com repo]\> cat Gemfile
[r19-2301t.dev.rhcloud.com repo]\> cat Gemfile
source "http://rubygems.org"
gem "rack"
4. Run 'bundle install'
[r19-2301t.dev.rhcloud.com repo]\> bundle install
Using rack (1.4.1) 
Using bundler (1.1.4) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

Repeat above steps for ruby-1.8 apps
For ruby-1.8, I caught this error:
[r18-2301t.dev.rhcloud.com repo]\> bundle install
Fetching source index for http://rubygems.org/

which: no sudo in (/usr/libexec/openshift/cartridges/ruby-1.8/info/bin/:/usr/libexec/openshift/cartridges/abstract-httpd/info/bin/:/usr/libexec/openshift/cartridges/abstract/info/bin/:/sbin:/usr/sbin:/bin:/usr/bin)

Gem::Exception: Cannot load gem at [/usr/lib/ruby/gems/1.8/cache/rack-1.4.1.gem] in /var/lib/openshift/dfe1250e6b20441d85887c6cabd469ef/app-root/runtime/repo
An error occured while installing rack (1.4.1), and Bundler cannot continue.
Make sure that `gem install rack -v '1.4.1'` succeeds before bundling.

Comment 4 Jhon Honce 2012-10-09 15:35:43 UTC
You need to set GEM_HOME to point to ~/.gem. Otherwise, bundler will attempt to install into the system directories as you demonstrated in comment#3

Comment 5 Jianwei Hou 2012-10-10 01:57:23 UTC
Verified on devenv_2303

For ruby-1.8, need to set GEM_HOME to point to ~/.gem, and bundle install will work.
[ruby18-2303t.dev.rhcloud.com ~]\> export GEM_HOME=/var/lib/openshift/5555b0bfab3b4447b9d1b438e250af24/.gem/

[ruby18-2303t.dev.rhcloud.com repo]\> cat Gemfile
source "http://rubygems.org"
gem "rack"
[ruby18-2303t.dev.rhcloud.com repo]\> bundle install
Fetching source index for http://rubygems.org/

which: no sudo in (/usr/libexec/openshift/cartridges/ruby-1.8/info/bin/:/usr/libexec/openshift/cartridges/abstract-httpd/info/bin/:/usr/libexec/openshift/cartridges/abstract/info/bin/:/sbin:/usr/sbin:/bin:/usr/bin)
Installing rack (1.4.1) 
Using bundler (1.0.21) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.


Note You need to log in before you can comment on or make changes to this bug.