Infinite loop when REGEX also matches subst
thieman opened this issue · 1 comments
fastmod 0.2.6 on OS X
Create a file with the word "bacon" in it
Run the following:
fastmod 'ac' 'bacon'
Expected result: Substitution is processed once, changing the text to bbaconon
Actual result: Substitution is processed infinitely. If you select "Yes to all" you are treated to a very trippy experience in your terminal as fastmod
expands the string as quickly as it can.
I'm not sure whether it's a welcome comparison, but codemod 'ac' 'bacon'
produces the desired result, only processing the match once.
codemod 'ac' 'bacon' produces the desired result, only processing the match once
I believe codemod -m 'ac' 'bacon'
has the same problem.
I talked about this issue in my comment on #3 :
Our current policy is to act as though the user pressed y repeatedly. There is an infinite loop bug with A on master for both codemod and fastmod...
The problem there is that the replacement matches the search pattern, so we continually replace our own replacement (and grow it).
It looks like I wrote that comment but never got around to implementing the unified advancement policy. I'll open a new issue to implement the unified advancement policy from that comment.