Skip to content

(master) frozen string errors with --debug #7924

@flavorjones

Description

@flavorjones

Environment Information

Using jruby HEAD:

$ bin/jruby -v
jruby 9.4.4.0-SNAPSHOT (3.1.4) 2023-06-18 656f9d6570 OpenJDK 64-Bit Server VM 11.0.20.1+1-post-Ubuntu-0ubuntu122.04 on 11.0.20.1+1-post-Ubuntu-0ubuntu122.04 [x86_64-linux]

$ uname -a
Linux juno 6.2.0-1011-lowlatency #11~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Aug 16 16:22:57 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Reproduction

File foo.rb:

# frozen_string_literal: true

puts RUBY_DESCRIPTION

s = +"hello"
puts s.frozen?
s.force_encoding(::Encoding::ASCII_8BIT)

When run with bin/jruby foo.rb:

jruby 9.4.4.0-SNAPSHOT (3.1.4) 2023-06-18 656f9d6570 OpenJDK 64-Bit Server VM 11.0.20.1+1-post-Ubuntu-0ubuntu122.04 on 11.0.20.1+1-post-Ubuntu-0ubuntu122.04 [x86_64-linux]
false

When run with bin/jruby --debug foo.rb

jruby 9.4.4.0-SNAPSHOT (3.1.4) 2023-06-18 656f9d6570 OpenJDK 64-Bit Server VM 11.0.20.1+1-post-Ubuntu-0ubuntu122.04 on 11.0.20.1+1-post-Ubuntu-0ubuntu122.04 [x86_64-linux]
false
FrozenError: can't modify frozen String, created at foo.rb:5
  force_encoding at org/jruby/RubyString.java:6663
  force_encoding at org/jruby/RubyString.java:6659
          <main> at foo.rb:7

This error does not occur with jruby-9.4.2.0.

This was discovered by upstream nokogiri integration testing: https://github.com/sparklemotion/nokogiri/actions/runs/6076083505/job/16483500598

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions