[Top][All Lists]

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

Re: core dump an alt. alt1 alt.

From: Chet Ramey
Subject: Re: core dump an alt. alt1 alt.
Date: Tue, 9 Jun 2020 11:46:22 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.9.0

On 6/9/20 5:19 AM, Mike Jonkmans wrote:
> On Mon, Jun 08, 2020 at 08:43:31PM -0400, Chet Ramey wrote:
>> On 6/8/20 6:54 PM, bashbug@jonkmans.nl wrote:
>>> Bash Version: 4.4
>>> Patch Level: 20
>>> Release Status: release
>>> Description:
>>>     Got a core dump (segmentation fault) when i type: Alt-. Alt-1 Alt-.
>> You tried to redo `.'. The way this happens is you are in command mode,
>> run that yank-last-arg binding (which sets the last vi-mode command to
>> `.'), then try to run it again, but miss the timeout described in the last
>> paragraph of my previous message, which results in you trying to redo the
>> last command (`.') in a context where the binding for `.' is vi-redo. I put
>> something in to stop that at the same time I made the other changes
>> described in my previous message.
> The problem from the previous message was the trigger to try this. :)

I figured.

> Are you sure that it is a timeout problem in this case?
> Because if I prepend the followong line to the inputrc:
>       set keyseq-timeout 0
> the core dump is also generated.

It's the same phenomenon. Redoing `.' is what triggers it, but there are
a couple of issues here.

In vi-mode, without the changes I made, the yank-last-arg puts you into
insert mode (like the vi-mode `_' command). The `.' is the last command

> It seems i enter command mode after I press Alt-1.

You do. This all presumes that the Alt is converted into ESC by the
terminal. The ESC puts you into command mode, and the 1 starts a digit
argument. Here's what I think happens:

> The following Alt-. probably gets split into Alt(Escape) and a '.'
> The Escape breaks off the Alt-1 'mode' and then the '.' becomes vi-redo.
> But I fail to see why the vi-redo is bound to vi-redo here. :(

That's where it's ambiguous. You have two key sequences, both bound to
commands, one of which (ESC) is a prefix of the other (ESC-.). If you
set the keyboard timeout to 0, it takes the ESC as a separate key
sequence, which is unbound in vi command mode, and reads the `.', which
is bound to vi-redo. The last command in vi mode was `.', which vi-redo
attempts to redo given the current keymap, which has it bound to vi-redo,
and off you go.

It may also do this because the ESC gets pushed back on the input stream
after breaking out of the digit loop, but I kind of doubt that.

In any event, I believe the changes in the next devel branch push should
fix these.


``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

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