Bug #22065
closed`make rdoc` fails with `invalid byte sequence in US-ASCII` on Ruby 4.0.4 under C locale
Description
Building Ruby 4.0.4 in an environment where Encoding.default_external is US-ASCII (e.g. a Docker container with LC_ALL=C) fails while documenting object.c:
(ArgumentError) invalid byte sequence in US-ASCII
.bundle/gems/rdoc-7.0.3/lib/rdoc/parser/c.rb:575:in 'String#scan'
from .../parser/c.rb:600:in 'RDoc::Parser::C#find_body'
from .../parser/c.rb:1025:in 'RDoc::Parser::C#handle_method'
https://github.com/ruby/all-ruby/actions/runs/25707463525/job/75480556963#step:5:1816
4.0.3 is not affected.
The trigger is 2b22593ac1 (backport of master a2531ba293), which introduced two U+2192 → characters in class.c comments. RDoc couldn't parse that.
master branch is unaffected because the RDoc-side bug was fixed in ruby/rdoc#1657 (commit 911b122a) and pulled into Ruby master via 3f75e99961. The bump was not backported to ruby_4_0, which still ships RDoc 7.0.3.
Workaround: build with LC_ALL=C.UTF-8 or use --disable-install-doc option.
Four resolutions are under discussion with @k0kubun (Takashi Kokubun)
- replace
→with->inclass.cand backport it. - bump the bundled RDoc to 7.2.0 in Ruby 4.0.5
- Release RDoc 7.0.4 containing
911b122aand then bump in Ruby 4.0.5 - Treat the C locale or build option as a user-side configuration issue and document the workaround.
Updated by k0kubun (Takashi Kokubun) about 18 hours ago
- Status changed from Open to Closed
Updated by k0kubun (Takashi Kokubun) about 18 hours ago
- Backport changed from 3.3: DONTNEED, 3.4: DONTNEED, 4.0: REQUIRED to 3.3: DONTNEED, 3.4: DONTNEED, 4.0: DONE
ruby_4_0 4e54008562e2e87d1c63f79e4a51d7089403bc35.