Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the passenger_free_ruby executable that is installed by the apt passenger package

How does passenger_free_ruby work?

I installed phusion passenger using the apt package provided by phusion. My system ruby is ruby2.1 installed using the brightbox apt packages. I would expect /etc/apache2/mods-enabled/passenger.conf to use /usr/bin/ruby as the default value of PassengerDefaultRuby. It uses /usr/bin/passenger_free_ruby.

passenger_free_ruby acts like ruby and it is the expected ruby

/usr/bin/passenger_free_ruby -v
ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-linux-gnu]

If I upgrade ruby to ruby2.2 then passenger_free_ruby runs as the ruby2.2

/usr/bin/passenger_free_ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux-gnu]

So what does passenger_free_ruby actually do? What does free mean? Why not just use /usr/bin/ruby as the default ruby?

like image 232
Scott Jacobsen Avatar asked Feb 10 '23 06:02

Scott Jacobsen


1 Answers

The reason for its existance is documented in the executable's source code.

/*
 * This is a simple program for executing either the 'ruby' command in PATH,
 * or one of the Ruby versions installable by APT. This is necessary because
 * Debian 6 and Debian 8 (among others) do not install /usr/bin/ruby upon
 * installing one of the versioned Ruby packages (e.g. apt-get install ruby2.1).
 * Commands such as 'passenger' are supposed to be runnable under any Ruby
 * interpreter the user desires, including non-APT-installed Rubies, but we can't
 * just set the shebang line to '#!/usr/bin/env ruby'. This problem is solved by
 * setting the shebang line to '#!/usr/bin/passenger_default_ruby'.
 */
like image 53
Hongli Avatar answered Feb 11 '23 19:02

Hongli