Skip to content

Conversation

danini-the-panini
Copy link
Contributor

Currently the -sourcepath command is not being passed correctly to jdb, causing an error when running. This PR separates jdb_args and prepends them to java args just before prepending JAVACMD to ensure the sourcepath command is recognised.

Before

$ jruby --version
jruby 9.4.10.0-SNAPSHOT (3.1.4) 2024-11-29 ffffffffff Java HotSpot(TM) 64-Bit Server VM 23.0.1+11-39 on 23.0.1+11-39 +jit [arm64-darwin]
$ jruby --jdb foo.rb
Initializing jdb ...
> run
run @/Users/dani/projects/mine/jruby/bin/.jruby.java_opts @/Users/dani/projects/mine/jruby/bin/.jruby.module_opts -Xss2048k -Djffi.boot.library.path=/Users/dani/projects/mine/jruby/lib/jni -sourcepath /Users/dani/projects/mine/jruby/core/src/main/java:/Users/dani/projects/mine/jruby/lib/ruby/stdlib:. -Djava.security.egd=file:/dev/urandom --module-path /Users/dani/projects/mine/jruby/lib/jruby.jar -classpath : -Djruby.home=/Users/dani/projects/mine/jruby -Djruby.lib=/Users/dani/projects/mine/jruby/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main -X+C foo.rb
VM start exception: VM initialization failed for: /Library/Java/JavaVirtualMachines/jdk-23.jdk/Contents/Home/bin/java -Xrunjdwp:transport=dt_socket,address=localhost:50157,suspend=y,includevirtualthreads=n @/Users/dani/projects/mine/jruby/bin/.jruby.java_opts @/Users/dani/projects/mine/jruby/bin/.jruby.module_opts -Xss2048k -Djffi.boot.library.path=/Users/dani/projects/mine/jruby/lib/jni -sourcepath /Users/dani/projects/mine/jruby/core/src/main/java:/Users/dani/projects/mine/jruby/lib/ruby/stdlib:. -Djava.security.egd=file:/dev/urandom --module-path /Users/dani/projects/mine/jruby/lib/jruby.jar -classpath : -Djruby.home=/Users/dani/projects/mine/jruby -Djruby.lib=/Users/dani/projects/mine/jruby/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main -X+C foo.rb

Unrecognized option: -sourcepath
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Fatal error:
Target VM failed to initialize.

After

$ jruby --version
jruby 9.4.10.0-SNAPSHOT (3.1.4) 2024-11-29 ffffffffff Java HotSpot(TM) 64-Bit Server VM 23.0.1+11-39 on 23.0.1+11-39 +jit [arm64-darwin]
$ jruby --jdb foo.rb
Initializing jdb ...
> run
run @/Users/dani/projects/mine/jruby/bin/.jruby.java_opts @/Users/dani/projects/mine/jruby/bin/.jruby.module_opts -Xss2048k -Djffi.boot.library.path=/Users/dani/projects/mine/jruby/lib/jni -Djava.security.egd=file:/dev/urandom --module-path /Users/dani/projects/mine/jruby/lib/jruby.jar -classpath : -Djruby.home=/Users/dani/projects/mine/jruby -Djruby.lib=/Users/dani/projects/mine/jruby/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main -X+C foo.rb
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started: Foo!

The application exited

@enebo enebo merged commit f90901d into jruby:master Nov 29, 2024
95 checks passed
@enebo
Copy link
Member

enebo commented Nov 29, 2024

@danini-the-panini thank you for the contribution. I guess we reverted this at some point.

@mrnoname1000 pinging you in case you want this done differently. Looks fairly straight-forward to me enough to land it as-is.

@danini-the-panini danini-the-panini deleted the ds-fix-jdb branch November 29, 2024 18:46
@mrnoname1000
Copy link
Contributor

Looks like the jdb={false,true} variable could be omitted since the preextend would be a no-op but the outcome is the same either way so it looks good to me.

@enebo enebo added this to the JRuby 9.4.10.0 milestone Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants