diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-10-16 02:41:22 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-10-16 02:41:22 +0000 |
commit | 23e29a6d7320ae178a663196cf8e91ceae15a4aa (patch) | |
tree | 0c0621f5e14e3e7dc7aaf47c38fa3662ec77cff4 /app-shells | |
parent | move all config touchups into one patch (diff) | |
download | historical-23e29a6d7320ae178a663196cf8e91ceae15a4aa.tar.gz historical-23e29a6d7320ae178a663196cf8e91ceae15a4aa.tar.bz2 historical-23e29a6d7320ae178a663196cf8e91ceae15a4aa.zip |
grab patches from Debian/SuSe
Diffstat (limited to 'app-shells')
-rw-r--r-- | app-shells/bash/files/bash-3.0-histtimeformat.patch | 54 | ||||
-rw-r--r-- | app-shells/bash/files/bash-3.0-locale.patch | 110 | ||||
-rw-r--r-- | app-shells/bash/files/bash-3.0-multibyteifs.patch | 281 | ||||
-rw-r--r-- | app-shells/bash/files/bash-3.0-rl-display.patch | 185 | ||||
-rw-r--r-- | app-shells/bash/files/bash-3.0-rl-self-insert.patch | 79 |
5 files changed, 709 insertions, 0 deletions
diff --git a/app-shells/bash/files/bash-3.0-histtimeformat.patch b/app-shells/bash/files/bash-3.0-histtimeformat.patch new file mode 100644 index 000000000000..84a375dcc9c7 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-histtimeformat.patch @@ -0,0 +1,54 @@ +Ripped from Debian + +From: Enrique Perez-Terron <enrio@online.no> +To: bug-bash@gnu.org +Subject: When using HISTTIMEFORMAT, the date and the command are run + together. +Date: Sun, 01 Aug 2004 18:36:45 +0200 + +Configuration Information [Automatically generated, do not change]: +Machine: i586 +OS: linux-gnu +Compiler: gcc +Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i586' +-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-pc-linux-gnu' +-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' +-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib +-g -O2 +uname output: Linux arabia.home.lan 2.6.6-1.435.2.3 #1 Thu Jul 1 +09:11:28 EDT 2004 i586 i586 i386 GNU/Linux +Machine Type: i586-pc-linux-gnu + +# DP: Add space separating the time and the command in the +# DP: output from the history builtin command. + +Bash Version: 3.0 +Patch Level: 0 +Release Status: release + +Description: + There is no space separating the time and the command in the + output from the history builtin command. + +Repeat-By: + $ export HISTTIMEFORMAT=_A_format_string_ + $ history 3 + 997 _A_format_string_echo $BASH_VERSION + 998 _A_format_string_export HISTTIMEFORMAT=_A_format_string_ + 999 _A_format_string_history 3 + +Fix: +--- ./builtins/history.def.orig 2003-12-20 00:02:09.000000000 +0100 ++++ ./builtins/history.def 2004-08-01 18:18:02.652720102 +0200 +@@ -287,9 +287,10 @@ + QUIT; + + timestr = (histtimefmt && *histtimefmt) ? histtime (hlist[i], histtimefmt) : (char *)NULL; +- printf ("%5d%c %s%s\n", i + history_base, ++ printf ("%5d%c %s%s%s\n", i + history_base, + histdata(i) ? '*' : ' ', + ((timestr && *timestr) ? timestr : ""), ++ ((timestr && *timestr) ? " " : ""), + histline(i)); + i++; + } diff --git a/app-shells/bash/files/bash-3.0-locale.patch b/app-shells/bash/files/bash-3.0-locale.patch new file mode 100644 index 000000000000..ddec753740c3 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-locale.patch @@ -0,0 +1,110 @@ +Ripped from SuSe + +From: schwab@suse.de +To: bug-bash@gnu.org +Subject: HISTTIMEFORMAT doesn't track locale changes +Date: Sun, 1 Aug 2004 11:14:00 +0200 (CEST) + +Configuration Information [Automatically generated, do not change]: +Machine: ia64 +OS: linux-gnu +Compiler: gcc +Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='ia64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='ia64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash-3.0 -I../bash-3.0/include -I../bash-3.0/lib -O2 -g +uname output: Linux sykes 2.6.5-22-default #1 SMP Fri Jul 2 13:43:23 UTC 2004 ia64 ia64 ia64 GNU/Linux +Machine Type: ia64-unknown-linux-gnu + +Bash Version: 3.0 +Patch Level: 0 +Release Status: release + +Description: +Bash doesn't use the current locale when formatting HISTTIMEFORMAT. + +Repeat-By: +sykes:/tmp/bash/Build/:[0]$ locale +LANG=de_DE.UTF-8 +LC_CTYPE="de_DE.UTF-8" +LC_NUMERIC=POSIX +LC_TIME=POSIX +LC_COLLATE=POSIX +LC_MONETARY="de_DE.UTF-8" +LC_MESSAGES=en_US.UTF-8 +LC_PAPER="de_DE.UTF-8" +LC_NAME="de_DE.UTF-8" +LC_ADDRESS="de_DE.UTF-8" +LC_TELEPHONE="de_DE.UTF-8" +LC_MEASUREMENT="de_DE.UTF-8" +LC_IDENTIFICATION="de_DE.UTF-8" +LC_ALL= +sykes:/tmp/bash/Build/:[0]$ history 1 + 1502 history 1 +sykes:/tmp/bash/Build/:[0]$ HISTTIMEFORMAT=%c +sykes:/tmp/bash/Build/:[0]$ history 1 + 1504 Sun Aug 1 10:56:59 2004history 1 +sykes:/tmp/bash/Build/:[0]$ export LC_TIME=$LANG +sykes:/tmp/bash/Build/:[0]$ history 1 + 1506 Sun Aug 1 10:57:24 2004history 1 + +--- bash-3.0/locale.c ++++ bash-3.0/locale.c +@@ -71,9 +71,10 @@ set_default_locale () + textdomain (PACKAGE); + } + +-/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES and LC_NUMERIC +- if they are not specified in the environment, but LC_ALL is. This +- should be called from main() after parsing the environment. */ ++/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_NUMERIC ++ and LC_TIME if they are not specified in the environment, but LC_ALL ++ is. This should be called from main() after parsing the ++ environment. */ + void + set_default_locale_vars () + { +@@ -109,6 +110,12 @@ set_default_locale_vars () + setlocale (LC_NUMERIC, lc_all); + # endif /* LC_NUMERIC */ + ++# if defined (LC_TIME) ++ val = get_string_value ("LC_TIME"); ++ if (val == 0 && lc_all && *lc_all) ++ setlocale (LC_TIME, lc_all); ++# endif /* LC_TIME */ ++ + #endif /* HAVE_SETLOCALE */ + + val = get_string_value ("TEXTDOMAIN"); +@@ -213,6 +220,13 @@ set_locale_var (var, value) + return (setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC")) != 0); + # endif /* LC_NUMERIC */ + } ++ else if (var[3] == 'T' && var[4] == 'I') /* LC_TIME */ ++ { ++# if defined (LC_TIME) ++ if (lc_all == 0 || *lc_all == '\0') ++ return (setlocale (LC_TIME, get_locale_var ("LC_TIME")) != 0); ++# endif /* LC_TIME */ ++ } + #endif /* HAVE_SETLOCALE */ + + return (0); +@@ -285,6 +299,9 @@ reset_locale_vars () + # if defined (LC_NUMERIC) + setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC")); + # endif ++# if defined (LC_TIME) ++ setlocale (LC_TIME, get_locale_var ("LC_TIME")); ++# endif + + locale_setblanks (); + +--- bash-3.0/variables.c ++++ bash-3.0/variables.c +@@ -3646,6 +3646,7 @@ static struct name_and_function special_ + { "LC_CTYPE", sv_locale }, + { "LC_MESSAGES", sv_locale }, + { "LC_NUMERIC", sv_locale }, ++ { "LC_TIME", sv_locale }, + + { "MAIL", sv_mail }, + { "MAILCHECK", sv_mail }, diff --git a/app-shells/bash/files/bash-3.0-multibyteifs.patch b/app-shells/bash/files/bash-3.0-multibyteifs.patch new file mode 100644 index 000000000000..1e74832b638a --- /dev/null +++ b/app-shells/bash/files/bash-3.0-multibyteifs.patch @@ -0,0 +1,281 @@ +From: Tim Waugh <twaugh@redhat.com> +To: bug-bash@gnu.org +Subject: [patch] multibyte IFS values +Date: Tue, 24 Aug 2004 13:34:59 +0100 + +Hi, + +Here is a patch to address these problems: + +http://lists.gnu.org/archive/html/bug-bash/2004-07/msg00294.html +http://lists.gnu.org/archive/html/bug-bash/2004-07/msg00296.html + +It works well for me at least. + +Tim. + +--- bash-3.0/subst.c.multibyteifs 2004-08-20 15:22:48.366497771 +0100 ++++ bash-3.0/subst.c 2004-08-20 18:13:30.833624616 +0100 +@@ -124,7 +124,12 @@ + SHELL_VAR *ifs_var; + char *ifs_value; + unsigned char ifs_cmap[UCHAR_MAX + 1]; ++#if defined (HANDLE_MULTIBYTE) ++unsigned char ifs_firstc[MB_LEN_MAX]; ++size_t ifs_firstc_len; ++#else + unsigned char ifs_firstc; ++#endif + + /* Extern functions and variables from different files. */ + extern int last_command_exit_value, last_command_exit_signal; +@@ -862,8 +867,14 @@ + char *charlist; + { + register int i = *sindex; ++ size_t slen; ++#if defined (HANDLE_MULTIBYTE) ++ size_t clen; ++ wchar_t *wcharlist = NULL; ++#endif + int c; + char *temp; ++ DECLARE_MBSTATE; + + if (charlist[0] == '\'' && charlist[1] == '\0') + { +@@ -872,18 +883,65 @@ + return temp; + } + +- for (i = *sindex; c = string[i]; i++) ++ slen = strlen (string + *sindex) + *sindex; ++ i = *sindex; ++#if defined (HANDLE_MULTIBYTE) ++ clen = strlen (charlist); ++#endif ++ while ((c = string[i])) + { ++#if defined (HANDLE_MULTIBYTE) ++ size_t mblength; ++#endif ++ + if (c == CTLESC) + { +- i++; ++ i += 2; + continue; + } + ++#if defined (HANDLE_MULTIBYTE) ++ mblength = mblen (string + i, slen - i); ++ if (mblength > 1) ++ { ++ wchar_t wc; ++ size_t mblength = mbtowc (&wc, string + i, slen - i); ++ if (MB_INVALIDCH (mblength)) ++ { ++ if (MEMBER (c, charlist)) ++ break; ++ } ++ else ++ { ++ if (!wcharlist) ++ { ++ size_t len = mbstowcs (wcharlist, charlist, 0); ++ if (len == -1) ++ len = 0; ++ wcharlist = xmalloc (sizeof (wchar_t) * (len + 1)); ++ mbstowcs (wcharlist, charlist, 1 + len); ++ } ++ ++ if (wcschr (wcharlist, wc)) ++ { ++ break; ++ } ++ } ++ } ++ else ++#endif ++ + if (MEMBER (c, charlist)) + break; ++ ++ ADVANCE_CHAR (string, slen, i); + } + ++#if defined (HANDLE_MULTIBYTE) ++ if (wcharlist) ++ free (wcharlist); ++#endif ++ + temp = substring (string, *sindex, i); + *sindex = i; + +@@ -1456,11 +1514,36 @@ + d2 = 0; + if (delims) + { +- d2 = (char *)xmalloc (strlen (delims) + 1); +- for (i = ts = 0; delims[i]; i++) ++ size_t slength = strlen (delims); ++#if defined (HANDLE_MULTIBYTE) ++ size_t mblength = 1; ++ DECLARE_MBSTATE; ++#endif ++ ++ d2 = (char *)xmalloc (slength + 1); ++ i = ts = 0; ++ while (delims[i]) + { ++#if defined (HANDLE_MULTIBYTE) ++ mbstate_t state_bak = state; ++ mblength = mbrlen (delims + i, slength, &state); ++ ++ if (MB_INVALIDCH (mblength)) ++ state = state_bak; ++ else if (mblength != 1) ++ { ++ memcpy (d2 + ts, delims + i, mblength); ++ ts += mblength; ++ i += mblength; ++ slength -= mblength; ++ continue; ++ } ++#endif ++ + if (whitespace(delims[i]) == 0) + d2[ts++] = delims[i]; ++ i++; ++ slength--; + } + d2[ts] = '\0'; + } +@@ -1654,10 +1737,19 @@ + string_list_dollar_star (list) + WORD_LIST *list; + { ++#if defined (HANDLE_MULTIBYTE) ++ char sep[MB_CUR_MAX + 1]; ++#else + char sep[2]; ++#endif + ++#if defined (HANDLE_MULTIBYTE) ++ memcpy (sep, ifs_firstc, ifs_firstc_len); ++ sep[ifs_firstc_len] = '\0'; ++#else + sep[0] = ifs_firstc; + sep[1] = '\0'; ++#endif + + return (string_list_internal (list, sep)); + } +@@ -1676,14 +1768,41 @@ + WORD_LIST *list; + int quoted; + { +- char *ifs, sep[2]; ++ char *ifs; ++#if defined (HANDLE_MULTIBYTE) ++ char sep[MB_CUR_MAX + 1]; ++#else ++ char sep[2]; ++#endif + WORD_LIST *tlist; + + /* XXX this could just be ifs = ifs_value; */ + ifs = ifs_var ? value_cell (ifs_var) : (char *)0; + ++#if defined (HANDLE_MULTIBYTE) ++ if (ifs && *ifs) ++ { ++ size_t mblength = mblen (ifs, strnlen (ifs, MB_CUR_MAX)); ++ if (MB_INVALIDCH (mblength)) ++ { ++ sep[0] = *ifs; ++ sep[1] = '\0'; ++ } ++ else ++ { ++ memcpy (sep, ifs, mblength); ++ sep[mblength] = '\0'; ++ } ++ } ++ else ++ { ++ sep[0] = ' '; ++ sep[1] = '\0'; ++ } ++#else + sep[0] = (ifs == 0 || *ifs == 0) ? ' ' : *ifs; + sep[1] = '\0'; ++#endif + + tlist = ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (ifs && *ifs == 0)) + ? quote_list (list) +@@ -1732,6 +1851,7 @@ + WORD_DESC *t; + char *current_word, *s; + int sindex, sh_style_split, whitesep; ++ size_t slen = 0; + + if (!string || !*string) + return ((WORD_LIST *)NULL); +@@ -1805,7 +1925,12 @@ + + /* Move past the current separator character. */ + if (string[sindex]) +- sindex++; ++ { ++ DECLARE_MBSTATE; ++ if (!slen) ++ slen = strlen (string); ++ ADVANCE_CHAR (string, slen, sindex); ++ } + + /* Now skip sequences of space, tab, or newline characters if they are + in the list of separators. */ +@@ -6796,7 +6921,27 @@ + ifs_cmap[uc] = 1; + } + ++#if defined (HANDLE_MULTIBYTE) ++ if (!ifs_value) ++ { ++ ifs_firstc[0] = '\0'; ++ ifs_firstc_len = 1; ++ } ++ else ++ { ++ size_t ifs_len = strnlen (ifs_value, MB_CUR_MAX); ++ ifs_firstc_len = mblen (ifs_value, ifs_len); ++ if (MB_INVALIDCH (ifs_firstc_len)) ++ { ++ ifs_firstc[0] = '\0'; ++ ifs_firstc_len = 1; ++ } ++ else ++ memcpy (ifs_firstc, ifs_value, ifs_firstc_len); ++ } ++#else + ifs_firstc = ifs_value ? *ifs_value : 0; ++#endif + } + + char * +--- bash-3.0/subst.h.multibyteifs 2004-08-20 15:51:08.301074583 +0100 ++++ bash-3.0/subst.h 2004-08-20 15:51:39.070206473 +0100 +@@ -231,7 +231,12 @@ + extern SHELL_VAR *ifs_var; + extern char *ifs_value; + extern unsigned char ifs_cmap[]; ++#if defined (HANDLE_MULTIBYTE) ++extern unsigned char ifs_firstc[]; ++extern size_t ifs_firstc_len; ++#else + extern unsigned char ifs_firstc; ++#endif + + /* Evaluates to 1 if C is a character in $IFS. */ + #define isifs(c) (ifs_cmap[(unsigned char)(c)] != 0) diff --git a/app-shells/bash/files/bash-3.0-rl-display.patch b/app-shells/bash/files/bash-3.0-rl-display.patch new file mode 100644 index 000000000000..77e0f33456b7 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-rl-display.patch @@ -0,0 +1,185 @@ +Ripped from Debian + +# DP: Fix bug utilising the ``reverse-search-history'' feature of the readline +# DP: library, if the search string matches a previously entered command (ie +# DP: history) and must overflow the current screen width. + +From: Chet Ramey <chet@caleb.ins.cwru.edu> +To: doko@cs.tu-berlin.de +Cc: chet@po.cwru.edu +Subject: Re: Bug#288940: bash-3.0 segfault in readline when Control-R'ing long lines (forwarded from epl@unimelb.edu.au) +Date: Tue, 11 Jan 2005 15:25:15 -0500 + +> Chet Ramey writes: +> > > Package: bash +> > > Version: 3.0-12 +> > > Severity: normal +> > > Tags: sid +> > > +> > > I have found a bug where Debian unstable's bash-3.0 will segfault when +> > > utilising the ``reverse-search-history'' feature of the readline library. +> > > In particular, the search string must match a previously entered command +> > > (ie history) and must overflow the current screen width. +> > +> > Thanks, I fixed this one. +> +> as this is a segfault, could you provide the patch? + +The changes in display.c are extensive enough that it is a fairly large patch. +Here are the essentials. I will more than likely not be releasing this as an +official patch. + +Chet + +*** ../bash-3.0-patched/lib/readline/display.c Wed Sep 8 11:07:51 2004 +--- lib/readline/display.c Sat Jan 8 21:51:40 2005 +*************** +*** 181,184 **** +--- 186,201 ---- + static int prompt_physical_chars; + ++ /* Variables to save and restore prompt and display information. */ ++ ++ /* These are getting numerous enough that it's time to create a struct. */ ++ ++ static char *saved_local_prompt; ++ static char *saved_local_prefix; ++ static int saved_last_invisible; ++ static int saved_visible_length; ++ static int saved_prefix_length; ++ static int saved_invis_chars_first_line; ++ static int saved_physical_chars; ++ + /* Expand the prompt string S and return the number of visible + characters in *LP, if LP is not null. This is currently more-or-less +*************** +*** 1797,1803 **** + return ((ISPRINT (uc)) ? 1 : 2); + } +- + /* How to print things in the "echo-area". The prompt is treated as a + mini-modeline. */ + + #if defined (USE_VARARGS) +--- 1825,1831 ---- + return ((ISPRINT (uc)) ? 1 : 2); + } + /* How to print things in the "echo-area". The prompt is treated as a + mini-modeline. */ ++ static int msg_saved_prompt = 0; + + #if defined (USE_VARARGS) +*************** +*** 1830,1835 **** +--- 1858,1874 ---- + va_end (args); + ++ if (saved_local_prompt == 0) ++ { ++ rl_save_prompt (); ++ msg_saved_prompt = 1; ++ } + rl_display_prompt = msg_buf; ++ local_prompt = expand_prompt (msg_buf, &prompt_visible_length, ++ &prompt_last_invisible, ++ &prompt_invis_chars_first_line, ++ &prompt_physical_chars); ++ local_prompt_prefix = (char *)NULL; + (*rl_redisplay_function) (); ++ + return 0; + } +*************** +*** 1841,1846 **** +--- 1880,1897 ---- + sprintf (msg_buf, format, arg1, arg2); + msg_buf[sizeof(msg_buf) - 1] = '\0'; /* overflow? */ ++ + rl_display_prompt = msg_buf; ++ if (saved_local_prompt == 0) ++ { ++ rl_save_prompt (); ++ msg_saved_prompt = 1; ++ } ++ local_prompt = expand_prompt (msg_buf, &prompt_visible_length, ++ &prompt_last_invisible, ++ &prompt_invis_chars_first_line, ++ &prompt_physical_chars); ++ local_prompt_prefix = (char *)NULL; + (*rl_redisplay_function) (); ++ + return 0; + } +*************** +*** 1852,1855 **** +--- 1903,1911 ---- + { + rl_display_prompt = rl_prompt; ++ if (msg_saved_prompt) ++ { ++ rl_restore_prompt (); ++ msg_saved_prompt = 0; ++ } + (*rl_redisplay_function) (); + return 0; +*************** +*** 1866,1878 **** + } + +- /* These are getting numerous enough that it's time to create a struct. */ +- +- static char *saved_local_prompt; +- static char *saved_local_prefix; +- static int saved_last_invisible; +- static int saved_visible_length; +- static int saved_invis_chars_first_line; +- static int saved_physical_chars; +- + void + rl_save_prompt () +--- 1922,1925 ---- +*************** +*** 1880,1883 **** +--- 1927,1931 ---- + saved_local_prompt = local_prompt; + saved_local_prefix = local_prompt_prefix; ++ saved_prefix_length = prompt_prefix_length; + saved_last_invisible = prompt_last_invisible; + saved_visible_length = prompt_visible_length; +*************** +*** 1886,1890 **** + + local_prompt = local_prompt_prefix = (char *)0; +! prompt_last_invisible = prompt_visible_length = 0; + prompt_invis_chars_first_line = prompt_physical_chars = 0; + } +--- 1934,1938 ---- + + local_prompt = local_prompt_prefix = (char *)0; +! prompt_last_invisible = prompt_visible_length = prompt_prefix_length = 0; + prompt_invis_chars_first_line = prompt_physical_chars = 0; + } +*************** +*** 1898,1905 **** +--- 1946,1959 ---- + local_prompt = saved_local_prompt; + local_prompt_prefix = saved_local_prefix; ++ prompt_prefix_length = saved_prefix_length; + prompt_last_invisible = saved_last_invisible; + prompt_visible_length = saved_visible_length; + prompt_invis_chars_first_line = saved_invis_chars_first_line; + prompt_physical_chars = saved_physical_chars; ++ ++ /* can test saved_local_prompt to see if prompt info has been saved. */ ++ saved_local_prompt = saved_local_prefix = (char *)0; ++ saved_last_invisible = saved_visible_length = saved_prefix_length = 0; ++ saved_invis_chars_first_line = saved_physical_chars = 0; + } + + + +-- +``The lyf so short, the craft so long to lerne.'' - Chaucer +( ``Discere est Dolere'' -- chet ) + Live...Laugh...Love +Chet Ramey, ITS, CWRU chet@po.cwru.edu http://tiswww.tis.cwru.edu/~chet/ diff --git a/app-shells/bash/files/bash-3.0-rl-self-insert.patch b/app-shells/bash/files/bash-3.0-rl-self-insert.patch new file mode 100644 index 000000000000..778935edaa63 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-rl-self-insert.patch @@ -0,0 +1,79 @@ +Ripped from Debian + +# DP: Fix readline self-insert command + +From: Thomas Glanzmann <sithglan@stud.uni-erlangen.de> +To: Debian Bug Tracking System <submit@bugs.debian.org> +Subject: Bug#290103: readline provided with bash: self-insert doesn't work correctly +Date: Wed, 12 Jan 2005 20:35:17 +0100 + +Package: bash3 +Version: 3.0-10 +Severity: normal +Tags: patch + +Hello, +having the following in .inputrc: + +$if Bash + ",2": " 2>&1" + ",n": " 2>/dev/null" + ",t": "/var/tmp/sithglan/" + ",b": "/opt/build/thomas/" + ",": self-insert +$endif + +should expand ,2 to " 2>&1" but , still to ','. This isn't the case and +I asked bash maintainer Chet Ramey to fix it and he did it. :-) The +following patch will ship with the next version of bash. + +> > That is a bug in the released version of readline-5.0. Shadow keymaps +> > are implemented by using an extra character. When a `shadowed' key +> > (the `,' in your case) is bound to self-insert, the 5.0 code was +> > trying to insert the extra character (256) rather than the `,'. + +*** bash-20050106.orig/lib/readline/readline.c Fri Oct 15 14:36:55 2004 +--- bash/lib/readline/readline.c Sat Jan 8 23:51:44 2005 +*************** +*** 657,665 **** + the input queue with _rl_unget_char. */ + { +- #if 0 +- r = _rl_dispatch (ANYOTHERKEY, FUNCTION_TO_KEYMAP (map, key)); +- #else +- /* XXX - experimental code -- might never be executed. Save +- for later. */ + Keymap m = FUNCTION_TO_KEYMAP (map, key); + int type = m[ANYOTHERKEY].type; +--- 657,660 ---- +*************** +*** 667,673 **** + if (type == ISFUNC && func == rl_do_lowercase_version) + r = _rl_dispatch (_rl_to_lower (key), map); + else + r = _rl_dispatch (ANYOTHERKEY, m); +- #endif + } + else if (r && map[ANYOTHERKEY].function) +--- 662,681 ---- + if (type == ISFUNC && func == rl_do_lowercase_version) + r = _rl_dispatch (_rl_to_lower (key), map); ++ else if (type == ISFUNC && func == rl_insert) ++ { ++ /* If the function that was shadowed was self-insert, we ++ somehow need a keymap with map[key].func == self-insert. ++ Let's use this one. */ ++ int nt = m[key].type; ++ rl_command_func_t *nf = m[key].function; ++ ++ m[key].type = type; ++ m[key].function = func; ++ r = _rl_dispatch (key, m); ++ m[key].type = nt; ++ m[key].function = nf; ++ } + else + r = _rl_dispatch (ANYOTHERKEY, m); + } + else if (r && map[ANYOTHERKEY].function) + |