[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Segfault when unsetting READLINE_LINE inside 'bind -x'
From: |
Chet Ramey |
Subject: |
Re: Segfault when unsetting READLINE_LINE inside 'bind -x' |
Date: |
Sun, 23 Apr 2017 13:34:26 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 |
On 4/23/17 12:14 PM, Eduardo Bustamante wrote:
> I tried the following patch:
>
> dualbus@debian:~/src/gnu/bash$ git diff -- bashline.c
> diff --git a/bashline.c b/bashline.c
> index 129714aa..7884416a 100644
> --- a/bashline.c
> +++ b/bashline.c
> @@ -2545,7 +2545,7 @@ static void
> maybe_make_readline_line (new_line)
> char *new_line;
> {
> - if (strcmp (new_line, rl_line_buffer) != 0)
> + if (new_line && strcmp (new_line, rl_line_buffer) != 0)
> {
> rl_point = rl_end;
>
> Which gets rid of the null pointer deference, but it seems to leave
> the terminal in a bad state, so the patch is not complete and I have
> no clue why.
It's a good fix, and it doesn't do anything to the terminal. Your return
key doesn't work any more since you've rebound ^M, but that's intentional.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/