From: "yahonda (Yasuo Honda) via ruby-core" Date: 2026-11-13T23:01:49+00:00 Subject: [ruby-core:127476] [Ruby Bug#22547] `String.new("", encoding: Encoding::CESU_8)` fails the STR_EMBEDDABLE_P assertion “too big termlen: 6” on debug builds Issue #22547 has been reported by yahonda (Yasuo Honda). ---------------------------------------- Bug #22547: `String.new("", encoding: Encoding::CESU_8)` fails the STR_EMBEDDABLE_P assertion ���too big termlen: 6��� on debug builds https://bugs.ruby-lang.org/issues/22547 * Author: yahonda (Yasuo Honda) * Status: Open * ruby -v: ruby 4.1.0dev (2026-11-13T22:58:20Z HEAD 346d1f63b7) +PRISM [x86_64-linux] * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- 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: ```ruby s = String.new("", encoding: Encoding::CESU_8) puts "OK #{s.encoding}" ``` ## 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-------------------------------- rails-nightly_build_4922_activesupport-master-debug.log.zip (73.7 KB) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/