# \[Bug #1969\] irb will be stuck with long variable name with completion.rb

**URL:** <https://www.ruby-forum.com/t/bug-1969-irb-will-be-stuck-with-long-variable-name-with-completion-rb/174098>\
**Category:** Development\
**Created:** [August 20, 2009, 7:56pm UTC](https://www.ruby-forum.com/t/bug-1969-irb-will-be-stuck-with-long-variable-name-with-completion-rb/174098 "2009-08-20T19:56:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yoshimasa\_Niwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ecb155/32.png) [@Yoshimasa\_Niwa](https://www.ruby-forum.com/u/Yoshimasa_Niwa)\
**Post date:** [August 20, 2009, 7:56pm UTC](https://www.ruby-forum.com/t/bug-1969-irb-will-be-stuck-with-long-variable-name-with-completion-rb/174098/1 "2009-08-20T19:56:40Z")

</div>

Bug #1969: irb will be stuck with long variable name with completion.rb  
[http://redmine.ruby-lang.org/issues/show/1969](http://redmine.ruby-lang.org/issues/show/1969)

e$B5/I\<\<Te(B: Yoshimasa Niwa  
e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Normal  
ruby -v: ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9]

Requiring “irb/completion”, we then hit Tab after a long variable name,  
irb will be stuck.

% irb  
irb(main):001:0\> require ‘irb/completion’  
=\> true  
irb(main):002:0\> a.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[Hit Tab key]  
(Nothing happen, just eating CPU)  
irb(main):002:0\> :🅰:BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB[Hit Tab key]  
(Nothing happen, just eating CPU)

I attached the patches to fix this issue.  
This issue seems to be caused by a problem of longest matching of  
regular expressions.  
These patches are based on Haruo N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)’s good  
suggestions.

irbe$B$Ge(Birb/completione$B$,e(Brequiree$B$5$l$F$$$k$H$-$K!“D9$$JQ?tL\>!”%/%i%9L\>$N8e$Ge(BTabe$B$r2!$9$H8G$^$j$^$9!#e(B  
e$B@55,I=8=$N:GD90lCW$NLdBj$H;W$o$l$^$9!#e(B  
e$BFnLZ$5$se(B[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)e$B$N;XE&$r$b$H$K:n@.$7$?%Q%C%A$rE:IU$7$^$9$N$G$43NG’$/$@$5$$!#e(B

---

<div class="post-metadata">

**Author:** ![Yoshimasa\_Niwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ecb155/32.png) [@Yoshimasa\_Niwa](https://www.ruby-forum.com/u/Yoshimasa_Niwa)\
**Post date:** [April 8, 2010, 4:17pm UTC](https://www.ruby-forum.com/t/bug-1969-irb-will-be-stuck-with-long-variable-name-with-completion-rb/174098/2 "2010-04-08T16:17:52Z")

</div>

e$B%A%1%C%He(B #1969 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$BC4Ev\<Te(B Keiju Ishitsukae$B$K%;%C%He(B

e$B1sF#$G$9!#e(B

2009e$BG/e(B8e$B7ne(B21e$BF|e(B2:56 Yoshimasa Niwa  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> I attached the patches to fix this issue.  
> This issue seems to be caused by a problem of longest matching of regular expressions.  
> These patches are based on Haruo N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)’s good suggestions.
> 
> irbe$B$Ge(Birb/completione$B$,e(Brequiree$B$5$l$F$$$k$H$-$K!“D9$$JQ?tL\>!”%/%i%9L\>$N8e$Ge(BTabe$B$r2!$9$H8G$^$j$^$9!#e(B  
> e$B@55,I=8=$N:GD90lCW$NLdBj$H;W$o$l$^$9!#e(B  
> e$BFnLZ$5$se(B[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)e$B$N;XE&$r$b$H$K:n@.$7$?%Q%C%A$rE:IU$7$^$9$N$G$43NG’$/$@$5$$!#e(B

e$BCY$$H?1~$G$9$\_$^$;$s!#e(B

e$B:F8=$7$^$7$?!#D:$$$?%Q%C%A$O$?$V$sLdBj$J$$$H;W$$$^$9!#e(B  
e$B$$$7$D$+$5$s!"\<h$j9~$s$G$$$$$G$7$g$&$+!#e(B

# (.?[^.]+)+ e$B$Oe(B .+ e$B$HF1CM$J5$$b$7$^$9$,e(B

## – Yusuke E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

[http://redmine.ruby-lang.org/issues/show/1969](http://redmine.ruby-lang.org/issues/show/1969)

---

<div class="post-metadata">

**Author:** ![Yoshimasa\_Niwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ecb155/32.png) [@Yoshimasa\_Niwa](https://www.ruby-forum.com/u/Yoshimasa_Niwa)\
**Post date:** [April 9, 2010, 2:32pm UTC](https://www.ruby-forum.com/t/bug-1969-irb-will-be-stuck-with-long-variable-name-with-completion-rb/174098/3 "2010-04-09T14:32:00Z")

</div>

e$B$1$$$8$e!w$$$7$D$+$G$9e(B.

In [ruby-dev:40935] the message: “[ruby-dev:40935] [Bug #1969] irb  
will be stuck with long variable name with completion.rb”, on Apr/08  
23:17(JST) Yusuke E. writes:

> # (.?[^.]+)+ e$B$Oe(B .+ e$B$HF1CM$J5$$b$7$^$9$,e(B

e$B$&!\<$`e(B.  
e$B$d$j$?$+$C$?$3$H$r;W$$=P$7$F$b$&0lEY@55,I=8=$r=q$-49$($^$7$?e(B.  
e$B$3$l$Ge(B, e$B$?$V$sBg\>fIW$G$O$J$$$+$He(B…

e$B$=$l$He(B, [ruby-core:28366] e$B$N%3%\_%C%H$G$9$,e(B,  
e$B1i;;;R$NM%@hEY$r9M$($k$H4Ve(B  
e$B0c$C$F$$$^$9$N$Ge(B, e$B$=$C$A$bD\>$7$F$\*$-$^$7$?e(B.

\_\_  
----------------------------------------------------\>\> e$B@PDMe(B  
e$B7=\<ye(B \<\<—  
----------------------------------\>\> e-mail: removed\_email\_address@domain.invalid \<\<—

---

<div class="post-metadata">

**Author:** ![Yoshimasa\_Niwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ecb155/32.png) [@Yoshimasa\_Niwa](https://www.ruby-forum.com/u/Yoshimasa_Niwa)\
**Post date:** [April 9, 2010, 2:41pm UTC](https://www.ruby-forum.com/t/bug-1969-irb-will-be-stuck-with-long-variable-name-with-completion-rb/174098/4 "2010-04-09T14:41:57Z")

</div>

e$B1sF#$G$9!#e(B

2010e$BG/e(B4e$B7ne(B9e$BF|e(B21:31 e$B@PDM7=\<ye(B  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > # (.?[^.]+)+ e$B$Oe(B .+ e$B$HF1CM$J5$$b$7$^$9$,e(B
> 
> e$B$&!\<$`e(B. e$B$d$j$?$+$C$?$3$H$r;W$$=P$7$F$b$&0lEY@55,I=8=$r=q$-49$($^$7$?e(B.  
> e$B$3$l$Ge(B, e$B$?$V$sBg\>fIW$G$O$J$$$+$He(B…

e$B$_$_!“$?$V$sBg\>fIW$=$&$K8+$($^$9!#$”$j$,$H$&$4$6$$$^$9!#e(B

> e$B$=$l$He(B, [ruby-core:28366] e$B$N%3%\_%C%H$G$9$,e(B, e$B1i;;;R$NM%@hEY$r9M$($k$H4Ve(B  
> e$B0c$C$F$$$^$9$N$Ge(B, e$B$=$C$A$bD\>$7$F$\*$-$^$7$?e(B.

e$B$“$j$c!”\<:Ni$7$^$7$?!#$"$j$,$H$&$4$6$$$^$9!#e(B

---

<div class="post-metadata">

**Author:** ![Yoshimasa\_Niwa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ecb155/32.png) [@Yoshimasa\_Niwa](https://www.ruby-forum.com/u/Yoshimasa_Niwa)\
**Post date:** [April 16, 2010, 3:36pm UTC](https://www.ruby-forum.com/t/bug-1969-irb-will-be-stuck-with-long-variable-name-with-completion-rb/174098/5 "2010-04-16T15:36:47Z")

</div>

e$B%A%1%C%He(B #1969 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%9%F!\<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B

e$B1sF#$G$9!#e(B

r27271 e$B$G=$@5$7$F$$$?$@$-$^$7$?!#e(B

## – Yusuke E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

[http://redmine.ruby-lang.org/issues/show/1969](http://redmine.ruby-lang.org/issues/show/1969)
