jruby / ruby-maven

Eclipse Public License 2.0
1 stars 5 forks source link

`gem install psych` on JRuby fails with `--enable-frozen-string-literal` #12

Open dentarg opened 1 day ago

dentarg commented 1 day ago
$ docker run -it --rm jruby:9.4.9.0 bash
root@f2eb44db1237:/app# export RUBYOPT="--enable-frozen-string-literal --debug-frozen-string-literal"
root@f2eb44db1237:/app# gem install psych
Fetching psych-5.2.0-java.gem
  jar dependencies for psych-5.2.0-java.gemspec . . .
Installing gem 'ruby-maven' . . .
Fetching ruby-maven-3.3.13.gem
Fetching ruby-maven-libs-3.3.9.gem
Successfully installed ruby-maven-libs-3.3.9
Successfully installed ruby-maven-3.3.13

using maven for the first time results in maven
downloading all its default plugin and can take time.
as those plugins get cached on disk and further execution
of maven is much faster then the first time.

ERROR:  While executing gem ... (FrozenError)
    can't modify frozen String, created at /usr/local/bundle/gems/ruby-maven-3.3.13/lib/ruby_maven.rb:25
    org/jruby/RubyString.java:1526:in `replace'
    /usr/local/bundle/gems/ruby-maven-3.3.13/lib/ruby_maven.rb:63:in `version'
    /usr/local/bundle/gems/ruby-maven-3.3.13/lib/ruby_maven.rb:81:in `launch'
    /usr/local/bundle/gems/ruby-maven-3.3.13/lib/ruby_maven.rb:48:in `exec'
    /usr/local/bundle/gems/ruby-maven-3.3.13/lib/maven/ruby/maven.rb:112:in `exec'
    /opt/jruby/lib/ruby/stdlib/jars/maven_exec.rb:79:in `resolve_dependencies_list'
    /opt/jruby/lib/ruby/stdlib/jars/installer.rb:233:in `install_dependencies'
    /opt/jruby/lib/ruby/stdlib/jars/installer.rb:224:in `do_install'
    /opt/jruby/lib/ruby/stdlib/jars/installer.rb:170:in `vendor_jars'
    /opt/jruby/lib/ruby/stdlib/jars/post_install_hook.rb:28:in `block in <main>'
    /opt/jruby/lib/ruby/stdlib/rubygems/installer.rb:381:in `block in run_post_install_hooks'
    org/jruby/RubyArray.java:1981:in `each'
    /opt/jruby/lib/ruby/stdlib/rubygems/installer.rb:380:in `run_post_install_hooks'
    /opt/jruby/lib/ruby/stdlib/rubygems/installer.rb:345:in `install'
    /opt/jruby/lib/ruby/stdlib/rubygems/resolver/specification.rb:104:in `install'
    /opt/jruby/lib/ruby/stdlib/rubygems/request_set.rb:194:in `block in install'
    org/jruby/RubyArray.java:1981:in `each'
    /opt/jruby/lib/ruby/stdlib/rubygems/request_set.rb:182:in `install'
    /opt/jruby/lib/ruby/stdlib/rubygems/commands/install_command.rb:210:in `install_gem'
    /opt/jruby/lib/ruby/stdlib/rubygems/commands/install_command.rb:226:in `block in install_gems'
    org/jruby/RubyArray.java:1981:in `each'
    /opt/jruby/lib/ruby/stdlib/rubygems/commands/install_command.rb:219:in `install_gems'
    /opt/jruby/lib/ruby/stdlib/rubygems/commands/install_command.rb:167:in `execute'
    /opt/jruby/lib/ruby/stdlib/rubygems/command.rb:323:in `invoke_with_build_args'
    /opt/jruby/lib/ruby/stdlib/rubygems/command_manager.rb:185:in `process_args'
    /opt/jruby/lib/ruby/stdlib/rubygems/command_manager.rb:149:in `run'
    /opt/jruby/lib/ruby/stdlib/rubygems/gem_runner.rb:51:in `run'
    /opt/jruby/bin/jgem:21:in `<main>'
    org/jruby/RubyKernel.java:1223:in `load'
    /opt/jruby/bin/gem:4:in `<main>'

Something I noticed in Sinatra CI

cc @byroot

byroot commented 1 day ago

Hard to tell because releases aren't tagged, but I think it was solved in https://github.com/jruby/ruby-maven/commit/85717266781b0a02e1053dd1b95d58e5c492ce1d

dentarg commented 1 day ago

Latest available ruby-maven release is 3.3.13 January 24, 2022 (10 KB) https://rubygems.org/gems/ruby-maven/versions and that commit is from Sep 1 so probably not fixed in anything released

Not sure how to test that pre-release

$ docker run -it --rm jruby:9.4.9.0 bash
root@899a8c81af91:/# gem install ruby-maven -v 3.9.0.pre1
Fetching ruby-maven-libs-3.9.9.gem
Fetching ruby-maven-3.9.0.pre1.gem
Successfully installed ruby-maven-libs-3.9.9
Successfully installed ruby-maven-3.9.0.pre1
2 gems installed
root@899a8c81af91:/# gem list ruby-maven

*** LOCAL GEMS ***

ruby-maven (3.9.0.pre1)
ruby-maven-libs (3.9.9)
root@899a8c81af91:/# export RUBYOPT="--enable-frozen-string-literal --debug-frozen-string-literal"
root@899a8c81af91:/# gem install psych
Fetching psych-5.2.0-java.gem
  jar dependencies for psych-5.2.0-java.gemspec . . .
Installing gem 'ruby-maven' . . .
Fetching ruby-maven-3.3.13.gem
Fetching ruby-maven-libs-3.3.9.gem
Successfully installed ruby-maven-libs-3.3.9
Successfully installed ruby-maven-3.3.13

using maven for the first time results in maven
downloading all its default plugin and can take time.
as those plugins get cached on disk and further execution
of maven is much faster then the first time.

ERROR:  While executing gem ... (FrozenError)
    can't modify frozen String, created at /usr/local/bundle/gems/ruby-maven-3.3.13/lib/ruby_maven.rb:25
...

https://rubygems.org/gems/psych/versions/5.2.0-java depends on https://rubygems.org/gems/jar-dependencies that depends on https://rubygems.org/gems/ruby-maven ~> 3.3.11

byroot commented 1 day ago

Yeah, probably just need a release. FYI: @headius

headius commented 22 hours ago

@dentarg We're working on it... I'll try to get it released by Monday.