Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
`system` method is different behavior from JRuby 1.7.x and CRuby 2.3.x #3653
I'am preparing to release Rake 11. but Rake master has some blocker related JRuby 184.108.40.206.
I investigated 3 and 4 in above log. I found strange difference at JRuby 220.127.116.11. Please see re-produce code: https://github.com/hsbt/rake-issue-chdir
JRuby 18.104.22.168 expand ENV variables to environmental variable in
Is this intentional behavior?
Ok, the problem here is that the new logic for process spawning does not support chdir in the same way as MRI.
In MRI, if you specify chdir when calling spawn or system or whatever, it will actually do a native chdir before launching the child process. It does this either after forking or temporarily around the call to spawn(2) (setting it back after launching the process).
MRI also actually does a real native chdir when doing
We have never been comfortable changing the directory the JVM is running in, because we worry that will at least confuse the JVM and at worst interfere with other threads or applications running in the same process. However, we have never tested real chdir to see if anything bad happens.
A short term fix for this in JRuby would be to fall back on the old JVM process logic when we need to chdir, since that logic uses fork+exec similar to MRI. This might be ok for system, since all it does is capture all child process output. However, it would be too great a change for e.g.
It's worth pointing out that MRI will behave the same as us even without chdir if the command given looks like a command line. For example, if I change
MRI will also expand the env var. So it's a bit fragile to build commands that have loose env var references and expect them not to expand.
I agreed. Rake has expantion and no expantion tests at https://github.com/ruby/rake/blob/master/test/test_rake_file_utils.rb#L140 . I didn't know why CRuby shows this behavior.
I will discuss this to CRuby core team.
(Not sure right place to post or make issue, so thought I'd start here with a comment.)
Excerpt for convenience:
Uses latest precompiled JRuby so that we don't spend time downloading versions Travis has not already compiled. http://rubies.travis-ci.org/ Uses latest jdk: oraclejdk8 per https://docs.travis-ci.com/user/build-environment-updates/2015-02-03/#Ruby-VM and https://docs.travis-ci.com/user/languages/ruby/#Supported-Ruby-Versions-and-RVM Follows on work in rails#23927 which was reverted rails@26fe5fa JRUBY_OPTS minimize GC, disable JIT, for max test speed - rails#16613 - rails#17088 Have Rails use JRuby-compatible Rake 11.1 - The Rake task was passing --verbose, an invalid option, to contemporary JRuby - ruby/rake#120 - rails-api/active_model_serializers#1585 - jruby/jruby#3653 (comment) No advantage to directly mounting JRuby over installing from cache; both on S3 - rails@b2d5b33 - rails@f4fad04