On 8/10/16 11:42 AM, Christian Klomp wrote:
> I found a problem with the binding of key sequences to macros that
> results in bash allocating all the memory until the process is killed.
> It happens when a key is mapped to itself, e.g., `bind '"3":"3"'`. Now
> when '3' is typed the while loop inside the readline_internal_charloop
> function will never end.
Yes, you've triggered an infinite loop with the key binding. One of the
strengths of macros is that the expansion is not simply a string -- it can
be used as shorthand for a complex key sequence, so simply disallowing
the general case is not really an option. I don't think anyone is going
to deliberately bind a key to itself, so I'm not sure putting code in to
solve that specific case, while leaving the general case unsolved, is
Maybe the thing to do is to abort at some maximum macro nesting level, sort
of like bash does with $FUNCNEST.
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/