RubyGems bin stub cause Dir.pwd misdirect

(7rans) #1

Typical Gems bin stub

#!/usr/bin/env ruby

···

#
# This file was generated by RubyGems.
#
# The application 'nitro' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'
version = "> 0"
if ARGV.size > 0 && ARGV[0][0]==95 && ARGV[0][-1]==95
  if Gem::Version.correct?(ARGV[0][1..-2])
    version = ARGV[0][1..-2]
    ARGV.shift
  end
end
require_gem 'nitro', version
load 'nitrogen'

When I try to use it:

trans@ubixie:~/file/websites$ nitrogen app NitroTest
/usr/lib/ruby/1.8/fileutils.rb:467:in `mkdir': Permission denied -
/usr/bin/NitroTest (Errno::EACCES)

Am I right in thinking? The load statement here causes Dir.pwd to be
directed to /usr/bin --which is NOT GOOD.

T.

(7rans) #2

On second thought #load should work fine, and I did a testcase to be
sure. And yes, load does work fine, as least in a pure scenario. So why
are things messing up here....

(7rans) #3

Okay, believe I tracked it down. It's a line in nitro.rb. Rubygems was
just obscuring the fact b/c of the way it redirects things --I couldn't
load nitrogen without the require_gem nitro, and the problem is in
nitro.

Sorry for the noise,
T.