oneclick/rubyinstaller — Issue #102: `gem help command` and `bundler` both error on Win7 64 with 1.9.3-p0, work fine with 1.9.2-p290
Author: nomoon
Created: 2012-02-13 21:18:51+00:00
State: open

I at first thought this might be a problem with rubygems, or with bundler, but the ```custom_require``` method seems fine, as I'll show below. I've posted it around

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.

To prove this isn't a bundler-only issue, when I run ```gem help commands``` I get this error:

```
ERROR: Loading command: server (LoadError)
193: %1 is not a valid Win32 application. - C:/Dev/Ruby193/lib/ruby/1.9.1/i386-mingw32/digest/md5.so
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::ServerCommand
```