Description of problem: Create a ruby application, in rhcsh, run 'gem env' and notice the executable path is /var/lib/openshift/$UUID/bin. However, the executable path does not actually exist, and user do not have sufficient privildge to create such a directory Version-Release number of selected component (if applicable): On devenv_3368 How reproducible: Always Steps to Reproduce: 1. Create a ruby application 2. ssh into gear, run 'gem env' 3. go to the executable directory Actual results: After step 2: RubyGems Environment: - RUBYGEMS VERSION: 1.8.24 - RUBY VERSION: 1.9.3 (2013-05-15 patchlevel 429) [x86_64-linux] - INSTALLATION DIRECTORY: /var/lib/openshift/51bea33b1354510733000002/.gem/ruby/1.9.1 - RUBY EXECUTABLE: /opt/rh/ruby193/root/usr/bin/ruby - EXECUTABLE DIRECTORY: /var/lib/openshift/51bea33b1354510733000002/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-linux - GEM PATHS: - /var/lib/openshift/51bea33b1354510733000002/.gem/ruby/1.9.1 - /opt/rh/ruby193/root/usr/share/gems - /opt/rh/ruby193/root/usr/local/share/gems - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/ After step 3: [rails-jhou.dev.rhcloud.com 51bea33b1354510733000002]\> ls /var/lib/openshift/51bea33b1354510733000002/bin ls: cannot access /var/lib/openshift/51bea33b1354510733000002/bin: No such file or directory Expected results: Maybe the executable path should be valid[rails-jhou.dev.rhcloud.com 51bea33b1354510733000002]\> ls /var/lib/openshift/51bea33b1354510733000002/bin ls: cannot access /var/lib/openshift/51bea33b1354510733000002/bin: No such file or directory Additional info:
https://bugzilla.redhat.com/show_bug.cgi?id=974632 should move $GEM_HOME to ~/.gem. We still need to add $GEM_HOME/bin to $PATH.
See https://github.com/openshift/origin-server/pull/2865
[rack-fooooooooooo.dev.rhcloud.com 172097536760743733493760]\> gem env RubyGems Environment: - RUBYGEMS VERSION: 1.8.24 - RUBY VERSION: 1.9.3 (2013-05-15 patchlevel 429) [x86_64-linux] - INSTALLATION DIRECTORY: /var/lib/openshift/172097536760743733493760/.gem - RUBY EXECUTABLE: /opt/rh/ruby193/root/usr/bin/ruby - EXECUTABLE DIRECTORY: /var/lib/openshift/172097536760743733493760/.gem/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-linux - GEM PATHS: - /var/lib/openshift/172097536760743733493760/.gem - /var/lib/openshift/172097536760743733493760/.gem/ruby/1.9.1 - /opt/rh/ruby193/root/usr/share/gems - /opt/rh/ruby193/root/usr/local/share/gems - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/
Note that $PATH will be set up in such a way that the primary cartridge's OPENSHIFT_*_PATH_ELEMENT will take precedence. This means that, on a Ruby cartridge, the executables that the platform installs (such as 'thor', 'rake') will be used even when a different one was installed via 'gem'.
Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/fcc90265dee4fcaa7b9e4804775dfafec736ea0b Bug 974983 Set up $PATH so that executables installed by a gem can be found.
Hi, Hiro Are there any more changes for this bug? if not, please help to move it to ON_QA. Thanks
Tested on devenv_3471 New environment variable added [r18-jhou.dev.rhcloud.com .gem]\> env|grep RUBYGEMS OPENSHIFT_RUBYGEMS_PATH_ELEMENT=/var/lib/openshift/539525222203891642269696/.gem/bin The gem executable directory is valid [r18-jhou.dev.rhcloud.com .gem]\> gem env RubyGems Environment: - RUBYGEMS VERSION: 1.3.7 - RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux] - INSTALLATION DIRECTORY: /var/lib/openshift/539525222203891642269696/.gem - RUBY EXECUTABLE: /usr/bin/ruby - EXECUTABLE DIRECTORY: /var/lib/openshift/539525222203891642269696/.gem/bin - RUBYGEMS PLATFORMS: - ruby - x86_64-linux - GEM PATHS: - /var/lib/openshift/539525222203891642269696/.gem - /var/lib/openshift/539525222203891642269696/.gem/ruby/1.8 - /usr/lib/ruby/gems/1.8 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - REMOTE SOURCES: - http://rubygems.org/ install gem from rhcsh [r18-jhou.dev.rhcloud.com .gem]\> gem install rake Successfully installed rake-10.1.0 1 gem installed Installing ri documentation for rake-10.1.0... Installing RDoc documentation for rake-10.1.0... [r18-jhou.dev.rhcloud.com .gem]\> gem list rake *** LOCAL GEMS *** rake (10.1.0, 0.8.7) [r18-jhou.dev.rhcloud.com .gem]\> rake --version rake, version 10.1.0 [r18-jhou.dev.rhcloud.com .gem]\> which rake /var/lib/openshift/539525222203891642269696/.gem/bin/rake The user installed gem takes precedence to the platform installed ones
Comment 7 is based on a ruby-1.8 application, for ruby-1.9 cartridges, the $OPENSHIFT_RUBYGEMS_PATH_ELEMENT does not take precedence to $PATH, that means platform installed gems take precedence to user installed gems. ruby-1.8 [r18-jhou.dev.rhcloud.com 539525222203891642269696]\> echo $PATH /var/lib/openshift/539525222203891642269696/.gem/bin::/bin:/usr/bin:/usr/sbin [r18-jhou.dev.rhcloud.com 539525222203891642269696]\> gem list rake *** LOCAL GEMS *** rake (10.1.0, 0.8.7) [r18-jhou.dev.rhcloud.com 539525222203891642269696]\> which rake /var/lib/openshift/539525222203891642269696/.gem/bin/rake ruby-1.9 [r19-jhou.dev.rhcloud.com .gem]\> echo $PATH /opt/rh/ruby193/root/usr/bin:/var/lib/openshift/51dcc4626bb15a0e4e000001/.gem/bin:/opt/rh/ruby193/root/usr/bin::/bin:/usr/bin:/usr/sbin [r19-jhou.dev.rhcloud.com .gem]\> gem list rake *** LOCAL GEMS *** rake (10.1.0, 0.9.2.2) rake-compiler (0.8.3) [r19-jhou.dev.rhcloud.com .gem]\> which rake /opt/rh/ruby193/root/usr/bin/rake The ruby-1.8 and ruby-1.9 cartridges behave differently, so assign this back in case this is not what we expect.
Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/136f0ec6b5611045c7bd0693e721187ed4118cdc Bug 974983 Set up $PATH so that ~/.gem/bin precedes /opt/rh/ruby193/root/usr/bin or /usr/bin (as appropriate). This effectively reverts fcc9026, which added RubyGems' path during the user setup. That commit was incomplete, since that led to inconsistency with the 1.9 apps (see https://bugzilla.redhat.com/show_bug.cgi?id=974983#c8). Instead, we use $OPENSHIFT_RUBY_PATH_ELEMENT to ensure that $PATH is correct. (It is possible to use $OPENSHIFT_RUBYGEMS_PATH_ELEMENT still, but that relies on $*_PATH_ELEMENT processing order, which we need to avoid here.)
Tested on devenv_3482, the $PATH issue has been fix for ruby applications. ruby-1.8 [r18-jhou.dev.rhcloud.com 51de481b36ff800a00000004]\> echo $PATH /var/lib/openshift/51de481b36ff800a00000004/.gem/bin:/var/lib/openshift/51de481b36ff800a00000004/.gem/bin::/bin:/usr/bin:/usr/sbin ruby-1.9 [r19s-jhou.dev.rhcloud.com 51de478436ff800a00000001]\> echo $PATH /var/lib/openshift/51de478436ff800a00000001/.gem/bin:/opt/rh/ruby193/root/usr/bin:/var/lib/openshift/51de478436ff800a00000001/haproxy/usr/bin:/var/lib/openshift/51de478436ff800a00000001/.gem/bin:/opt/rh/ruby193/root/usr/bin::/bin:/usr/bin:/usr/sbin @Hiro, can you please move this bug to ON_QA? thanks
Mark as verified according to Comment 10
I should note that Comment 4 is invalid now. Gem-installed scripts take precedence.