Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Rails new failed with JRuby on Windows 7 #1171

Closed
aplatypus opened this Issue · 4 comments

2 participants

@aplatypus

Hi There.

I am pretty sure something doesn't work with Rails on JRuby 1.7, since Rails 4 worked fine with RBI-s on the same PC, I am ready to say the issue lies somewhere in JRuby. I am surprised though. I'd think this would have come up earlier.

I upgraded to JRuby 1.7.6, I had 1.6.4 and updated first to see if that would work OK. No. So I am saying the issue has been around for some little time.

Here's the relevant Windows CMD console output.

java -version
    java version "1.7.0_45"
    Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
    Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

jruby --version
    jruby 1.7.6 (1.9.3p392) 2013-10-22 6004147 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 [Windows 7-amd64]

*rails* --version
    Rails 4.0.0

*rails new* rails_play
        create
        :
        :

Gives the following stack dump:

        :
        :
    create  vendor/assets/stylesheets/.keep
        run  bundle install
Errno::EINVAL: Invalid argument - =Z:
            replace at org/jruby/RubyHash.java:1783
  with_original_env at b:/lang/ruby/v01.07/lib/ruby/gems/shared/gems/bundler-1.3.5/lib/bundler.rb:207
     with_clean_env at b:/lang/ruby/v01.07/lib/ruby/gems/shared/gems/bundler-1.3.5/lib/bundler.rb:211
     bundle_command at b:/lang/ruby/v01.07/lib/ruby/gems/shared/gems/railties-4.0.0/lib/rails/generators/app_base.rb:271
         run_bundle at b:/lang/ruby/v01.07/lib/ruby/gems/shared/gems/railties-4.0.0/lib/rails/generators/app_base.rb:277
         run_bundle at (eval):1
                run at b:/lang/ruby/v01.07/lib/ruby/gems/shared/gems/thor-0.18.1/lib/thor/command.rb:27
     invoke_command at b:/lang/ruby/v01.07/lib/ruby/gems/shared/gems/thor-0.18.1/lib/thor/invocation.rb:120
         invoke_all at b:/lang/ruby/v01.07/lib/ruby/gems/shared/gems/thor-0.18.1/lib/thor/invocation.rb:127
               each at org/jruby/RubyHash.java:1324
                map at org/jruby/RubyEnumerable.java:732
         invoke_all at b:/lang/ruby/v01.07/lib/ruby/gems/shared/gems/thor-0.18.1/lib/thor/invocation.rb:127
           dispatch at b:/lang/ruby/v01.07/lib/ruby/gems/shared/gems/thor-0.18.1/lib/thor/group.rb:233
              start at b:/lang/ruby/v01.07/lib/ruby/gems/shared/gems/thor-0.18.1/lib/thor/base.rb:439
             (root) at b:/lang/ruby/v01.07/lib/ruby/gems/shared/gems/railties-4.0.0/lib/rails/commands/application.rb:43
            require at org/jruby/RubyKernel.java:1082
             (root) at b:/lang/ruby/v01.07/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
            require at b:/lang/ruby/v01.07/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:73
            require at org/jruby/RubyKernel.java:1082
             (root) at b:/lang/ruby/v01.07/lib/ruby/gems/shared/gems/railties-4.0.0/lib/rails/cli.rb:15
             (root) at b:/lang/ruby/v01.07/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
               load at org/jruby/RubyKernel.java:1101
             (root) at b:\lang\ruby\v01.07\bin\rails:23

I am guessing that something in Rails 4.0 invokes something JRuby wasn't comfortable with. It looks to me like the problem is in the loader (from a require command).

Oh the environment is Windows 7 SP1, 64-bit, all windows updates applied at time of writing; Java 1.7.0 u45.

I kept the console output for Ruby 2 & Rails (worked) as well as JRuby & Rails (failed) but there's no way to attach files to the bug report, it seems. I can email them if that could help.

Cheers,

Will

@enebo
Owner

Behavior confirmed. However bundle install is getting called from parent process is passing illegal environment values. If we manually set ENV with these values we get an error, so somehow this is not supposed to provide these when child processes are being invoked (or they are getting swallowed).

@aplatypus

Hi,

I'm sorry but I can't understand that response. Which ENV variable is being passed? It would be helpful to describe a possible workaround.

From the stack trace, I can confirm that "Z:" is the disk drive of the current path (pwd) when the 'Rails New' command was run. I would expect that to belong somewhere as a valid part of the environment for a 'new' command.

@enebo
Owner

Sorry. The key '=Z:' is not valid to setenv. Windows environment has some weird screwy key/values which will not be stuffable into setenv system call. So I think we either need to avoid these entries or not explode when we try to set them.

@enebo enebo closed this in 7e88a01
@enebo
Owner

This was a simple problem and it is mildly amazing we did not run into this sooner. Windows allows Keys to contain and start with = (like =Z:). MRI will actually strip these entries on startup when setting up ENV. Matching MRI's behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.