[Rubygems-developers] Audit of latest changes to trunk

Luis Lavena luislavena at gmail.com
Wed Nov 11 18:45:20 EST 2009

Hello Guys,

After the release of RC1 of RubyInstaller, I'm auditing several
projects and latest commits to avoid errors across platforms

This is the time for RubyGems:


>From both 1.8 and 1.9 versions, seems the only issue is related to
env_shebang and shebang itself:

  5) Failure:
test_shebang_env_shebang(TestGemInstaller) [./test/test_gem_installer.rb:786]:
Expected "#!/usr/bin/env ruby", not "#! ruby".

Taking a look to the code around the setter for the shebang:

      # Create a plain shebang line.
      @env_path ||= ENV_PATHS.find {|env_path| File.executable? env_path }
      "#!#{@env_path} #{ruby_name}"

Seems that is evaluating, from a list of possible candidates which is

The candidates are:

['/usr/bin/env', '/bin/env']

None of these exist on Windows.

According to the revision history, those got introduced in revision 2221

r2221 | drbrain | 2009-06-03 20:39:32 -0300 (mié, 03 jun 2009) | 1 line

Various patches from Ruby trunk

Seems that the test itself is pretty brittle, and will only work on a
OS that contains /usr/bin/env, and not the second option.

In that case, will be correct adjust the shebang to be compared
dependently of the OS?

shebang = windows? ? '#!' : '#!/usr/bin/env'


Thanks in advance for the feedback.

Luis Lavena
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

More information about the Rubygems-developers mailing list