-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
system
method is different behavior from JRuby 1.7.x and CRuby 2.3.x
#3653
Comments
Ok, interesting. I'll have a look. |
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
to
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. |
This is fixed, but it's still an issue for other spawn forms. However, I still feel like it's asking for trouble spawning subprocesses with env vars and expecting 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. |
@headius @hsbt I think there's still and issue in 9.0.4.0 and Rake 11.0/11.1. (Not sure right place to post or make issue, so thought I'd start here with a comment.) See rails-api/active_model_serializers#1585 Excerpt for convenience:
|
@bf4 It's not related this issue. It's regression of rake behavior. Can you submit this issue to ruby/rake ? I will investigate next week. |
@hsbt Thanks. So, JRuby isn't supposed to have a |
Yes. I will fix your issue at ruby/rake#120 and release 11.1.1. |
@bf4 It appears MRI does have a --verbose flag and we don't. So I'll fix that here. |
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
I'am preparing to release Rake 11. but Rake master has some blocker related JRuby 9.0.5.0.
see https://travis-ci.org/ruby/rake/jobs/107731466
I investigated 3 and 4 in above log. I found strange difference at JRuby 9.0.5.0. Please see re-produce code: https://github.com/hsbt/rake-issue-chdir
JRuby 9.0.5.0 expand ENV variables to environmental variable in
system
shell runner after invokingDir.chdir
.Is this intentional behavior?
The text was updated successfully, but these errors were encountered: