Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1100840

Summary: rubygem-passenger: better support for loading native library under other Ruby environments
Product: Red Hat Software Collections Reporter: Dominic Cleal <dcleal>
Component: passengerAssignee: Jan Kaluža <jkaluza>
Status: CLOSED ERRATA QA Contact: Ondřej Pták <optak>
Severity: low Docs Contact:
Priority: low    
Version: rh-passenger40CC: jkaluza, jorton, kanderso, lzap, optak
Target Milestone: rc   
Target Release: 2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: passenger-4.0.50-7.el7 passenger-4.0.50-7.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-04 08:05:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
removes hard coded native lib path none

Description Dominic Cleal 2014-05-23 14:49:29 UTC
Created attachment 898709 [details]
removes hard coded native lib path

Description of problem:
It's possible to use rubygem-passenger in multiple Ruby environments by rebuilding it for other SCLs or as a non-SCL RPM, but currently the RHSCL SRPM carries a patch that hardcodes the native library path.

$ grep -A2 "def load_from_load_path" ./opt/rh/ruby193/root/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/native_support.rb
	def load_from_load_path
		require "/opt/rh/ruby193/root/usr/lib64/gems/exts/passenger-4.0.18/lib/native/#{library_name}"
		return true

When changing the Ruby environment using the PassengerRuby directive that the preloader will always load the ruby193 variant irrespective of which ruby interpreter it's running under and which load paths are set.

Attached is a patch that makes it rely properly on the load path instead of being hardcoded, so is compatible with multiple Ruby envs.

The patch also patches the gemspec so the Fedora/RHSCL rubygems package's custom 'exts' load path is added.

It'd be appreciated if this can be sent upstream to Fedora too if it's accepted here.

Version-Release number of selected component (if applicable):
ruby193-rubygem-passenger-4.0.18-10.el6

How reproducible:
Always

Steps to Reproduce:
1. Rebuild SRPM for an additional SCL, e.g. ruby200 (or non-SCL, but that's harder)
2. Install both sets of RPMs, but only ruby193-mod_passenger (only one Apache module is needed)
3. Create single command wrappers to launch ruby193 or ruby200 (https://github.com/maxamillion/ruby-wrapper)
4. Define two VirtualHosts, one with PassengerRuby /usr/bin/ruby193-ruby, the other with PassengerRuby /usr/bin/ruby200-ruby
5. Verify using RUBY_VERSION inside each, or "ps" that they're both loaded under different interpreters successfully

Comment 1 Jason Montleon 2014-05-30 13:23:16 UTC
*** Bug 1102811 has been marked as a duplicate of this bug. ***

Comment 10 Ondřej Pták 2015-04-02 16:01:00 UTC
Currently there is no unexpected hardcoded ruby path in any script under rh-passenger40 collection

Comment 12 errata-xmlrpc 2015-06-04 08:05:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2015-1060.html