carlhuda/bundler — Issue #1655: `bundle` command fails when run in Ruby 1.9.3-mingw32 on Win7 64
Author: nomoon
Created: 2012-02-11 01:05:12+00:00
State: open

I at first thought this was a problem with rubygems, but the ```custom_require``` method seems fine, as I'll show below. I'm posting it to their bug-tracker as well.

Typing `bundle` command gives the following error:
```C:/Dev/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': 193: %1 is not a valid Win32 application. - C:/Dev/Ruby193/lib/ruby/1.9.1/i386-mingw32/digest/sha1.so (LoadError)
from C:/Dev/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:1:in `'
from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler.rb:138:in `definition'
from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/cli.rb:219:in `install'
from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/task.rb:22:in `run'
from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor.rb:263:in `dispatch'
from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/base.rb:386:in `start'
from C:/Dev/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/bin/bundle:13:in `'
from C:/Dev/Ruby193/bin/bundle:19:in `load'
from C:/Dev/Ruby193/bin/bundle:19:in `

'```

I tracked this to the line ```require "digest/sha1``` at the top of ```bundler-1.0.22/lib/bundler/definition.rb``` but that looks odd. So I tried something to reproduce the problem.

The following file executes fine:
```require "digest/sha1"
puts Digest::SHA1.hexdigest('Test')```

but this slight modification throws an error:
```require "bundler"
require "digest/sha1"
puts Digest::SHA1.hexdigest('Test')

C:/Dev/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': 193: %1 is not a valid Win32 application. - C:/Dev/Ruby193/lib/ruby/1.9.1/i386-mingw32/digest/sha1.so (LoadError)
from C:/Dev/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from digesttest.rb:4:in `

'```

to make matters weirder, this also works fine:
```require "rails"
require "bundler"
require "digest/sha1"
puts Digest::SHA1.hexdigest('Test')```
However, requiring "bundler" before "rails" causes the same custom_require failure.

Is Bundler doing something to the path/require/gem methods here?