Manually apply upstream patches

This commit is contained in:
zhouganqing 2022-06-15 17:22:24 +08:00
parent 6f6bf13212
commit 3605c7f117
34 changed files with 219 additions and 1444 deletions

View File

@ -428,7 +428,7 @@ get_y_or_n (for_pager)
return (1); return (1);
if (c == 'n' || c == 'N' || c == RUBOUT) if (c == 'n' || c == 'N' || c == RUBOUT)
return (0); return (0);
if (c == ABORT_CHAR) if (c == ABORT_CHAR || c < 0)
_rl_abort_internal (); _rl_abort_internal ();
if (for_pager && (c == NEWLINE || c == RETURN)) if (for_pager && (c == NEWLINE || c == RETURN))
return (2); return (2);

2
configure vendored
View File

@ -1938,7 +1938,7 @@ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
# If not cross compiling, check that we can run a simple program. # If not cross compiling, check that we can run a simple program.
if test "$cross_compiling" != yes; then if false && test "$cross_compiling" != yes; then
if { ac_try='./$ac_file' if { ac_try='./$ac_file'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5 (eval $ac_try) 2>&5

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
readline5 (5.2+dfsg-ok3) yangtze; urgency=medium
* Manually apply upstream patches.
-- zhouganqing <zhouganqing@kylinos.cn> Wed, 15 Jun 2022 17:20:58 +0800
readline5 (5.2+dfsg-ok2) yangtze; urgency=medium readline5 (5.2+dfsg-ok2) yangtze; urgency=medium
* Update debian/compat from 5 to 9. * Update debian/compat from 5 to 9.

19
debian/patches/00list vendored
View File

@ -1,19 +0,0 @@
rl-001
rl-002
rl-003
rl-004
rl-004
rl-005
rl-006
rl-007
rl-008
rl-009
rl-010
rl-011
rl-012
rl-013
rl-attribute
rl-header
rl-no-cross-check
rl-no-rpath
rl-no-non-DFSG-doc.dpatch

41
debian/patches/rl-001 vendored
View File

@ -1,41 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-001.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: In some cases, code that is intended to be used in the presence of multibyte
## DP: characters is called when no such characters are present, leading to incorrect
## DP: display position calculations and incorrect redisplay.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-001
Bug-Reported-by: ebb9@byu.net
Bug-Reference-ID: <45540862.9030900@byu.net>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2006-11/msg00017.html
http://lists.gnu.org/archive/html/bug-bash/2006-11/msg00016.html
Bug-Description:
In some cases, code that is intended to be used in the presence of multibyte
characters is called when no such characters are present, leading to incorrect
display position calculations and incorrect redisplay.
Patch:
*** ../readline-5.2/display.c Thu Sep 14 14:20:12 2006
--- ./display.c Mon Nov 13 17:55:57 2006
***************
*** 2381,2384 ****
--- 2409,2414 ----
if (end <= start)
return 0;
+ if (MB_CUR_MAX == 1 || rl_byte_oriented)
+ return (end - start);
memset (&ps, 0, sizeof (mbstate_t));

59
debian/patches/rl-002 vendored
View File

@ -1,59 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-001.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: In some cases, code that is intended to be used in the presence of multibyte
## DP: characters is called when no such characters are present, leading to incorrect
## DP: display position calculations and incorrect redisplay.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-002
Bug-Reported-by: Magnus Svensson <msvensson@mysql.com>
Bug-Reference-ID: <45BDC44D.80609@mysql.com>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2007-01/msg00002.html
Bug-Description:
Readline neglects to reallocate the array it uses to keep track of wrapped
screen lines when increasing its size. This will eventually result in
segmentation faults when given sufficiently long input.
Patch:
*** ../readline-5.2-patched/display.c Thu Sep 14 14:20:12 2006
--- ./display.c Fri Feb 2 20:23:17 2007
***************
*** 561,574 ****
--- 561,586 ----
wrap_offset = prompt_invis_chars_first_line = 0;
}
+ #if defined (HANDLE_MULTIBYTE)
#define CHECK_INV_LBREAKS() \
do { \
if (newlines >= (inv_lbsize - 2)) \
{ \
inv_lbsize *= 2; \
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
+ _rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
} \
} while (0)
+ #else
+ #define CHECK_INV_LBREAKS() \
+ do { \
+ if (newlines >= (inv_lbsize - 2)) \
+ { \
+ inv_lbsize *= 2; \
+ inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
+ } \
+ } while (0)
+ #endif /* HANDLE_MULTIBYTE */
#if defined (HANDLE_MULTIBYTE)
#define CHECK_LPOS() \

48
debian/patches/rl-003 vendored
View File

@ -1,48 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-003.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: When moving the cursor, bash sometimes misplaces the cursor when the prompt
## DP: contains two or more multibyte characters. The particular circumstance that
## DP: uncovered the problem was having the (multibyte) current directory name in
## DP: the prompt string.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-003
Bug-Reported-by: Peter Volkov <torre_cremata@mail.ru>
Bug-Reference-ID: <1171795523.8021.18.camel@localhost>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-02/msg00054.html
Bug-Description:
When moving the cursor, bash sometimes misplaces the cursor when the prompt
contains two or more multibyte characters. The particular circumstance that
uncovered the problem was having the (multibyte) current directory name in
the prompt string.
Patch:
*** ../readline-5.2.2/display.c Fri Jan 19 13:34:50 2007
--- ./display.c Sat Mar 10 17:25:44 2007
***************
*** 1745,1749 ****
{
dpos = _rl_col_width (data, 0, new);
! if (dpos > prompt_last_invisible) /* XXX - don't use woff here */
{
dpos -= woff;
--- 1745,1752 ----
{
dpos = _rl_col_width (data, 0, new);
! /* Use NEW when comparing against the last invisible character in the
! prompt string, since they're both buffer indices and DPOS is a
! desired display position. */
! if (new > prompt_last_invisible) /* XXX - don't use woff here */
{
dpos -= woff;

80
debian/patches/rl-004 vendored
View File

@ -1,80 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-004.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: When restoring the original prompt after finishing an incremental search,
## DP: bash sometimes places the cursor incorrectly if the primary prompt contains
## DP: invisible characters.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-004
Bug-Reported-by: Peter Volkov <torre_cremata@mail.ru>
Bug-Reference-ID: <1173636022.7039.36.camel@localhost>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-03/msg00039.html
Bug-Description:
When restoring the original prompt after finishing an incremental search,
bash sometimes places the cursor incorrectly if the primary prompt contains
invisible characters.
Patch:
*** ../readline-5.2.3/display.c Fri Apr 20 13:30:16 2007
--- ./display.c Fri Apr 20 15:17:01 2007
***************
*** 1599,1604 ****
if (temp > 0)
{
_rl_output_some_chars (nfd, temp);
! _rl_last_c_pos += _rl_col_width (nfd, 0, temp);;
}
}
--- 1599,1618 ----
if (temp > 0)
{
+ /* If nfd begins at the prompt, or before the invisible
+ characters in the prompt, we need to adjust _rl_last_c_pos
+ in a multibyte locale to account for the wrap offset and
+ set cpos_adjusted accordingly. */
_rl_output_some_chars (nfd, temp);
! if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
! {
! _rl_last_c_pos += _rl_col_width (nfd, 0, temp);
! if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
! {
! _rl_last_c_pos -= wrap_offset;
! cpos_adjusted = 1;
! }
! }
! else
! _rl_last_c_pos += temp;
}
}
***************
*** 1608,1613 ****
--- 1622,1639 ----
if (temp > 0)
{
+ /* If nfd begins at the prompt, or before the invisible
+ characters in the prompt, we need to adjust _rl_last_c_pos
+ in a multibyte locale to account for the wrap offset and
+ set cpos_adjusted accordingly. */
_rl_output_some_chars (nfd, temp);
_rl_last_c_pos += col_temp; /* XXX */
+ if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
+ {
+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
+ {
+ _rl_last_c_pos -= wrap_offset;
+ cpos_adjusted = 1;
+ }
+ }
}
lendiff = (oe - old) - (ne - new);

335
debian/patches/rl-005 vendored
View File

@ -1,335 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-005.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: readline upstream patch readline52-005.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-005
Bug-Reported-by: Thomas Loeber <ifp@loeber1.de>
Bug-Reference-ID: <200703082223.08919.ifp@loeber1.de>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-03/msg00036.html
Bug-Description:
When rl_read_key returns -1, indicating that readline's controlling terminal
has been invalidated for some reason (e.g., receiving a SIGHUP), the error
status was not reported correctly to the caller. This could cause input
loops.
Patch:
*** ../readline-5.2/complete.c Fri Jul 28 11:35:49 2006
--- ./complete.c Tue Mar 13 08:50:16 2007
***************
*** 429,433 ****
if (c == 'n' || c == 'N' || c == RUBOUT)
return (0);
! if (c == ABORT_CHAR)
_rl_abort_internal ();
if (for_pager && (c == NEWLINE || c == RETURN))
--- 440,444 ----
if (c == 'n' || c == 'N' || c == RUBOUT)
return (0);
! if (c == ABORT_CHAR || c < 0)
_rl_abort_internal ();
if (for_pager && (c == NEWLINE || c == RETURN))
*** ../readline-5.2/input.c Wed Aug 16 15:15:16 2006
--- ./input.c Wed May 2 16:07:59 2007
***************
*** 514,518 ****
int size;
{
! int mb_len = 0;
size_t mbchar_bytes_length;
wchar_t wc;
--- 522,526 ----
int size;
{
! int mb_len, c;
size_t mbchar_bytes_length;
wchar_t wc;
***************
*** 521,531 ****
memset(&ps, 0, sizeof (mbstate_t));
memset(&ps_back, 0, sizeof (mbstate_t));
!
while (mb_len < size)
{
RL_SETSTATE(RL_STATE_MOREINPUT);
! mbchar[mb_len++] = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps);
if (mbchar_bytes_length == (size_t)(-1))
--- 529,545 ----
memset(&ps, 0, sizeof (mbstate_t));
memset(&ps_back, 0, sizeof (mbstate_t));
!
! mb_len = 0;
while (mb_len < size)
{
RL_SETSTATE(RL_STATE_MOREINPUT);
! c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ if (c < 0)
+ break;
+
+ mbchar[mb_len++] = c;
+
mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps);
if (mbchar_bytes_length == (size_t)(-1))
***************
*** 565,569 ****
c = first;
memset (mb, 0, mlen);
! for (i = 0; i < mlen; i++)
{
mb[i] = (char)c;
--- 579,583 ----
c = first;
memset (mb, 0, mlen);
! for (i = 0; c >= 0 && i < mlen; i++)
{
mb[i] = (char)c;
*** ../readline-5.2/isearch.c Mon Dec 26 17:18:53 2005
--- ./isearch.c Fri Mar 9 14:30:59 2007
***************
*** 328,333 ****
f = (rl_command_func_t *)NULL;
!
! /* Translate the keys we do something with to opcodes. */
if (c >= 0 && _rl_keymap[c].type == ISFUNC)
{
--- 328,340 ----
f = (rl_command_func_t *)NULL;
!
! if (c < 0)
! {
! cxt->sflags |= SF_FAILED;
! cxt->history_pos = cxt->last_found_line;
! return -1;
! }
!
! /* Translate the keys we do something with to opcodes. */
if (c >= 0 && _rl_keymap[c].type == ISFUNC)
{
*** ../readline-5.2/misc.c Mon Dec 26 17:20:46 2005
--- ./misc.c Fri Mar 9 14:44:11 2007
***************
*** 147,150 ****
--- 147,152 ----
rl_clear_message ();
RL_UNSETSTATE(RL_STATE_NUMERICARG);
+ if (key < 0)
+ return -1;
return (_rl_dispatch (key, _rl_keymap));
}
*** ../readline-5.2/readline.c Wed Aug 16 15:00:36 2006
--- ./readline.c Fri Mar 9 14:47:24 2007
***************
*** 646,649 ****
--- 669,677 ----
{
nkey = _rl_subseq_getchar (cxt->okey);
+ if (nkey < 0)
+ {
+ _rl_abort_internal ();
+ return -1;
+ }
r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg);
cxt->flags |= KSEQ_DISPATCHED;
*** ../readline-5.2/text.c Fri Jul 28 11:55:27 2006
--- ./text.c Sun Mar 25 13:41:38 2007
***************
*** 858,861 ****
--- 864,870 ----
RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ if (c < 0)
+ return -1;
+
#if defined (HANDLE_SIGNALS)
if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
***************
*** 1521,1524 ****
--- 1530,1536 ----
mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX);
+ if (mb_len <= 0)
+ return -1;
+
if (count < 0)
return (_rl_char_search_internal (-count, bdir, mbchar, mb_len));
***************
*** 1537,1540 ****
--- 1549,1555 ----
RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ if (c < 0)
+ return -1;
+
if (count < 0)
return (_rl_char_search_internal (-count, bdir, c));
*** ../readline-5.2/vi_mode.c Sat Jul 29 16:42:28 2006
--- ./vi_mode.c Fri Mar 9 15:02:11 2007
***************
*** 887,890 ****
--- 887,897 ----
c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
+ if (c < 0)
+ {
+ *nextkey = 0;
+ return -1;
+ }
+
*nextkey = c;
***************
*** 903,906 ****
--- 910,918 ----
c = rl_read_key (); /* real command */
RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ if (c < 0)
+ {
+ *nextkey = 0;
+ return -1;
+ }
*nextkey = c;
}
***************
*** 1225,1236 ****
_rl_callback_generic_arg *data;
{
#if defined (HANDLE_MULTIBYTE)
! _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
#else
RL_SETSTATE(RL_STATE_MOREINPUT);
! _rl_vi_last_search_char = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
#endif
_rl_callback_func = 0;
_rl_want_redisplay = 1;
--- 1243,1262 ----
_rl_callback_generic_arg *data;
{
+ int c;
#if defined (HANDLE_MULTIBYTE)
! c = _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
#else
RL_SETSTATE(RL_STATE_MOREINPUT);
! c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
#endif
+ if (c <= 0)
+ return -1;
+
+ #if !defined (HANDLE_MULTIBYTE)
+ _rl_vi_last_search_char = c;
+ #endif
+
_rl_callback_func = 0;
_rl_want_redisplay = 1;
***************
*** 1248,1251 ****
--- 1274,1278 ----
int count, key;
{
+ int c;
#if defined (HANDLE_MULTIBYTE)
static char *target;
***************
*** 1294,1302 ****
{
#if defined (HANDLE_MULTIBYTE)
! _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
#else
RL_SETSTATE(RL_STATE_MOREINPUT);
! _rl_vi_last_search_char = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
#endif
}
--- 1321,1335 ----
{
#if defined (HANDLE_MULTIBYTE)
! c = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
! if (c <= 0)
! return -1;
! _rl_vi_last_search_mblen = c;
#else
RL_SETSTATE(RL_STATE_MOREINPUT);
! c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ if (c < 0)
+ return -1;
+ _rl_vi_last_search_char = c;
#endif
}
***************
*** 1468,1471 ****
--- 1501,1507 ----
RL_UNSETSTATE(RL_STATE_MOREINPUT);
+ if (c < 0)
+ return -1;
+
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
***************
*** 1486,1489 ****
--- 1522,1528 ----
_rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
+ if (c < 0)
+ return -1;
+
_rl_callback_func = 0;
_rl_want_redisplay = 1;
***************
*** 1517,1520 ****
--- 1556,1562 ----
_rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
+ if (c < 0)
+ return -1;
+
return (_rl_vi_change_char (count, c, mb));
}
***************
*** 1651,1655 ****
RL_UNSETSTATE(RL_STATE_MOREINPUT);
! if (ch < 'a' || ch > 'z')
{
rl_ding ();
--- 1693,1697 ----
RL_UNSETSTATE(RL_STATE_MOREINPUT);
! if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
{
rl_ding ();
***************
*** 1703,1707 ****
return 0;
}
! else if (ch < 'a' || ch > 'z')
{
rl_ding ();
--- 1745,1749 ----
return 0;
}
! else if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
{
rl_ding ();

69
debian/patches/rl-006 vendored
View File

@ -1,69 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-006.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: readline upstream patch readline52-006.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-006
Bug-Reported-by: Peter Volkov <torre_cremata@mail.ru>
Bug-Reference-ID: <1178376645.9063.25.camel@localhost>
Bug-Reference-URL: http://bugs.gentoo.org/177095
Bug-Description:
The readline display code miscalculated the screen position when performing
a redisplay in which the new text occupies more screen space that the old,
but takes fewer bytes to do so (e.g., when replacing a shorter string
containing multibyte characters with a longer one containing only ASCII).
Patch:
*** ../readline-5.2/display.c Thu Apr 26 11:38:22 2007
--- ./display.c Thu Jul 12 23:10:10 2007
***************
*** 1519,1527 ****
/* Non-zero if we're increasing the number of lines. */
int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin;
/* Sometimes it is cheaper to print the characters rather than
use the terminal's capabilities. If we're growing the number
of lines, make sure we actually cause the new line to wrap
around on auto-wrapping terminals. */
! if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
{
/* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and
--- 1568,1596 ----
/* Non-zero if we're increasing the number of lines. */
int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin;
+ /* If col_lendiff is > 0, implying that the new string takes up more
+ screen real estate than the old, but lendiff is < 0, meaning that it
+ takes fewer bytes, we need to just output the characters starting
+ from the first difference. These will overwrite what is on the
+ display, so there's no reason to do a smart update. This can really
+ only happen in a multibyte environment. */
+ if (lendiff < 0)
+ {
+ _rl_output_some_chars (nfd, temp);
+ _rl_last_c_pos += _rl_col_width (nfd, 0, temp);
+ /* If nfd begins before any invisible characters in the prompt,
+ adjust _rl_last_c_pos to account for wrap_offset and set
+ cpos_adjusted to let the caller know. */
+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
+ {
+ _rl_last_c_pos -= wrap_offset;
+ cpos_adjusted = 1;
+ }
+ return;
+ }
/* Sometimes it is cheaper to print the characters rather than
use the terminal's capabilities. If we're growing the number
of lines, make sure we actually cause the new line to wrap
around on auto-wrapping terminals. */
! else if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
{
/* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and

72
debian/patches/rl-007 vendored
View File

@ -1,72 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-007.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: readline upstream patch readline52-007.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-007
Bug-Reported-by: Tom Bjorkholm <tom.bjorkholm@ericsson.com>
Bug-Reference-ID: <AEA1A32F001C6B4F98614B5B80D7647D01C075E9@esealmw115.eemea.ericsson.se>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2007-04/msg00004.html
Bug-Description:
An off-by-one error in readline's input buffering caused readline to drop
each 511th character of buffered input (e.g., when pasting a large amount
of data into a terminal window).
Patch:
*** ../readline-5.2/input.c Wed Aug 16 15:15:16 2006
--- ./input.c Tue Jul 17 09:24:21 2007
***************
*** 134,139 ****
*key = ibuffer[pop_index++];
!
if (pop_index >= ibuffer_len)
pop_index = 0;
--- 134,142 ----
*key = ibuffer[pop_index++];
! #if 0
if (pop_index >= ibuffer_len)
+ #else
+ if (pop_index > ibuffer_len)
+ #endif
pop_index = 0;
***************
*** 251,255 ****
{
k = (*rl_getc_function) (rl_instream);
! rl_stuff_char (k);
if (k == NEWLINE || k == RETURN)
break;
--- 254,259 ----
{
k = (*rl_getc_function) (rl_instream);
! if (rl_stuff_char (k) == 0)
! break; /* some problem; no more room */
if (k == NEWLINE || k == RETURN)
break;
***************
*** 374,378 ****
--- 378,386 ----
}
ibuffer[push_index++] = key;
+ #if 0
if (push_index >= ibuffer_len)
+ #else
+ if (push_index > ibuffer_len)
+ #endif
push_index = 0;

77
debian/patches/rl-008 vendored
View File

@ -1,77 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-008.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: readline upstream patch readline52-008.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-008
Bug-Reported-by: dAniel hAhler <ubuntu@thequod.de>
Bug-Reference-ID: <4702ED8A.5000503@thequod.de>
Bug-Reference-URL: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/119938
Bug-Description:
When updating the display after displaying, for instance, a list of possible
completions, readline will place the cursor at the wrong position if the
prompt contains invisible characters and a newline.
Patch:
*** ../readline-5.2-patched/display.c Mon Aug 6 14:26:29 2007
--- ./display.c Wed Oct 10 22:43:58 2007
***************
*** 1049,1053 ****
else
tx = nleft;
! if (_rl_last_c_pos > tx)
{
_rl_backspace (_rl_last_c_pos - tx); /* XXX */
--- 1049,1053 ----
else
tx = nleft;
! if (tx >= 0 && _rl_last_c_pos > tx)
{
_rl_backspace (_rl_last_c_pos - tx); /* XXX */
***************
*** 1205,1209 ****
{
register char *ofd, *ols, *oe, *nfd, *nls, *ne;
! int temp, lendiff, wsatend, od, nd;
int current_invis_chars;
int col_lendiff, col_temp;
--- 1205,1209 ----
{
register char *ofd, *ols, *oe, *nfd, *nls, *ne;
! int temp, lendiff, wsatend, od, nd, o_cpos;
int current_invis_chars;
int col_lendiff, col_temp;
***************
*** 1466,1469 ****
--- 1466,1471 ----
}
+ o_cpos = _rl_last_c_pos;
+
/* When this function returns, _rl_last_c_pos is correct, and an absolute
cursor postion in multibyte mode, but a buffer index when not in a
***************
*** 1475,1479 ****
invisible characters in the prompt string. Let's see if setting this when
we make sure we're at the end of the drawn prompt string works. */
! if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && _rl_last_c_pos == prompt_physical_chars)
cpos_adjusted = 1;
#endif
--- 1477,1483 ----
invisible characters in the prompt string. Let's see if setting this when
we make sure we're at the end of the drawn prompt string works. */
! if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 &&
! (_rl_last_c_pos > 0 || o_cpos > 0) &&
! _rl_last_c_pos == prompt_physical_chars)
cpos_adjusted = 1;
#endif

52
debian/patches/rl-009 vendored
View File

@ -1,52 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-009.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: readline upstream patch readline52-009.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-009
Bug-Reported-by: dAniel hAhler <ubuntu@thequod.de>
Bug-Reference-ID:
Bug-Reference-URL:
Bug-Description:
Under some circumstances, readline will incorrectly display a prompt string
containing invisible characters after the final newline.
Patch:
*** ../readline-5.2-patched/display.c 2007-08-25 13:47:08.000000000 -0400
--- ./display.c 2007-11-10 17:51:29.000000000 -0500
***************
*** 392,396 ****
local_prompt = expand_prompt (p, &prompt_visible_length,
&prompt_last_invisible,
! (int *)NULL,
&prompt_physical_chars);
c = *t; *t = '\0';
--- 420,424 ----
local_prompt = expand_prompt (p, &prompt_visible_length,
&prompt_last_invisible,
! &prompt_invis_chars_first_line,
&prompt_physical_chars);
c = *t; *t = '\0';
***************
*** 399,403 ****
local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length,
(int *)NULL,
! &prompt_invis_chars_first_line,
(int *)NULL);
*t = c;
--- 427,431 ----
local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length,
(int *)NULL,
! (int *)NULL,
(int *)NULL);
*t = c;

54
debian/patches/rl-010 vendored
View File

@ -1,54 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-010.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: readline upstream patch readline52-010.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-010
Bug-Reported-by: Miroslav Lichvar <mlichvar@redhat.com>
Bug-Reference-ID: Fri, 02 Nov 2007 14:07:45 +0100
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-readline/2007-11/msg00000.html
Bug-Description:
In certain cases when outputting characters at the end of the line,
e.g., when displaying the prompt string, readline positions the cursor
incorrectly if the prompt string contains invisible characters and the
text being drawn begins before the last invisible character in the line.
Patch:
*** ../readline-5.2-patched/display.c 2007-08-25 13:47:08.000000000 -0400
--- ./display.c 2007-11-10 17:51:29.000000000 -0500
***************
*** 1566,1574 ****
else
{
- /* We have horizontal scrolling and we are not inserting at
- the end. We have invisible characters in this line. This
- is a dumb update. */
_rl_output_some_chars (nfd, temp);
_rl_last_c_pos += col_temp;
return;
}
--- 1619,1632 ----
else
{
_rl_output_some_chars (nfd, temp);
_rl_last_c_pos += col_temp;
+ /* If nfd begins before any invisible characters in the prompt,
+ adjust _rl_last_c_pos to account for wrap_offset and set
+ cpos_adjusted to let the caller know. */
+ if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
+ {
+ _rl_last_c_pos -= wrap_offset;
+ cpos_adjusted = 1;
+ }
return;
}

39
debian/patches/rl-011 vendored
View File

@ -1,39 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-011.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: readline upstream patch readline52-011.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-011
Bug-Reported-by: Uwe Doering <gemini@geminix.org>
Bug-Reference-ID: <46F3DD72.2090801@geminix.org>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-09/msg00102.html
Bug-Description:
There is an off-by-one error in the code that buffers characters received
very quickly in succession, causing characters to be dropped.
Patch:
*** ../readline-5.2-patched/input.c 2007-08-25 13:47:10.000000000 -0400
--- ./input.c 2007-10-12 22:55:25.000000000 -0400
***************
*** 155,159 ****
pop_index--;
if (pop_index < 0)
! pop_index = ibuffer_len - 1;
ibuffer[pop_index] = key;
return (1);
--- 155,159 ----
pop_index--;
if (pop_index < 0)
! pop_index = ibuffer_len;
ibuffer[pop_index] = key;
return (1);

157
debian/patches/rl-012 vendored
View File

@ -1,157 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-012.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: readline upstream patch readline52-012.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-012
Bug-Reported-by: Chet Ramey <chet.ramey@case.edu>
Bug-Reference-ID:
Bug-Reference-URL:
Bug-Description:
This updates the options required to create shared libraries on several
systems, including Mac OS X 10.5 (darwin9.x), FreeBSD, NetBSD, OpenBSD,
AIX, and HP/UX.
Patch:
*** ../readline-5.2-patched/support/shobj-conf 2006-04-11 09:15:43.000000000 -0400
--- ./support/shobj-conf 2007-12-06 23:46:41.000000000 -0500
***************
*** 11,15 ****
# chet@po.cwru.edu
! # Copyright (C) 1996-2002 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
--- 11,15 ----
# chet@po.cwru.edu
! # Copyright (C) 1996-2007 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
***************
*** 115,119 ****
;;
! freebsd2* | netbsd*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD=ld
--- 115,119 ----
;;
! freebsd2*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD=ld
***************
*** 126,130 ****
# FreeBSD-3.x ELF
freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
! SHOBJ_CFLAGS=-fpic
SHOBJ_LD='${CC}'
--- 126,130 ----
# FreeBSD-3.x ELF
freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
! SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}'
***************
*** 143,147 ****
# Darwin/MacOS X
! darwin8*)
SHOBJ_STATUS=supported
SHLIB_STATUS=supported
--- 143,147 ----
# Darwin/MacOS X
! darwin[89]*)
SHOBJ_STATUS=supported
SHLIB_STATUS=supported
***************
*** 154,158 ****
SHLIB_LIBSUFF='dylib'
! SHOBJ_LDFLAGS='-undefined dynamic_lookup'
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
--- 154,158 ----
SHLIB_LIBSUFF='dylib'
! SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup -arch_only `/usr/bin/arch`'
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
***************
*** 172,176 ****
case "${host_os}" in
! darwin[78]*) SHOBJ_LDFLAGS=''
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
;;
--- 172,176 ----
case "${host_os}" in
! darwin[789]*) SHOBJ_LDFLAGS=''
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
;;
***************
*** 183,187 ****
;;
! openbsd*)
SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}'
--- 183,187 ----
;;
! openbsd*|netbsd*)
SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}'
***************
*** 248,252 ****
;;
! aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='ld'
--- 248,252 ----
;;
! aix4.[2-9]*-*gcc*|aix[5-9].*-*gcc*) # lightly tested by jik@cisco.com
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='ld'
***************
*** 259,263 ****
;;
! aix4.[2-9]*)
SHOBJ_CFLAGS=-K
SHOBJ_LD='ld'
--- 259,263 ----
;;
! aix4.[2-9]*|aix[5-9].*)
SHOBJ_CFLAGS=-K
SHOBJ_LD='ld'
***************
*** 330,334 ****
# if you have problems linking here, moving the `-Wl,+h,$@' from
# SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work
! SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)'
--- 330,334 ----
# if you have problems linking here, moving the `-Wl,+h,$@' from
# SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work
! SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s'
SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)'

142
debian/patches/rl-013 vendored
View File

@ -1,142 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-013.dpatch by <doko@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: readline upstream patch readline52-013.
@DPATCH@
READLINE PATCH REPORT
=====================
Readline-Release: 5.2
Patch-ID: readline52-013
Bug-Reported-by: slinkp <stuff@slinkp.com>
Bug-Reference-ID: <da52a26a-9f38-4861-a918-14d3482b539d@c65g2000hsa.googlegroups.com>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2008-05/msg00085.html
Bug-Description:
The presence of invisible characters in a prompt longer than the screenwidth
with invisible characters on the first and last prompt lines caused readline
to place the cursor in the wrong physical location.
Patch:
*** ../readline-5.2-patched/display.c 2007-12-14 21:12:40.000000000 -0500
--- ./display.c 2008-10-23 09:39:46.000000000 -0400
***************
*** 911,914 ****
--- 944,951 ----
OFFSET (which has already been calculated above). */
+ #define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset)
+ #define WRAP_OFFSET(line, offset) ((line == 0) \
+ ? (offset ? INVIS_FIRST() : 0) \
+ : ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0))
#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
***************
*** 945,949 ****
_rl_last_c_pos > wrap_offset &&
o_cpos < prompt_last_invisible)
! _rl_last_c_pos -= wrap_offset;
/* If this is the line with the prompt, we might need to
--- 982,992 ----
_rl_last_c_pos > wrap_offset &&
o_cpos < prompt_last_invisible)
! _rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
! else if (linenum == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth &&
! (MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
! cpos_adjusted == 0 &&
! _rl_last_c_pos != o_cpos &&
! _rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line))
! _rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line);
/* If this is the line with the prompt, we might need to
***************
*** 1205,1209 ****
{
register char *ofd, *ols, *oe, *nfd, *nls, *ne;
! int temp, lendiff, wsatend, od, nd, o_cpos;
int current_invis_chars;
int col_lendiff, col_temp;
--- 1264,1268 ----
{
register char *ofd, *ols, *oe, *nfd, *nls, *ne;
! int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
int current_invis_chars;
int col_lendiff, col_temp;
***************
*** 1221,1225 ****
temp = _rl_last_c_pos;
else
! temp = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset);
if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
&& _rl_last_v_pos == current_line - 1)
--- 1280,1284 ----
temp = _rl_last_c_pos;
else
! temp = _rl_last_c_pos - WRAP_OFFSET (_rl_last_v_pos, visible_wrap_offset);
if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
&& _rl_last_v_pos == current_line - 1)
***************
*** 1587,1599 ****
{
_rl_output_some_chars (nfd + lendiff, temp - lendiff);
- #if 1
/* XXX -- this bears closer inspection. Fixes a redisplay bug
reported against bash-3.0-alpha by Andreas Schwab involving
multibyte characters and prompt strings with invisible
characters, but was previously disabled. */
! _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
! #else
! _rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff);
! #endif
}
}
--- 1648,1660 ----
{
_rl_output_some_chars (nfd + lendiff, temp - lendiff);
/* XXX -- this bears closer inspection. Fixes a redisplay bug
reported against bash-3.0-alpha by Andreas Schwab involving
multibyte characters and prompt strings with invisible
characters, but was previously disabled. */
! if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
! twidth = _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
! else
! twidth = temp - lendiff;
! _rl_last_c_pos += twidth;
}
}
***************
*** 1789,1793 ****
int cpos, dpos; /* current and desired cursor positions */
! woff = W_OFFSET (_rl_last_v_pos, wrap_offset);
cpos = _rl_last_c_pos;
#if defined (HANDLE_MULTIBYTE)
--- 1850,1854 ----
int cpos, dpos; /* current and desired cursor positions */
! woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
cpos = _rl_last_c_pos;
#if defined (HANDLE_MULTIBYTE)
***************
*** 1803,1807 ****
prompt string, since they're both buffer indices and DPOS is a
desired display position. */
! if (new > prompt_last_invisible) /* XXX - don't use woff here */
{
dpos -= woff;
--- 1864,1872 ----
prompt string, since they're both buffer indices and DPOS is a
desired display position. */
! if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
! (prompt_physical_chars > _rl_screenwidth &&
! _rl_last_v_pos == prompt_last_screen_line &&
! wrap_offset != woff &&
! new > (prompt_last_invisible-_rl_screenwidth-wrap_offset)))
{
dpos -= woff;

View File

@ -1,37 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-attribute.dpatch by <doko@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Do not redefine __attribute__, define macro __rl_attribute__
@DPATCH@
diff -urNad readline5-5.2~/readline.h readline5-5.2/readline.h
--- readline5-5.2~/readline.h 2006-08-16 21:16:59.000000000 +0200
+++ readline5-5.2/readline.h 2006-10-28 14:03:36.000000000 +0200
@@ -373,7 +373,7 @@
extern int rl_crlf PARAMS((void));
#if defined (USE_VARARGS) && defined (PREFER_STDARG)
-extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
+extern int rl_message (const char *, ...) __rl_attribute__((__format__ (printf, 1, 2)));
#else
extern int rl_message ();
#endif
diff -urNad readline5-5.2~/rlstdc.h readline5-5.2/rlstdc.h
--- readline5-5.2~/rlstdc.h 2003-05-30 21:08:02.000000000 +0200
+++ readline5-5.2/rlstdc.h 2006-10-28 14:03:36.000000000 +0200
@@ -36,10 +36,10 @@
# endif
#endif
-#ifndef __attribute__
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
-# define __attribute__(x)
-# endif
+#if defined(__GNUC__) && __GNUC__ >= 2
+# define __rl_attribute__(x) __attribute__(x)
+#else
+# define __rl_attribute__(x)
#endif
#endif /* !_RL_STDC_H_ */

View File

@ -1,29 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-header.dpatch by <doko@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Include stdio.h in readline.h and history.h
@DPATCH@
diff -urNad readline5-5.2~/history.h readline5-5.2/history.h
--- readline5-5.2~/history.h 2003-07-31 14:38:44.000000000 +0200
+++ readline5-5.2/history.h 2006-10-28 14:06:20.000000000 +0200
@@ -32,6 +32,7 @@
# include "rlstdc.h"
# include "rltypedefs.h"
#else
+# include <stdio.h>
# include <readline/rlstdc.h>
# include <readline/rltypedefs.h>
#endif
diff -urNad readline5-5.2~/readline.h readline5-5.2/readline.h
--- readline5-5.2~/readline.h 2006-08-16 21:16:59.000000000 +0200
+++ readline5-5.2/readline.h 2006-10-28 14:06:20.000000000 +0200
@@ -33,6 +33,7 @@
# include "keymaps.h"
# include "tilde.h"
#else
+# include <stdio.h>
# include <readline/rlstdc.h>
# include <readline/rltypedefs.h>
# include <readline/keymaps.h>

View File

@ -1,19 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-no-cross-check.dpatch by <doko@salsa.net.local>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: configure: Don't check for cross compilation
@DPATCH@
diff -urNad readline5-5.2~/configure readline5-5.2/configure
--- readline5-5.2~/configure 2006-09-28 18:04:36.000000000 +0200
+++ readline5-5.2/configure 2006-10-28 14:20:05.000000000 +0200
@@ -1938,7 +1938,7 @@
echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
+if false && test "$cross_compiling" != yes; then
if { ac_try='./$ac_file'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5

View File

@ -1,37 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-no-non-DFSG-doc.dpatch by David Prévot <taffit@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Do not build nor ship non DFSG doc
@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' readline5-5.2+dfsg~/doc/Makefile.in readline5-5.2+dfsg/doc/Makefile.in
--- readline5-5.2+dfsg~/doc/Makefile.in 2004-01-08 11:42:54.000000000 -0400
+++ readline5-5.2+dfsg/doc/Makefile.in 2012-12-30 19:06:54.000000000 -0400
@@ -72,7 +72,6 @@
GROFF = groff
DVIOBJ = readline.dvi history.dvi rluserman.dvi
-INFOOBJ = readline.info history.info rluserman.info
PSOBJ = readline.ps history.ps rluserman.ps readline_3.ps history_3.ps
HTMLOBJ = readline.html history.html rluserman.html
TEXTOBJ = readline.0 history.0
@@ -198,18 +197,12 @@
install: installdirs
if test -f readline.info; then \
${INSTALL_DATA} readline.info $(DESTDIR)$(infodir)/readline.info; \
- else \
- ${INSTALL_DATA} $(srcdir)/readline.info $(DESTDIR)$(infodir)/readline.info; \
fi
if test -f rluserman.info; then \
${INSTALL_DATA} rluserman.info $(DESTDIR)$(infodir)/rluserman.info; \
- else \
- ${INSTALL_DATA} $(srcdir)/rluserman.info $(DESTDIR)$(infodir)/rluserman.info; \
fi
if test -f history.info; then \
${INSTALL_DATA} history.info $(DESTDIR)$(infodir)/history.info; \
- else \
- ${INSTALL_DATA} $(srcdir)/history.info $(DESTDIR)$(infodir)/history.info; \
fi
-if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
install-info --dir-file=$(DESTDIR)$(infodir)/dir \

View File

@ -1,19 +0,0 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## rl-no-rpath.dpatch by <doko@salsa.net.local>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Don't set a runtime path for linking the shared libraries
@DPATCH@
diff -urNad readline5-5.2~/support/shobj-conf readline5-5.2/support/shobj-conf
--- readline5-5.2~/support/shobj-conf 2006-04-11 15:15:43.000000000 +0200
+++ readline5-5.2/support/shobj-conf 2006-10-28 14:21:36.000000000 +0200
@@ -110,7 +110,7 @@
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
- SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
+ SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;

124
display.c
View File

@ -391,14 +391,14 @@ rl_expand_prompt (prompt)
t = ++p; t = ++p;
local_prompt = expand_prompt (p, &prompt_visible_length, local_prompt = expand_prompt (p, &prompt_visible_length,
&prompt_last_invisible, &prompt_last_invisible,
(int *)NULL, &prompt_invis_chars_first_line,
&prompt_physical_chars); &prompt_physical_chars);
c = *t; *t = '\0'; c = *t; *t = '\0';
/* The portion of the prompt string up to and including the /* The portion of the prompt string up to and including the
final newline is now null-terminated. */ final newline is now null-terminated. */
local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length, local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length,
(int *)NULL, (int *)NULL,
&prompt_invis_chars_first_line, (int *)NULL,
(int *)NULL); (int *)NULL);
*t = c; *t = c;
local_prompt_len = local_prompt ? strlen (local_prompt) : 0; local_prompt_len = local_prompt ? strlen (local_prompt) : 0;
@ -561,6 +561,17 @@ rl_redisplay ()
wrap_offset = prompt_invis_chars_first_line = 0; wrap_offset = prompt_invis_chars_first_line = 0;
} }
#if defined (HANDLE_MULTIBYTE)
#define CHECK_INV_LBREAKS() \
do { \
if (newlines >= (inv_lbsize - 2)) \
{ \
inv_lbsize *= 2; \
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
_rl_wrapped_line = (int *)xrealloc (_rl_wrapped_line, inv_lbsize * sizeof (int)); \
} \
} while (0)
#else
#define CHECK_INV_LBREAKS() \ #define CHECK_INV_LBREAKS() \
do { \ do { \
if (newlines >= (inv_lbsize - 2)) \ if (newlines >= (inv_lbsize - 2)) \
@ -569,6 +580,7 @@ rl_redisplay ()
inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \ inv_lbreaks = (int *)xrealloc (inv_lbreaks, inv_lbsize * sizeof (int)); \
} \ } \
} while (0) } while (0)
#endif /* HANDLE_MULTIBYTE */
#if defined (HANDLE_MULTIBYTE) #if defined (HANDLE_MULTIBYTE)
#define CHECK_LPOS() \ #define CHECK_LPOS() \
@ -898,6 +910,10 @@ rl_redisplay ()
second and subsequent lines start at inv_lbreaks[N], offset by second and subsequent lines start at inv_lbreaks[N], offset by
OFFSET (which has already been calculated above). */ OFFSET (which has already been calculated above). */
#define INVIS_FIRST() (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset)
#define WRAP_OFFSET(line, offset) ((line == 0) \
? (offset ? INVIS_FIRST() : 0) \
: ((line == prompt_last_screen_line) ? wrap_offset-prompt_invis_chars_first_line : 0))
#define W_OFFSET(line, offset) ((line) == 0 ? offset : 0) #define W_OFFSET(line, offset) ((line) == 0 ? offset : 0)
#define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l])) #define VIS_LLEN(l) ((l) > _rl_vis_botlin ? 0 : (vis_lbreaks[l+1] - vis_lbreaks[l]))
#define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l]) #define INV_LLEN(l) (inv_lbreaks[l+1] - inv_lbreaks[l])
@ -932,7 +948,13 @@ rl_redisplay ()
_rl_last_c_pos != o_cpos && _rl_last_c_pos != o_cpos &&
_rl_last_c_pos > wrap_offset && _rl_last_c_pos > wrap_offset &&
o_cpos < prompt_last_invisible) o_cpos < prompt_last_invisible)
_rl_last_c_pos -= wrap_offset; _rl_last_c_pos -= prompt_invis_chars_first_line; /* XXX - was wrap_offset */
else if (linenum == prompt_last_screen_line && prompt_physical_chars > _rl_screenwidth &&
(MB_CUR_MAX > 1 && rl_byte_oriented == 0) &&
cpos_adjusted == 0 &&
_rl_last_c_pos != o_cpos &&
_rl_last_c_pos > (prompt_last_invisible - _rl_screenwidth - prompt_invis_chars_first_line))
_rl_last_c_pos -= (wrap_offset-prompt_invis_chars_first_line);
/* If this is the line with the prompt, we might need to /* If this is the line with the prompt, we might need to
compensate for invisible characters in the new line. Do compensate for invisible characters in the new line. Do
@ -1036,7 +1058,7 @@ rl_redisplay ()
tx = _rl_col_width (&visible_line[pos], 0, nleft) - visible_wrap_offset; tx = _rl_col_width (&visible_line[pos], 0, nleft) - visible_wrap_offset;
else else
tx = nleft; tx = nleft;
if (_rl_last_c_pos > tx) if (tx >= 0 && _rl_last_c_pos > tx)
{ {
_rl_backspace (_rl_last_c_pos - tx); /* XXX */ _rl_backspace (_rl_last_c_pos - tx); /* XXX */
_rl_last_c_pos = tx; _rl_last_c_pos = tx;
@ -1192,7 +1214,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
int current_line, omax, nmax, inv_botlin; int current_line, omax, nmax, inv_botlin;
{ {
register char *ofd, *ols, *oe, *nfd, *nls, *ne; register char *ofd, *ols, *oe, *nfd, *nls, *ne;
int temp, lendiff, wsatend, od, nd; int temp, lendiff, wsatend, od, nd, twidth, o_cpos;
int current_invis_chars; int current_invis_chars;
int col_lendiff, col_temp; int col_lendiff, col_temp;
#if defined (HANDLE_MULTIBYTE) #if defined (HANDLE_MULTIBYTE)
@ -1208,7 +1230,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
temp = _rl_last_c_pos; temp = _rl_last_c_pos;
else else
temp = _rl_last_c_pos - W_OFFSET(_rl_last_v_pos, visible_wrap_offset); temp = _rl_last_c_pos - WRAP_OFFSET (_rl_last_v_pos, visible_wrap_offset);
if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode if (temp == _rl_screenwidth && _rl_term_autowrap && !_rl_horizontal_scroll_mode
&& _rl_last_v_pos == current_line - 1) && _rl_last_v_pos == current_line - 1)
{ {
@ -1453,6 +1475,8 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
_rl_last_c_pos = lendiff; _rl_last_c_pos = lendiff;
} }
o_cpos = _rl_last_c_pos;
/* When this function returns, _rl_last_c_pos is correct, and an absolute /* When this function returns, _rl_last_c_pos is correct, and an absolute
cursor postion in multibyte mode, but a buffer index when not in a cursor postion in multibyte mode, but a buffer index when not in a
multibyte locale. */ multibyte locale. */
@ -1462,7 +1486,9 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
/* We need to indicate that the cursor position is correct in the presence of /* We need to indicate that the cursor position is correct in the presence of
invisible characters in the prompt string. Let's see if setting this when invisible characters in the prompt string. Let's see if setting this when
we make sure we're at the end of the drawn prompt string works. */ we make sure we're at the end of the drawn prompt string works. */
if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 && _rl_last_c_pos == prompt_physical_chars) if (current_line == 0 && MB_CUR_MAX > 1 && rl_byte_oriented == 0 &&
(_rl_last_c_pos > 0 || o_cpos > 0) &&
_rl_last_c_pos == prompt_physical_chars)
cpos_adjusted = 1; cpos_adjusted = 1;
#endif #endif
#endif #endif
@ -1506,11 +1532,31 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
{ {
/* Non-zero if we're increasing the number of lines. */ /* Non-zero if we're increasing the number of lines. */
int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin; int gl = current_line >= _rl_vis_botlin && inv_botlin > _rl_vis_botlin;
/* If col_lendiff is > 0, implying that the new string takes up more
screen real estate than the old, but lendiff is < 0, meaning that it
takes fewer bytes, we need to just output the characters starting
from the first difference. These will overwrite what is on the
display, so there's no reason to do a smart update. This can really
only happen in a multibyte environment. */
if (lendiff < 0)
{
_rl_output_some_chars (nfd, temp);
_rl_last_c_pos += _rl_col_width (nfd, 0, temp);
/* If nfd begins before any invisible characters in the prompt,
adjust _rl_last_c_pos to account for wrap_offset and set
cpos_adjusted to let the caller know. */
if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
cpos_adjusted = 1;
}
return;
}
/* Sometimes it is cheaper to print the characters rather than /* Sometimes it is cheaper to print the characters rather than
use the terminal's capabilities. If we're growing the number use the terminal's capabilities. If we're growing the number
of lines, make sure we actually cause the new line to wrap of lines, make sure we actually cause the new line to wrap
around on auto-wrapping terminals. */ around on auto-wrapping terminals. */
if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl)) else if (_rl_terminal_can_insert && ((2 * col_temp) >= col_lendiff || _rl_term_IC) && (!_rl_term_autowrap || !gl))
{ {
/* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and /* If lendiff > prompt_visible_length and _rl_last_c_pos == 0 and
_rl_horizontal_scroll_mode == 1, inserting the characters with _rl_horizontal_scroll_mode == 1, inserting the characters with
@ -1533,11 +1579,16 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
} }
else else
{ {
/* We have horizontal scrolling and we are not inserting at
the end. We have invisible characters in this line. This
is a dumb update. */
_rl_output_some_chars (nfd, temp); _rl_output_some_chars (nfd, temp);
_rl_last_c_pos += col_temp; _rl_last_c_pos += col_temp;
/* If nfd begins before any invisible characters in the prompt,
adjust _rl_last_c_pos to account for wrap_offset and set
cpos_adjusted to let the caller know. */
if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
cpos_adjusted = 1;
}
return; return;
} }
/* Copy (new) chars to screen from first diff to last match. */ /* Copy (new) chars to screen from first diff to last match. */
@ -1545,15 +1596,15 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
if ((temp - lendiff) > 0) if ((temp - lendiff) > 0)
{ {
_rl_output_some_chars (nfd + lendiff, temp - lendiff); _rl_output_some_chars (nfd + lendiff, temp - lendiff);
#if 1
/* XXX -- this bears closer inspection. Fixes a redisplay bug /* XXX -- this bears closer inspection. Fixes a redisplay bug
reported against bash-3.0-alpha by Andreas Schwab involving reported against bash-3.0-alpha by Andreas Schwab involving
multibyte characters and prompt strings with invisible multibyte characters and prompt strings with invisible
characters, but was previously disabled. */ characters, but was previously disabled. */
_rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-col_lendiff); if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
#else twidth = _rl_col_width (nfd+lendiff, 0, temp-col_lendiff);
_rl_last_c_pos += _rl_col_width (nfd+lendiff, 0, temp-lendiff); else
#endif twidth = temp - lendiff;
_rl_last_c_pos += twidth;
} }
} }
else else
@ -1586,8 +1637,22 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
temp = nls - nfd; temp = nls - nfd;
if (temp > 0) if (temp > 0)
{ {
/* If nfd begins at the prompt, or before the invisible
characters in the prompt, we need to adjust _rl_last_c_pos
in a multibyte locale to account for the wrap offset and
set cpos_adjusted accordingly. */
_rl_output_some_chars (nfd, temp); _rl_output_some_chars (nfd, temp);
_rl_last_c_pos += _rl_col_width (nfd, 0, temp);; if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
_rl_last_c_pos += _rl_col_width (nfd, 0, temp);
if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
cpos_adjusted = 1;
}
}
else
_rl_last_c_pos += temp;
} }
} }
/* Otherwise, print over the existing material. */ /* Otherwise, print over the existing material. */
@ -1595,8 +1660,20 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
{ {
if (temp > 0) if (temp > 0)
{ {
/* If nfd begins at the prompt, or before the invisible
characters in the prompt, we need to adjust _rl_last_c_pos
in a multibyte locale to account for the wrap offset and
set cpos_adjusted accordingly. */
_rl_output_some_chars (nfd, temp); _rl_output_some_chars (nfd, temp);
_rl_last_c_pos += col_temp; /* XXX */ _rl_last_c_pos += col_temp; /* XXX */
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{
if (current_line == 0 && wrap_offset && ((nfd - new) <= prompt_last_invisible))
{
_rl_last_c_pos -= wrap_offset;
cpos_adjusted = 1;
}
}
} }
lendiff = (oe - old) - (ne - new); lendiff = (oe - old) - (ne - new);
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
@ -1721,7 +1798,7 @@ _rl_move_cursor_relative (new, data)
int woff; /* number of invisible chars on current line */ int woff; /* number of invisible chars on current line */
int cpos, dpos; /* current and desired cursor positions */ int cpos, dpos; /* current and desired cursor positions */
woff = W_OFFSET (_rl_last_v_pos, wrap_offset); woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
cpos = _rl_last_c_pos; cpos = _rl_last_c_pos;
#if defined (HANDLE_MULTIBYTE) #if defined (HANDLE_MULTIBYTE)
/* If we have multibyte characters, NEW is indexed by the buffer point in /* If we have multibyte characters, NEW is indexed by the buffer point in
@ -1732,7 +1809,14 @@ _rl_move_cursor_relative (new, data)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
{ {
dpos = _rl_col_width (data, 0, new); dpos = _rl_col_width (data, 0, new);
if (dpos > prompt_last_invisible) /* XXX - don't use woff here */ /* Use NEW when comparing against the last invisible character in the
prompt string, since they're both buffer indices and DPOS is a
desired display position. */
if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
(prompt_physical_chars > _rl_screenwidth &&
_rl_last_v_pos == prompt_last_screen_line &&
wrap_offset != woff &&
new > (prompt_last_invisible-_rl_screenwidth-wrap_offset)))
{ {
dpos -= woff; dpos -= woff;
/* Since this will be assigned to _rl_last_c_pos at the end (more /* Since this will be assigned to _rl_last_c_pos at the end (more
@ -2380,6 +2464,8 @@ _rl_col_width (str, start, end)
if (end <= start) if (end <= start)
return 0; return 0;
if (MB_CUR_MAX == 1 || rl_byte_oriented)
return (end - start);
memset (&ps, 0, sizeof (mbstate_t)); memset (&ps, 0, sizeof (mbstate_t));

View File

@ -72,7 +72,6 @@ NROFF = groff -Tascii
GROFF = groff GROFF = groff
DVIOBJ = readline.dvi history.dvi rluserman.dvi DVIOBJ = readline.dvi history.dvi rluserman.dvi
INFOOBJ = readline.info history.info rluserman.info
PSOBJ = readline.ps history.ps rluserman.ps readline_3.ps history_3.ps PSOBJ = readline.ps history.ps rluserman.ps readline_3.ps history_3.ps
HTMLOBJ = readline.html history.html rluserman.html HTMLOBJ = readline.html history.html rluserman.html
TEXTOBJ = readline.0 history.0 TEXTOBJ = readline.0 history.0
@ -198,18 +197,12 @@ installdirs: $(topdir)/support/mkdirs
install: installdirs install: installdirs
if test -f readline.info; then \ if test -f readline.info; then \
${INSTALL_DATA} readline.info $(DESTDIR)$(infodir)/readline.info; \ ${INSTALL_DATA} readline.info $(DESTDIR)$(infodir)/readline.info; \
else \
${INSTALL_DATA} $(srcdir)/readline.info $(DESTDIR)$(infodir)/readline.info; \
fi fi
if test -f rluserman.info; then \ if test -f rluserman.info; then \
${INSTALL_DATA} rluserman.info $(DESTDIR)$(infodir)/rluserman.info; \ ${INSTALL_DATA} rluserman.info $(DESTDIR)$(infodir)/rluserman.info; \
else \
${INSTALL_DATA} $(srcdir)/rluserman.info $(DESTDIR)$(infodir)/rluserman.info; \
fi fi
if test -f history.info; then \ if test -f history.info; then \
${INSTALL_DATA} history.info $(DESTDIR)$(infodir)/history.info; \ ${INSTALL_DATA} history.info $(DESTDIR)$(infodir)/history.info; \
else \
${INSTALL_DATA} $(srcdir)/history.info $(DESTDIR)$(infodir)/history.info; \
fi fi
-if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ -if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
install-info --dir-file=$(DESTDIR)$(infodir)/dir \ install-info --dir-file=$(DESTDIR)$(infodir)/dir \

View File

@ -32,6 +32,7 @@ extern "C" {
# include "rlstdc.h" # include "rlstdc.h"
# include "rltypedefs.h" # include "rltypedefs.h"
#else #else
# include <stdio.h>
# include <readline/rlstdc.h> # include <readline/rlstdc.h>
# include <readline/rltypedefs.h> # include <readline/rltypedefs.h>
#endif #endif

26
input.c
View File

@ -133,8 +133,11 @@ rl_get_char (key)
return (0); return (0);
*key = ibuffer[pop_index++]; *key = ibuffer[pop_index++];
#if 0
if (pop_index >= ibuffer_len) if (pop_index >= ibuffer_len)
#else
if (pop_index > ibuffer_len)
#endif
pop_index = 0; pop_index = 0;
return (1); return (1);
@ -151,7 +154,7 @@ _rl_unget_char (key)
{ {
pop_index--; pop_index--;
if (pop_index < 0) if (pop_index < 0)
pop_index = ibuffer_len - 1; pop_index = ibuffer_len;
ibuffer[pop_index] = key; ibuffer[pop_index] = key;
return (1); return (1);
} }
@ -250,7 +253,8 @@ rl_gather_tyi ()
while (chars_avail--) while (chars_avail--)
{ {
k = (*rl_getc_function) (rl_instream); k = (*rl_getc_function) (rl_instream);
rl_stuff_char (k); if (rl_stuff_char (k) == 0)
break; /* some problem; no more room */
if (k == NEWLINE || k == RETURN) if (k == NEWLINE || k == RETURN)
break; break;
} }
@ -373,7 +377,11 @@ rl_stuff_char (key)
RL_SETSTATE (RL_STATE_INPUTPENDING); RL_SETSTATE (RL_STATE_INPUTPENDING);
} }
ibuffer[push_index++] = key; ibuffer[push_index++] = key;
#if 0
if (push_index >= ibuffer_len) if (push_index >= ibuffer_len)
#else
if (push_index > ibuffer_len)
#endif
push_index = 0; push_index = 0;
return 1; return 1;
@ -513,7 +521,7 @@ _rl_read_mbchar (mbchar, size)
char *mbchar; char *mbchar;
int size; int size;
{ {
int mb_len = 0; int mb_len, c;
size_t mbchar_bytes_length; size_t mbchar_bytes_length;
wchar_t wc; wchar_t wc;
mbstate_t ps, ps_back; mbstate_t ps, ps_back;
@ -521,12 +529,18 @@ _rl_read_mbchar (mbchar, size)
memset(&ps, 0, sizeof (mbstate_t)); memset(&ps, 0, sizeof (mbstate_t));
memset(&ps_back, 0, sizeof (mbstate_t)); memset(&ps_back, 0, sizeof (mbstate_t));
mb_len = 0;
while (mb_len < size) while (mb_len < size)
{ {
RL_SETSTATE(RL_STATE_MOREINPUT); RL_SETSTATE(RL_STATE_MOREINPUT);
mbchar[mb_len++] = rl_read_key (); c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT); RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (c < 0)
break;
mbchar[mb_len++] = c;
mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps); mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps);
if (mbchar_bytes_length == (size_t)(-1)) if (mbchar_bytes_length == (size_t)(-1))
break; /* invalid byte sequence for the current locale */ break; /* invalid byte sequence for the current locale */
@ -564,7 +578,7 @@ _rl_read_mbstring (first, mb, mlen)
c = first; c = first;
memset (mb, 0, mlen); memset (mb, 0, mlen);
for (i = 0; i < mlen; i++) for (i = 0; c >= 0 && i < mlen; i++)
{ {
mb[i] = (char)c; mb[i] = (char)c;
memset (&ps, 0, sizeof (mbstate_t)); memset (&ps, 0, sizeof (mbstate_t));

View File

@ -328,6 +328,13 @@ _rl_isearch_dispatch (cxt, c)
f = (rl_command_func_t *)NULL; f = (rl_command_func_t *)NULL;
if (c < 0)
{
cxt->sflags |= SF_FAILED;
cxt->history_pos = cxt->last_found_line;
return -1;
}
/* Translate the keys we do something with to opcodes. */ /* Translate the keys we do something with to opcodes. */
if (c >= 0 && _rl_keymap[c].type == ISFUNC) if (c >= 0 && _rl_keymap[c].type == ISFUNC)
{ {

2
misc.c
View File

@ -146,6 +146,8 @@ _rl_arg_dispatch (cxt, c)
rl_restore_prompt (); rl_restore_prompt ();
rl_clear_message (); rl_clear_message ();
RL_UNSETSTATE(RL_STATE_NUMERICARG); RL_UNSETSTATE(RL_STATE_NUMERICARG);
if (key < 0)
return -1;
return (_rl_dispatch (key, _rl_keymap)); return (_rl_dispatch (key, _rl_keymap));
} }
} }

View File

@ -645,6 +645,11 @@ _rl_dispatch_callback (cxt)
if ((cxt->flags & KSEQ_DISPATCHED) == 0) if ((cxt->flags & KSEQ_DISPATCHED) == 0)
{ {
nkey = _rl_subseq_getchar (cxt->okey); nkey = _rl_subseq_getchar (cxt->okey);
if (nkey < 0)
{
_rl_abort_internal ();
return -1;
}
r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg); r = _rl_dispatch_subseq (nkey, cxt->dmap, cxt->subseq_arg);
cxt->flags |= KSEQ_DISPATCHED; cxt->flags |= KSEQ_DISPATCHED;
} }

View File

@ -33,6 +33,7 @@ extern "C" {
# include "keymaps.h" # include "keymaps.h"
# include "tilde.h" # include "tilde.h"
#else #else
# include <stdio.h>
# include <readline/rlstdc.h> # include <readline/rlstdc.h>
# include <readline/rltypedefs.h> # include <readline/rltypedefs.h>
# include <readline/keymaps.h> # include <readline/keymaps.h>
@ -373,7 +374,7 @@ extern int rl_reset_line_state PARAMS((void));
extern int rl_crlf PARAMS((void)); extern int rl_crlf PARAMS((void));
#if defined (USE_VARARGS) && defined (PREFER_STDARG) #if defined (USE_VARARGS) && defined (PREFER_STDARG)
extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2))); extern int rl_message (const char *, ...) __rl_attribute__((__format__ (printf, 1, 2)));
#else #else
extern int rl_message (); extern int rl_message ();
#endif #endif

View File

@ -36,10 +36,10 @@
# endif # endif
#endif #endif
#ifndef __attribute__ #if defined(__GNUC__) && __GNUC__ >= 2
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) # define __rl_attribute__(x) __attribute__(x)
# define __attribute__(x) #else
# endif # define __rl_attribute__(x)
#endif #endif
#endif /* !_RL_STDC_H_ */ #endif /* !_RL_STDC_H_ */

View File

@ -10,7 +10,7 @@
# Chet Ramey # Chet Ramey
# chet@po.cwru.edu # chet@po.cwru.edu
# Copyright (C) 1996-2002 Free Software Foundation, Inc. # Copyright (C) 1996-2007 Free Software Foundation, Inc.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -110,11 +110,11 @@ linux*-*|gnu*-*|k*bsd*-gnu-*)
SHOBJ_LD='${CC}' SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@' SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`' SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)' SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;; ;;
freebsd2* | netbsd*) freebsd2*)
SHOBJ_CFLAGS=-fpic SHOBJ_CFLAGS=-fpic
SHOBJ_LD=ld SHOBJ_LD=ld
SHOBJ_LDFLAGS='-x -Bshareable' SHOBJ_LDFLAGS='-x -Bshareable'
@ -125,7 +125,7 @@ freebsd2* | netbsd*)
# FreeBSD-3.x ELF # FreeBSD-3.x ELF
freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*) freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
SHOBJ_CFLAGS=-fpic SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}' SHOBJ_LD='${CC}'
if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
@ -142,7 +142,7 @@ freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
;; ;;
# Darwin/MacOS X # Darwin/MacOS X
darwin8*) darwin[89]*)
SHOBJ_STATUS=supported SHOBJ_STATUS=supported
SHLIB_STATUS=supported SHLIB_STATUS=supported
@ -153,7 +153,7 @@ darwin8*)
SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)' SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
SHLIB_LIBSUFF='dylib' SHLIB_LIBSUFF='dylib'
SHOBJ_LDFLAGS='-undefined dynamic_lookup' SHOBJ_LDFLAGS='-dynamiclib -dynamic -undefined dynamic_lookup -arch_only `/usr/bin/arch`'
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1 SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
@ -171,7 +171,7 @@ darwin*|macosx*)
SHLIB_LIBSUFF='dylib' SHLIB_LIBSUFF='dylib'
case "${host_os}" in case "${host_os}" in
darwin[78]*) SHOBJ_LDFLAGS='' darwin[789]*) SHOBJ_LDFLAGS=''
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v' SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
;; ;;
*) SHOBJ_LDFLAGS='-dynamic' *) SHOBJ_LDFLAGS='-dynamic'
@ -182,7 +182,7 @@ darwin*|macosx*)
SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1 SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
;; ;;
openbsd*) openbsd*|netbsd*)
SHOBJ_CFLAGS=-fPIC SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}' SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared' SHOBJ_LDFLAGS='-shared'
@ -247,7 +247,7 @@ osf*)
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;; ;;
aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com aix4.[2-9]*-*gcc*|aix[5-9].*-*gcc*) # lightly tested by jik@cisco.com
SHOBJ_CFLAGS=-fpic SHOBJ_CFLAGS=-fpic
SHOBJ_LD='ld' SHOBJ_LD='ld'
SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall' SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
@ -258,7 +258,7 @@ aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)' SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;; ;;
aix4.[2-9]*) aix4.[2-9]*|aix[5-9].*)
SHOBJ_CFLAGS=-K SHOBJ_CFLAGS=-K
SHOBJ_LD='ld' SHOBJ_LD='ld'
SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall' SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
@ -329,7 +329,7 @@ hpux10*-*gcc*)
SHOBJ_LD='${CC}' SHOBJ_LD='${CC}'
# if you have problems linking here, moving the `-Wl,+h,$@' from # if you have problems linking here, moving the `-Wl,+h,$@' from
# SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work # SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work
SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s' SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s'
SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)' SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)'
SHLIB_LIBSUFF='sl' SHLIB_LIBSUFF='sl'

9
text.c
View File

@ -857,6 +857,9 @@ _rl_insert_next (count)
c = rl_read_key (); c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT); RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (c < 0)
return -1;
#if defined (HANDLE_SIGNALS) #if defined (HANDLE_SIGNALS)
if (RL_ISSTATE (RL_STATE_CALLBACK) == 0) if (RL_ISSTATE (RL_STATE_CALLBACK) == 0)
_rl_restore_tty_signals (); _rl_restore_tty_signals ();
@ -1520,6 +1523,9 @@ _rl_char_search (count, fdir, bdir)
mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX); mb_len = _rl_read_mbchar (mbchar, MB_LEN_MAX);
if (mb_len <= 0)
return -1;
if (count < 0) if (count < 0)
return (_rl_char_search_internal (-count, bdir, mbchar, mb_len)); return (_rl_char_search_internal (-count, bdir, mbchar, mb_len));
else else
@ -1536,6 +1542,9 @@ _rl_char_search (count, fdir, bdir)
c = rl_read_key (); c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT); RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (c < 0)
return -1;
if (count < 0) if (count < 0)
return (_rl_char_search_internal (-count, bdir, c)); return (_rl_char_search_internal (-count, bdir, c));
else else

View File

@ -886,6 +886,13 @@ rl_vi_domove (key, nextkey)
RL_SETSTATE(RL_STATE_MOREINPUT); RL_SETSTATE(RL_STATE_MOREINPUT);
c = rl_read_key (); c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT); RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (c < 0)
{
*nextkey = 0;
return -1;
}
*nextkey = c; *nextkey = c;
if (!member (c, vi_motion)) if (!member (c, vi_motion))
@ -902,6 +909,11 @@ rl_vi_domove (key, nextkey)
RL_SETSTATE(RL_STATE_MOREINPUT); RL_SETSTATE(RL_STATE_MOREINPUT);
c = rl_read_key (); /* real command */ c = rl_read_key (); /* real command */
RL_UNSETSTATE(RL_STATE_MOREINPUT); RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (c < 0)
{
*nextkey = 0;
return -1;
}
*nextkey = c; *nextkey = c;
} }
else if (key == c && (key == 'd' || key == 'y' || key == 'c')) else if (key == c && (key == 'd' || key == 'y' || key == 'c'))
@ -1224,14 +1236,22 @@ static int
_rl_vi_callback_char_search (data) _rl_vi_callback_char_search (data)
_rl_callback_generic_arg *data; _rl_callback_generic_arg *data;
{ {
int c;
#if defined (HANDLE_MULTIBYTE) #if defined (HANDLE_MULTIBYTE)
_rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); c = _rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
#else #else
RL_SETSTATE(RL_STATE_MOREINPUT); RL_SETSTATE(RL_STATE_MOREINPUT);
_rl_vi_last_search_char = rl_read_key (); c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT); RL_UNSETSTATE(RL_STATE_MOREINPUT);
#endif #endif
if (c <= 0)
return -1;
#if !defined (HANDLE_MULTIBYTE)
_rl_vi_last_search_char = c;
#endif
_rl_callback_func = 0; _rl_callback_func = 0;
_rl_want_redisplay = 1; _rl_want_redisplay = 1;
@ -1247,6 +1267,7 @@ int
rl_vi_char_search (count, key) rl_vi_char_search (count, key)
int count, key; int count, key;
{ {
int c;
#if defined (HANDLE_MULTIBYTE) #if defined (HANDLE_MULTIBYTE)
static char *target; static char *target;
static int tlen; static int tlen;
@ -1293,11 +1314,17 @@ rl_vi_char_search (count, key)
else else
{ {
#if defined (HANDLE_MULTIBYTE) #if defined (HANDLE_MULTIBYTE)
_rl_vi_last_search_mblen = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX); c = _rl_read_mbchar (_rl_vi_last_search_mbchar, MB_LEN_MAX);
if (c <= 0)
return -1;
_rl_vi_last_search_mblen = c;
#else #else
RL_SETSTATE(RL_STATE_MOREINPUT); RL_SETSTATE(RL_STATE_MOREINPUT);
_rl_vi_last_search_char = rl_read_key (); c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT); RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (c < 0)
return -1;
_rl_vi_last_search_char = c;
#endif #endif
} }
} }
@ -1467,6 +1494,9 @@ _rl_vi_callback_getchar (mb, mlen)
c = rl_read_key (); c = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT); RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (c < 0)
return -1;
#if defined (HANDLE_MULTIBYTE) #if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
c = _rl_read_mbstring (c, mb, mlen); c = _rl_read_mbstring (c, mb, mlen);
@ -1485,6 +1515,9 @@ _rl_vi_callback_change_char (data)
_rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX); _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
if (c < 0)
return -1;
_rl_callback_func = 0; _rl_callback_func = 0;
_rl_want_redisplay = 1; _rl_want_redisplay = 1;
@ -1516,6 +1549,9 @@ rl_vi_change_char (count, key)
else else
_rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX); _rl_vi_last_replacement = c = _rl_vi_callback_getchar (mb, MB_LEN_MAX);
if (c < 0)
return -1;
return (_rl_vi_change_char (count, c, mb)); return (_rl_vi_change_char (count, c, mb));
} }
@ -1650,7 +1686,7 @@ _rl_vi_set_mark ()
ch = rl_read_key (); ch = rl_read_key ();
RL_UNSETSTATE(RL_STATE_MOREINPUT); RL_UNSETSTATE(RL_STATE_MOREINPUT);
if (ch < 'a' || ch > 'z') if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
{ {
rl_ding (); rl_ding ();
return -1; return -1;
@ -1702,7 +1738,7 @@ _rl_vi_goto_mark ()
rl_point = rl_mark; rl_point = rl_mark;
return 0; return 0;
} }
else if (ch < 'a' || ch > 'z') else if (ch < 0 || ch < 'a' || ch > 'z') /* make test against 0 explicit */
{ {
rl_ding (); rl_ding ();
return -1; return -1;