bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash bind bug: infinite loop with memory leak in Readline


From: Christian Klomp
Subject: Re: Bash bind bug: infinite loop with memory leak in Readline
Date: Thu, 22 Sep 2016 17:23:02 +0200

2016-09-19 3:41 GMT+02:00 Chet Ramey <address@hidden>:
> 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
> worthwhile.
>
> Maybe the thing to do is to abort at some maximum macro nesting level, sort
> of like bash does with $FUNCNEST.
>

Yes, I agree that my code is too generic and the case a bit
far-fetched. There indeed appear to be more issues. For instance
binding "loop" to "looper" will also trigger it. Still quite unlikely
but more in the direction of something a user might expect to work.

Limiting the nesting level sounds like a straightforward solution.
Although I'm not sure whether exposing a configurable level is
necessary. Do people actually nest their macros that deep that no
reasonably safe upper bound can be set?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]