Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Regexp generated from unescaped input in #expand_class

Aperta
#1,845 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@jaynetics ci sta già lavorando.

Dal 10/10/2026.

  • #1846 di @jaynetics — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
ruby
Ambito
cli

Direzione di ricerca

The unescaped input is interpolated into a regexp in #expand_class in lib/rdoc/ri/driver.rb, near line 972, and #expand_name (around line 998) calls it. Other regexps in that file escape their input, so compare with those. Pull request #1846 is already open against this issue, so review it before starting. Done means $\ no longer triggers the 'has ']' without escape' warning in tab completion, and the input is escaped the same way as elsewhere in driver.rb.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

It happens here:

https://github.com/ruby/rdoc/blob/929a03646a2df1057570e8ab070e1f2016da5505/lib/rdoc/ri/driver.rb#L972

For example, when typing $ into IRB and then hitting tab to go through the autocomplete suggestions, this prints the following warning once $\ is reached.

rdoc/ri/driver.rb:972: warning: regular expression has ']' without escape: /\A$\[^:]*\z/
Image

Backtrace:

rdoc-8.1.0/lib/rdoc/ri/driver.rb:998:in 'RDoc::RI::Driver#expand_name'
irb-1.18.0/lib/irb/input-method.rb:410:in 'IRB::RelineInputMethod#rdoc_dialog_contents'
irb-1.18.0/lib/irb/input-method.rb:378:in 'block in IRB::RelineInputMethod#show_doc_dialog_proc'

This happens because $\ is embedded unescaped into the regexp, generating /\A$\[...].../.

Perhaps a crafty actor could even inject a Regexp that times out or raises a RegexpError.

All other regexps generated in driver.rb use escaped input, so I assume it is just an oversight in this case.

Lingua principale
Ruby
Stelle
927
Fork
467
Merge medio
23h 47m
PR unite (30g)
12

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ruby/rdoc

Tutte le issue di ruby/rdoc

Issue simili

Altre issue su Ruby

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.