From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28001 invoked by alias); 26 Jan 2004 21:41:33 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 27990 invoked from network); 26 Jan 2004 21:41:31 -0000 Received: from unknown (HELO localhost.redhat.com) (66.30.197.194) by sources.redhat.com with SMTP; 26 Jan 2004 21:41:31 -0000 Received: by localhost.redhat.com (Postfix, from userid 469) id D51D61A440D; Mon, 26 Jan 2004 16:39:05 -0500 (EST) From: Elena Zannoni MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16405.35065.687607.660623@localhost.redhat.com> Date: Mon, 26 Jan 2004 21:41:00 -0000 To: gdb-patches@sources.redhat.com Subject: [PATCH] synchronize readline w/ official patches X-SW-Source: 2004-01/txt/msg00675.txt.bz2 There is a set of official patches to readline which are not all in our version. I have merged the patches. The changelog entries are a bit unorthodox but I wanted to leave a clear trail, to facilitate the next full readline import (easier to check whether those are in readline 4.4). One of the patches was merged by Michael, so I added some info to his changelog entry. tested on i686-linux-gnu. I'll wait for a couple of days before checking them in, in case somebody wants to retest. elena 2004-01-26 Elena Zannoni Merge in official patches to readline-4.3 from ftp://ftp.cwru.edu/pub/bash/readline-4.3-patches: NOTE: Patch-ID readline-43-004 was already applied (see below). * bind.c (rl_generic_bind): Pressing certain key sequences causes an infinite loop in _rl_dispatch_subseq with the `key' argument set to 256. This eventually causes bash to exceed the stack size limit and crash with a segmentation violation. Patch-ID: readline43-001. * readline.c (_rl_dispatch_subseq): Repeating an edit in vi-mode with `.' does not work. Patch-ID: readline43-002. * mbutil.c (_rl_get_char_len, _rl_compare_chars, _rl_adjust_point): When in a locale with multibyte characters, the readline display updater will occasionally cause a segmentation fault when attempting to compute the length of the first multibyte character on the line. Patch-ID: readline43-003. * vi_mode.c (_rl_vi_change_mbchar_case): Using the vi editing mode's case-changing commands in a locale with multibyte characters will cause garbage characters to be inserted into the editing buffer. Patch-ID: readline43-005. 2003-01-09 Michael Chastain From Chet Ramey, , the readline maintainer: + ftp://ftp.cwru.edu/pub/bash/readline-4.3-patches/readline43-004 + * display.c: Fix perverse screen refresh with UTF-8. + When running in a locale with multibyte characters, the + readline display updater will use carriage returns when + drawing the line, overwriting any partial output already on + the screen and not terminated by a newline. + Patch-ID: readline43-004 2003-01-08 Chris Demetriou Index: bind.c =================================================================== RCS file: /cvs/src/src/readline/bind.c,v retrieving revision 1.5 diff -u -p -r1.5 bind.c --- bind.c 8 Dec 2002 22:31:37 -0000 1.5 +++ bind.c 26 Jan 2004 21:34:47 -0000 @@ -311,7 +311,7 @@ rl_generic_bind (type, keyseq, data, map mapped to something, `abc' to be mapped to something else, and the function bound to `a' to be executed when the user types `abx', leaving `bx' in the input queue. */ - if (k.function /* && k.type == ISFUNC */) + if (k.function && ((k.type == ISFUNC && k.function != rl_do_lowercase_version) || k.type == ISMACR)) { map[ANYOTHERKEY] = k; k.function = 0; Index: mbutil.c =================================================================== RCS file: /cvs/src/src/readline/mbutil.c,v retrieving revision 1.3 diff -u -p -r1.3 mbutil.c --- mbutil.c 8 Dec 2002 22:31:37 -0000 1.3 +++ mbutil.c 26 Jan 2004 21:34:48 -0000 @@ -205,14 +205,16 @@ _rl_get_char_len (src, ps) if (tmp == (size_t)(-2)) { /* shorted to compose multibyte char */ - memset (ps, 0, sizeof(mbstate_t)); + if (ps) + memset (ps, 0, sizeof(mbstate_t)); return -2; } else if (tmp == (size_t)(-1)) { /* invalid to compose multibyte char */ /* initialize the conversion state */ - memset (ps, 0, sizeof(mbstate_t)); + if (ps) + memset (ps, 0, sizeof(mbstate_t)); return -1; } else if (tmp == (size_t)0) @@ -225,9 +227,12 @@ _rl_get_char_len (src, ps) return 1. Otherwise return 0. */ int _rl_compare_chars (buf1, pos1, ps1, buf2, pos2, ps2) - char *buf1, *buf2; - mbstate_t *ps1, *ps2; - int pos1, pos2; + char *buf1; + int pos1; + mbstate_t *ps1; + char *buf2; + int pos2; + mbstate_t *ps2; { int i, w1, w2; @@ -276,8 +281,11 @@ _rl_adjust_point(string, point, ps) pos++; /* clear the state of the byte sequence, because in this case effect of mbstate is undefined */ - memset (ps, 0, sizeof (mbstate_t)); + if (ps) + memset (ps, 0, sizeof (mbstate_t)); } + else if (tmp == 0) + pos++; else pos += tmp; } Index: readline.c =================================================================== RCS file: /cvs/src/src/readline/readline.c,v retrieving revision 1.6 diff -u -p -r1.6 readline.c --- readline.c 30 Dec 2003 07:25:18 -0000 1.6 +++ readline.c 26 Jan 2004 21:34:49 -0000 @@ -684,6 +684,7 @@ _rl_dispatch_subseq (key, map, got_subse } #if defined (VI_MODE) if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap && + key != ANYOTHERKEY && _rl_vi_textmod_command (key)) _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign); #endif Index: vi_mode.c =================================================================== RCS file: /cvs/src/src/readline/vi_mode.c,v retrieving revision 1.4 diff -u -p -r1.4 vi_mode.c --- vi_mode.c 8 Dec 2002 22:31:37 -0000 1.4 +++ vi_mode.c 26 Jan 2004 21:34:50 -0000 @@ -680,7 +680,8 @@ _rl_vi_change_mbchar_case (count) int count; { wchar_t wc; - char mb[MB_LEN_MAX]; + char mb[MB_LEN_MAX+1]; + int mblen; mbstate_t ps; memset (&ps, 0, sizeof (mbstate_t)); @@ -703,7 +704,9 @@ _rl_vi_change_mbchar_case (count) /* Vi is kind of strange here. */ if (wc) { - wctomb (mb, wc); + mblen = wctomb (mb, wc); + if (mblen >= 0) + mb[mblen] = '\0'; rl_begin_undo_group (); rl_delete (1, 0); rl_insert_text (mb);