Actions
Bug #22547
closed`String.new("", encoding: Encoding::CESU_8)` fails the STR_EMBEDDABLE_P assertion “too big termlen: 6” on debug builds
Bug #22547:
`String.new("", encoding: Encoding::CESU_8)` fails the STR_EMBEDDABLE_P assertion “too big termlen: 6” on debug builds
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 4.1.0dev (2026-11-13T22:58:20Z HEAD 346d1f63b7) +PRISM [x86_64-linux]
Description
The Rails nightly CI against Ruby master (debug build) started aborting in Active Support with Assertion Failed: STR_EMBEDDABLE_P:termlen <= 4: too big termlen: 6. It bisects to 346d1f63b7 ("Ignore negative capacity", https://github.com/ruby/ruby/pull/19887).
https://buildkite.com/rails/rails-nightly/builds/4922#01a1d6b6-024b-49f3-95b6-6afe9c6328e8/L2134
The full log of that Active Support job is attached (rails-nightly_build_4922_activesupport-master-debug.log.zip).
It can be reproduced with a single Active Support test:
cd activesupport && bin/test test/transliterate_test.rb -n test_transliterate_handles_strings_with_incompatible_encodings
Steps to reproduce¶
Build Ruby with cppflags=-DRUBY_DEBUG=1, then:
Expected behavior¶
$ ruby -v
ruby 4.1.0dev (2026-11-13T22:47:35Z HEAD 293c4f9246) +PRISM [x86_64-linux]
$ ruby rep.rb
OK CESU-8
Actual behavior¶
$ ruby -v
ruby 4.1.0dev (2026-11-13T22:58:20Z HEAD 346d1f63b7) +PRISM [x86_64-linux]
$ ruby rep.rb
string.c:281: Assertion Failed: STR_EMBEDDABLE_P:termlen <= 4: too big termlen: 6
ruby 4.1.0dev (2026-11-13T22:58:20Z HEAD 346d1f63b7) +PRISM [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0002 p:0016 s:0011 E:002280 l:n b:---- r:(nil) EVAL rep.rb:1 [FINISH]
c:0001 p:0000 s:0003 E:000f38 l:y b:---- r:(nil) DUMMY [FINISH]
Files
Actions