readline: updated to 5.1

This commit is contained in:
Simone Rota 2006-02-23 18:12:46 +00:00
parent 411b6640ce
commit 27dd68d96d
5 changed files with 86 additions and 237 deletions

View File

@ -14,12 +14,12 @@ drwxr-xr-x root/root usr/include/readline/
drwxr-xr-x root/root usr/lib/
-rw-r--r-- root/root usr/lib/libhistory.a
lrwxrwxrwx root/root usr/lib/libhistory.so -> libhistory.so.5
lrwxrwxrwx root/root usr/lib/libhistory.so.5 -> libhistory.so.5.0
-rw-r--r-- root/root usr/lib/libhistory.so.5.0
lrwxrwxrwx root/root usr/lib/libhistory.so.5 -> libhistory.so.5.1
-rw-r--r-- root/root usr/lib/libhistory.so.5.1
-rw-r--r-- root/root usr/lib/libreadline.a
lrwxrwxrwx root/root usr/lib/libreadline.so -> libreadline.so.5
lrwxrwxrwx root/root usr/lib/libreadline.so.5 -> libreadline.so.5.0
-rw-r--r-- root/root usr/lib/libreadline.so.5.0
lrwxrwxrwx root/root usr/lib/libreadline.so.5 -> libreadline.so.5.1
-rw-r--r-- root/root usr/lib/libreadline.so.5.1
drwxr-xr-x root/root usr/man/
drwxr-xr-x root/root usr/man/man3/
-rw-r--r-- root/root usr/man/man3/history.3.gz

View File

@ -1,3 +1,3 @@
75f2132b58ad2f0013671ee45c4b3bac inputrc
273afa2a448097fe1aafdabb785fcd00 readline-5.0-001-005.patch
9a39d15f1ed592883f8c6671e8c13120 readline-5.0.tar.gz
63faf622820ca0828131c8b5aeac1e6a readline-5.1-001.patch
7ee5a692db88b30ca48927a13fd60e46 readline-5.1.tar.gz

View File

@ -3,14 +3,14 @@
# Maintainer: Per Lidén <per@fukt.bth.se>
name=readline
version=5.0
version=5.1
release=1
source=(http://mirrors.sunsite.dk/gnu/$name/$name-$version.tar.gz \
$name-$version-001-005.patch inputrc)
$name-$version-001.patch inputrc)
build() {
cd $name-$version
patch -p1 < ../$name-$version-001-005.patch
patch -p0 < ../$name-$version-001.patch
./configure --prefix=/usr
make
make DESTDIR=$PKG install

View File

@ -1,228 +0,0 @@
Patches 001-005 from ftp://ftp.cwru.edu/pub/bash/readline-5.0-patches/
Rediffed to apply cleanly on the vanilla 5.0 source.
/Per Liden <per@fukt.bth.se>
diff -Nru readline-5.0/display.c readline-5.0-new/display.c
--- readline-5.0/display.c 2004-05-28 04:57:51.000000000 +0200
+++ readline-5.0-new/display.c 2005-02-02 23:48:35.174892936 +0100
@@ -201,7 +201,7 @@
int *lp, *lip, *niflp, *vlp;
{
char *r, *ret, *p;
- int l, rl, last, ignoring, ninvis, invfl, ind, pind, physchars;
+ int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars;
/* Short-circuit if we can. */
if ((MB_CUR_MAX <= 1 || rl_byte_oriented) && strchr (pmt, RL_PROMPT_START_IGNORE) == 0)
@@ -222,6 +222,7 @@
r = ret = (char *)xmalloc (l + 1);
invfl = 0; /* invisible chars in first line of prompt */
+ invflset = 0; /* we only want to set invfl once */
for (rl = ignoring = last = ninvis = physchars = 0, p = pmt; p && *p; p++)
{
@@ -249,7 +250,10 @@
while (l--)
*r++ = *p++;
if (!ignoring)
- rl += ind - pind;
+ {
+ rl += ind - pind;
+ physchars += _rl_col_width (pmt, pind, ind);
+ }
else
ninvis += ind - pind;
p--; /* compensate for later increment */
@@ -259,16 +263,19 @@
{
*r++ = *p;
if (!ignoring)
- rl++; /* visible length byte counter */
+ {
+ rl++; /* visible length byte counter */
+ physchars++;
+ }
else
ninvis++; /* invisible chars byte counter */
}
- if (rl >= _rl_screenwidth)
- invfl = ninvis;
-
- if (ignoring == 0)
- physchars++;
+ if (invflset == 0 && rl >= _rl_screenwidth)
+ {
+ invfl = ninvis;
+ invflset = 1;
+ }
}
}
@@ -351,14 +358,14 @@
local_prompt = expand_prompt (p, &prompt_visible_length,
&prompt_last_invisible,
(int *)NULL,
- (int *)NULL);
+ &prompt_physical_chars);
c = *t; *t = '\0';
/* The portion of the prompt string up to and including the
final newline is now null-terminated. */
local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length,
(int *)NULL,
&prompt_invis_chars_first_line,
- &prompt_physical_chars);
+ (int *)NULL);
*t = c;
return (prompt_prefix_length);
}
@@ -417,7 +424,7 @@
register int in, out, c, linenum, cursor_linenum;
register char *line;
int c_pos, inv_botlin, lb_botlin, lb_linenum;
- int newlines, lpos, temp, modmark;
+ int newlines, lpos, temp, modmark, n0, num;
char *prompt_this_line;
#if defined (HANDLE_MULTIBYTE)
wchar_t wc;
@@ -573,6 +580,7 @@
#if defined (HANDLE_MULTIBYTE)
memset (_rl_wrapped_line, 0, vis_lbsize);
+ num = 0;
#endif
/* prompt_invis_chars_first_line is the number of invisible characters in
@@ -591,13 +599,32 @@
probably too much work for the benefit gained. How many people have
prompts that exceed two physical lines?
Additional logic fix from Edward Catmur <ed@catmur.co.uk> */
+#if defined (HANDLE_MULTIBYTE)
+ n0 = num;
+ temp = local_prompt ? strlen (local_prompt) : 0;
+ while (num < temp)
+ {
+ if (_rl_col_width (local_prompt, n0, num) > _rl_screenwidth)
+ {
+ num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
+ break;
+ }
+ num++;
+ }
+ temp = num +
+#else
temp = ((newlines + 1) * _rl_screenwidth) +
+#endif /* !HANDLE_MULTIBYTE */
((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
: ((newlines == 1) ? wrap_offset : 0))
: ((newlines == 0) ? wrap_offset :0));
inv_lbreaks[++newlines] = temp;
+#if defined (HANDLE_MULTIBYTE)
+ lpos -= _rl_col_width (local_prompt, n0, num);
+#else
lpos -= _rl_screenwidth;
+#endif
}
prompt_last_screen_line = newlines;
diff -Nru readline-5.0/mbutil.c readline-5.0-new/mbutil.c
--- readline-5.0/mbutil.c 2004-01-14 15:44:52.000000000 +0100
+++ readline-5.0-new/mbutil.c 2005-02-02 23:48:36.670665544 +0100
@@ -126,11 +126,11 @@
if (find_non_zero)
{
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
- while (wcwidth (wc) == 0)
+ while (tmp > 0 && wcwidth (wc) == 0)
{
point += tmp;
tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
- if (tmp == (size_t)(0) || tmp == (size_t)(-1) || tmp == (size_t)(-2))
+ if (MB_NULLWCH (tmp) || MB_INVALIDCH (tmp))
break;
}
}
diff -Nru readline-5.0/misc.c readline-5.0-new/misc.c
--- readline-5.0/misc.c 2004-07-07 14:56:32.000000000 +0200
+++ readline-5.0-new/misc.c 2005-02-02 23:48:33.790103456 +0100
@@ -276,12 +276,6 @@
_rl_saved_line_for_history->line = savestring (rl_line_buffer);
_rl_saved_line_for_history->data = (char *)rl_undo_list;
}
- else if (STREQ (rl_line_buffer, _rl_saved_line_for_history->line) == 0)
- {
- free (_rl_saved_line_for_history->line);
- _rl_saved_line_for_history->line = savestring (rl_line_buffer);
- _rl_saved_line_for_history->data = (char *)rl_undo_list; /* XXX possible memleak */
- }
return 0;
}
diff -Nru readline-5.0/vi_mode.c readline-5.0-new/vi_mode.c
--- readline-5.0/vi_mode.c 2004-07-13 20:08:27.000000000 +0200
+++ readline-5.0-new/vi_mode.c 2005-02-02 23:48:35.948775288 +0100
@@ -272,10 +272,12 @@
switch (key)
{
case '?':
+ _rl_free_saved_history_line ();
rl_noninc_forward_search (count, key);
break;
case '/':
+ _rl_free_saved_history_line ();
rl_noninc_reverse_search (count, key);
break;
@@ -690,7 +692,7 @@
{
wchar_t wc;
char mb[MB_LEN_MAX+1];
- int mblen;
+ int mblen, p;
mbstate_t ps;
memset (&ps, 0, sizeof (mbstate_t));
@@ -713,11 +715,14 @@
/* Vi is kind of strange here. */
if (wc)
{
+ p = rl_point;
mblen = wcrtomb (mb, wc, &ps);
if (mblen >= 0)
mb[mblen] = '\0';
rl_begin_undo_group ();
- rl_delete (1, 0);
+ rl_vi_delete (1, 0);
+ if (rl_point < p) /* Did we retreat at EOL? */
+ rl_point++; /* XXX - should we advance more than 1 for mbchar? */
rl_insert_text (mb);
rl_end_undo_group ();
rl_vi_check ();
@@ -1310,12 +1315,16 @@
rl_vi_delete (1, c);
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
- while (_rl_insert_char (1, c))
- {
- RL_SETSTATE (RL_STATE_MOREINPUT);
- c = rl_read_key ();
- RL_UNSETSTATE (RL_STATE_MOREINPUT);
- }
+ {
+ if (rl_point < p) /* Did we retreat at EOL? */
+ rl_point++;
+ while (_rl_insert_char (1, c))
+ {
+ RL_SETSTATE (RL_STATE_MOREINPUT);
+ c = rl_read_key ();
+ RL_UNSETSTATE (RL_STATE_MOREINPUT);
+ }
+ }
else
#endif
{

View File

@ -0,0 +1,77 @@
READLINE PATCH REPORT
=====================
Readline-Release: 5.1
Patch-ID: readline51-001
Bug-Reported-by: Andreas Schwab <schwab@suse.de>
Bug-Reference-ID: <20051213141916.4014A394BFABD@sykes.suse.de>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2005-12/msg00038.html
Bug-Description:
A problem with the readline callback interface can result in segmentation
faults when using the delete-char function via a multiple-key sequence.
Two consecutive calls to delete-char will crash the application calling
readline.
Patch:
*** ../readline-5.1/readline.c Mon Jul 4 22:29:35 2005
--- readline.c Tue Dec 20 17:38:29 2005
***************
*** 715,719 ****
rl_dispatching = 1;
RL_SETSTATE(RL_STATE_DISPATCHING);
! r = (*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
RL_UNSETSTATE(RL_STATE_DISPATCHING);
rl_dispatching = 0;
--- 715,719 ----
rl_dispatching = 1;
RL_SETSTATE(RL_STATE_DISPATCHING);
! (*map[key].function)(rl_numeric_arg * rl_arg_sign, key);
RL_UNSETSTATE(RL_STATE_DISPATCHING);
rl_dispatching = 0;
*** ../readline-5.1/text.c Sat Sep 24 19:06:07 2005
--- text.c Tue Dec 20 17:38:26 2005
***************
*** 1072,1077 ****
int count, key;
{
- int r;
-
if (count < 0)
return (_rl_rubout_char (-count, key));
--- 1072,1075 ----
***************
*** 1091,1097 ****
rl_forward_byte (count, key);
! r = rl_kill_text (orig_point, rl_point);
rl_point = orig_point;
- return r;
}
else
--- 1089,1094 ----
rl_forward_byte (count, key);
! rl_kill_text (orig_point, rl_point);
rl_point = orig_point;
}
else
***************
*** 1100,1105 ****
new_point = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
! return (rl_delete_text (rl_point, new_point));
}
}
--- 1097,1103 ----
new_point = MB_NEXTCHAR (rl_line_buffer, rl_point, 1, MB_FIND_NONZERO);
! rl_delete_text (rl_point, new_point);
}
+ return 0;
}