ruby/psych

Error installing gem 3.1.0 with JRuby 9.0.5.0

castwide opened this issue · 2 comments

Running bundle install in JRuby 9.0.5.0 with a dependency on psych 3.1.0 causes an error can't modify frozen String. It works with JRuby 9.1.16.0. I don't know if the problem stems from psych, JRuby, or Travis CI, but figured I'd check here first.

Relevant log from the Travis job:

$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies......
Fetching ast 2.4.0
Installing ast 2.4.0
Fetching backport 1.0.0
Installing backport 1.0.0
Using bundler 1.17.3
Fetching coderay 1.1.2
Installing coderay 1.1.2
Fetching diff-lcs 1.3
Installing diff-lcs 1.3
Fetching docile 1.3.1
Installing docile 1.3.1
Fetching ffi 1.10.0 (java)
Installing ffi 1.10.0 (java)
Fetching htmlentities 4.3.4
Installing htmlentities 4.3.4
Fetching jar-dependencies 0.4.0
Installing jar-dependencies 0.4.0
Fetching jaro_winkler 1.5.2 (java)
Installing jaro_winkler 1.5.2 (java)
Fetching json 2.2.0 (java)
Installing json 2.2.0 (java)
Fetching kramdown 1.17.0
Installing kramdown 1.17.0
Fetching method_source 0.9.2
Installing method_source 0.9.2
Fetching nokogiri 1.9.1 (java)
Installing nokogiri 1.9.1 (java)
Fetching parallel 1.13.0
Installing parallel 1.13.0
Fetching parser 2.6.0.0
Installing parser 2.6.0.0
Fetching powerpack 0.1.2
Installing powerpack 0.1.2
Fetching spoon 0.0.6
Installing spoon 0.0.6
Fetching pry 0.11.3 (java)
Installing pry 0.11.3 (java)
Fetching psych 3.1.0 (java)
Installing psych 3.1.0 (java)
  jar dependencies for psych-3.1.0-java.gemspec . . .
Installing gem 'ruby-maven' . . .
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.
RuntimeError: can't modify frozen string
          sub! at org/jruby/RubyString.java:2817
    other_deps at file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl/gemspec.rb:142
          each at org/jruby/RubyArray.java:1613
    other_deps at file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl/gemspec.rb:141
       process at file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl/gemspec.rb:126
       process at /home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl/project_gemspec.rb:68
    initialize at file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl/gemspec.rb:43
       gemspec at file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl.rb:365
      eval_pom at /home/travis/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/jars/gemspec_pom.rb:13
          call at org/jruby/RubyProc.java:271
  nested_block at file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl.rb:1371
         tesla at file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl.rb:20
      eval_pom at /home/travis/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/jars/gemspec_pom.rb:1
          eval at org/jruby/RubyKernel.java:1111
      eval_pom at file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl.rb:67
         parse at parser.rb:80
[ERROR] Internal error: org.jruby.embed.InvokeFailedException: (RuntimeError) can't modify frozen string -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: org.jruby.embed.InvokeFailedException: (RuntimeError) can't modify frozen string
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:121)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.jruby.embed.InvokeFailedException: (RuntimeError) can't modify frozen string
	at org.jruby.embed.internal.EmbedRubyObjectAdapterImpl.call(EmbedRubyObjectAdapterImpl.java:317)
	at org.jruby.embed.internal.EmbedRubyObjectAdapterImpl.callMethod(EmbedRubyObjectAdapterImpl.java:169)
	at org.jruby.embed.ScriptingContainer.callMethod(ScriptingContainer.java:1509)
	at org.sonatype.maven.polyglot.ruby.RubyParser.parse(RubyParser.java:62)
	at org.sonatype.maven.polyglot.ruby.RubyModelReader.read(RubyModelReader.java:56)
	at org.sonatype.maven.polyglot.TeslaModelProcessor.read(TeslaModelProcessor.java:143)
	at org.sonatype.maven.polyglot.TeslaModelProcessor.read(TeslaModelProcessor.java:95)
	at org.apache.maven.model.building.DefaultModelBuilder.readModel(DefaultModelBuilder.java:529)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:269)
	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:469)
	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:438)
	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:401)
	at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419)
	at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410)
	at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83)
	at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	... 11 more
Caused by: org.jruby.exceptions.RaiseException: (RuntimeError) can't modify frozen string
	at org.jruby.RubyString.sub!(org/jruby/RubyString.java:2817)
	at RUBY.other_deps(file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl/gemspec.rb:142)
	at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)
	at RUBY.other_deps(file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl/gemspec.rb:141)
	at RUBY.process(file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl/gemspec.rb:126)
	at RUBY.process(/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl/project_gemspec.rb:68)
	at RUBY.initialize(file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl/gemspec.rb:43)
	at RUBY.gemspec(file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl.rb:365)
	at RUBY.eval_pom(/home/travis/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/jars/gemspec_pom.rb:13)
	at org.jruby.RubyProc.call(org/jruby/RubyProc.java:271)
	at RUBY.nested_block(file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl.rb:1371)
	at RUBY.tesla(file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl.rb:20)
	at RUBY.eval_pom(/home/travis/.rvm/rubies/jruby-9.0.5.0/lib/ruby/stdlib/jars/gemspec_pom.rb:1)
	at org.jruby.RubyKernel.eval(org/jruby/RubyKernel.java:1111)
	at RUBY.eval_pom(file:/home/travis/.m2/repository/io/takari/polyglot/polyglot-ruby/0.1.11/polyglot-ruby-0.1.11.jar!/maven/tools/dsl.rb:67)
	at RUBY.parse(parser.rb:80)
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorException
Errno::ENOENT: No such file or directory -
/home/travis/.rvm/gems/jruby-9.0.5.0/gems/psych-3.1.0-java/deps.lst
An error occurred while installing psych (3.1.0), and Bundler
cannot continue.
Make sure that `gem install psych -v '3.1.0' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
  solargraph was resolved to 0.31.3, which depends on
    rubocop was resolved to 0.65.0, which depends on
      psych
The command "bundle install" failed and exited with 5 during .
Your build has been stopped.
kares commented

the problem here is with polyglot-ruby - version 0.1.11 quite ancient
... you should just drop 9.0 support and mostly care about 9.2 (and maybe 9.1.17 for compatibility).

Updating the supported versions works for me. Thanks for the reply.