[BUG] invalid exec_format “ir”, no %s

Posted by – May 11, 2010

Today I’ve switched from the default, C based implementation of Ruby to new version of IronRuby (1.0). After installation I wanted to update gems, install rake tool and of course at this point problems started. Command for updating gems displayed below:

igem update --system

produced output like this:

Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.3.6
Updating RubyGems to 1.3.6
Installing RubyGems 1.3.6
ERROR:  While executing gem ... (Gem::Exception)
       [BUG] invalid exec_format "ir", no %s

After some research turned out that RubyGems assumes that Ruby executable contains “ruby” word in the name. In case of IronRuby the name is “ir.exe” so in my opinion this strange behavior can be treated as a bug in RubyGems. I hope it will be fixed in next release but before that will happen here are the steps to workaround the problem and update gems:

1. Create path: [IronRuby folder]\Lib\ruby\1.8\rubygems\defaults
2. Create file ironruby.rb and add it to the path from step 1
3. Open ironruby.rb and add code from the snippet below

module Gem
  def self.default_exec_format
    exec_format = ConfigMap[:ruby_install_name].sub('ruby', '%s') rescue '%s'
    #unless exec_format =~ /%s/ then
    #  raise Gem::Exception,
    #    "[BUG] invalid exec_format #{exec_format.inspect}, no %s"
    #end
    exec_format
  end
end

That is it. Now RubyGems will use new implementation of default_exec_format and everything should work as expected.

Hope this helps.

Hey, keep in touch!! Follow me on Twitter, @marcinobel or subscribe to this blog.
3 Comments on [BUG] invalid exec_format “ir”, no %s

Respond | Trackback

  1. [...] This post was mentioned on Twitter by Marcin Obel, Pawel Lesnikowski. Pawel Lesnikowski said: Haha FAIL: RT @marcinobel: Blogged: [BUG] invalid exec_format “ir”, no %s http://bit.ly/9AtM1D #ruby #ironruby #gems [...]

  2. Will Green says:

    Perhaps a better solution would be to replace self.default_exec_format with the following:

    def self.default_exec_format
    exec_format = ConfigMap[:ruby_install_name].sub(‘ir’, ‘%s’) rescue ‘%s’

    unless exec_format =~ /%s/ then
    raise Gem::Exception,
    “[BUG] invalid exec_format #{exec_format.inspect}, no %s”
    end

    exec_format
    end

  3. [...] = 'hotgazpacho';After reading this article on getting around the invalid exec_format “ir”, no %s issue when trying to update RubyGems in [...]

Respond

Comments

Comments