ruby / ruby/syntax_suggest

SyntaxSuggest 3.0.0 leaks raw invalid bytes into stderr when source has invalid encoding

Open
#258 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
350
Forks
17
Avg merge
48m
Merged PRs (30d)
5

Description

Since 3.0.0 removed CleanDocument#clean_sweep, sources that contain bytes invalid in their encoding are no longer rejected internally — the raw bytes end up in the annotation. Previously clean_sweep raised ArgumentError and the rescue in core_ext.rb produced a clean fallback.

Under LC_ALL=C, captured error output becomes a US-ASCII string with invalid bytes — any regex match on it raises ArgumentError: invalid byte sequence in US-ASCII. This broke spec/ruby/language/source_encoding_spec.rb on three Ruby CI platforms:

I added workaround for this at https://github.com/ruby/ruby/commit/f45bb9ba36cff72eff1bf0c0817a023843a1be34

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing invalid-encoding handling around CleanDocument#clean_sweep and the rescue in core_ext.rb. Reproduce the issue under LC_ALL=C with a source containing invalid bytes, then inspect spec/ruby/language/source_encoding_spec.rb and the linked Ruby CI failures. Done means raw invalid bytes no longer reach the annotation or captured stderr and the affected encoding behavior is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.