readline 8.2-1

This commit is contained in:
xhaa123 2024-04-22 16:45:47 +08:00
commit 981f3e933d
3 changed files with 479 additions and 0 deletions

54
PKGBUILD Normal file
View File

@ -0,0 +1,54 @@
# This is an example PKGBUILD file. Use this as a start to creating your own,
# and remove these comments. For more information, see 'man PKGBUILD'.
# NOTE: Please fill out the license field for your package! If it is unknown,
# then please put 'unknown'.
# Maintainer: Future Linux Team <future_linux@163.com>
pkgname=readline
pkgver=8.2
pkgrel=1
pkgdesc="GNU readline library"
arch=('x86_64')
url="https://tiswww.case.edu/php/chet/readline/rltop.html"
license=('GPL-3.0-only')
depends=('glibc' 'ncurses')
backup=(etc/inputrc)
options=('!emptydirs')
source=(https://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.gz
${pkgname}-${pkgver}-upstream_fixes-3.patch
inputrc)
sha256sums=(3feb7171f16a84ee82ca18a36d7b9be109a52c04f492a053331d7d1095007c35
8a108b34c5bdf9d6a9d6c0bd4cf2da756ae5232c5de2ae55c5468e953bb8de62
a3aa8df347eed0730e73fc9309da6fb6033b25c4e0a8e27c24faa8a55391d7f3)
prepare() {
cd ${pkgname}-${pkgver}
sed -i '/MV.*old/d' Makefile.in
sed -i '/{OLDSUFF}/c:' support/shlib-install
patch -Np1 -i ${srcdir}/${pkgname}-${pkgver}-upstream_fixes-3.patch
}
build() {
cd ${pkgname}-${pkgver}
CFLAGS="${CFLAGS} -fPIC"
${CONFIGURE} \
--disable-static \
--with-curses \
--docdir=/usr/share/doc/${pkgname}-${pkgver}
make SHLIB_LIBS="-lncursesw"
}
package() {
cd ${pkgname}-${pkgver}
make DESTDIR=${pkgdir} SHLIB_LIBS="-lncursesw" install
install -v -m644 doc/*.{ps,pdf,html,dvi} ${pkgdir}/usr/share/doc/${pkgname}-${pkgver}
install -vDm644 ${srcdir}/inputrc ${pkgdir}/etc/inputrc
}

36
inputrc Normal file
View File

@ -0,0 +1,36 @@
# Allow the command prompt to wrap to the next line
set horizontal-scroll-mode Off
# Enable 8-bit input
set meta-flag On
set input-meta On
# Turns off 8th bit stripping
set convert-meta Off
# Keep the 8th bit for display
set output-meta On
# none, visible or audible
set bell-style none
# All of the following map the escape sequence of the value
# contained in the 1st argument to the readline specific functions
"\eOd": backward-word
"\eOc": forward-word
# for linux console
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
# for xterm
"\eOH": beginning-of-line
"\eOF": end-of-line
# for Konsole
"\e[H": beginning-of-line
"\e[F": end-of-line

View File

@ -0,0 +1,389 @@
Submitted By: Xi Ruoyao <xry111@xry111.site>
Date: 2024-01-24
Initial Package Version: 8.2
Upstream Status: Applied
Origin: Upstream release repository
Upstream patches 001-010
https://ftp.gnu.org/gnu/readline/readline-8.2-patches/
diff -Naur readline-8.2/callback.c readline-8.2-new/callback.c
--- readline-8.2/callback.c 2022-04-29 11:02:56.000000000 -0500
+++ readline-8.2-new/callback.c 2023-11-29 22:42:24.756589994 -0600
@@ -115,7 +115,10 @@
#define CALLBACK_READ_RETURN() \
do { \
if (rl_persistent_signal_handlers == 0) \
- rl_clear_signals (); \
+ { \
+ rl_clear_signals (); \
+ if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \
+ } \
return; \
} while (0)
#else
diff -Naur readline-8.2/colors.c readline-8.2-new/colors.c
--- readline-8.2/colors.c 2021-12-08 10:38:25.000000000 -0600
+++ readline-8.2-new/colors.c 2023-11-29 22:42:10.917236651 -0600
@@ -73,7 +73,7 @@
static bool is_colored (enum indicator_no type);
static void restore_default_color (void);
-#define RL_COLOR_PREFIX_EXTENSION "readline-colored-completion-prefix"
+#define RL_COLOR_PREFIX_EXTENSION ".readline-colored-completion-prefix"
COLOR_EXT_TYPE *_rl_color_ext_list = 0;
diff -Naur readline-8.2/display.c readline-8.2-new/display.c
--- readline-8.2/display.c 2022-04-05 09:47:31.000000000 -0500
+++ readline-8.2-new/display.c 2023-11-29 22:42:52.933309382 -0600
@@ -2683,11 +2683,8 @@
register char *temp;
if (visible_line)
- {
- temp = visible_line;
- while (*temp)
- *temp++ = '\0';
- }
+ memset (visible_line, 0, line_size);
+
rl_on_new_line ();
forced_display++;
(*rl_redisplay_function) ();
@@ -3341,9 +3338,9 @@
puts_face (&last_line[_rl_screenwidth - 1 + woff],
&last_face[_rl_screenwidth - 1 + woff], 1);
}
- _rl_vis_botlin = 0;
- if (botline_length > 0 || _rl_last_c_pos > 0)
+ if ((_rl_vis_botlin == 0 && botline_length == 0) || botline_length > 0 || _rl_last_c_pos > 0)
rl_crlf ();
+ _rl_vis_botlin = 0;
fflush (rl_outstream);
rl_display_fixed++;
}
diff -Naur readline-8.2/input.c readline-8.2-new/input.c
--- readline-8.2/input.c 2022-04-08 14:43:24.000000000 -0500
+++ readline-8.2-new/input.c 2023-11-29 22:42:35.253858003 -0600
@@ -151,7 +151,9 @@
int _rl_timeout_init (void);
int _rl_timeout_sigalrm_handler (void);
+#if defined (RL_TIMEOUT_USE_SELECT)
int _rl_timeout_select (int, fd_set *, fd_set *, fd_set *, const struct timeval *, const sigset_t *);
+#endif
static void _rl_timeout_handle (void);
#if defined (RL_TIMEOUT_USE_SIGALRM)
@@ -248,7 +250,7 @@
register int tem, result;
int chars_avail, k;
char input;
-#if defined(HAVE_SELECT)
+#if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
fd_set readfds, exceptfds;
struct timeval timeout;
#endif
@@ -802,10 +804,10 @@
int
rl_getc (FILE *stream)
{
- int result;
+ int result, ostate, osig;
unsigned char c;
int fd;
-#if defined (HAVE_PSELECT)
+#if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
sigset_t empty_set;
fd_set readfds;
#endif
@@ -813,8 +815,22 @@
fd = fileno (stream);
while (1)
{
+ osig = _rl_caught_signal;
+ ostate = rl_readline_state;
+
RL_CHECK_SIGNALS ();
+#if defined (READLINE_CALLBACKS)
+ /* Do signal handling post-processing here, but just in callback mode
+ for right now because the signal cleanup can change some of the
+ callback state, and we need to either let the application have a
+ chance to react or abort some current operation that gets cleaned
+ up by rl_callback_sigcleanup(). If not, we'll just run through the
+ loop again. */
+ if (osig != 0 && (ostate & RL_STATE_CALLBACK))
+ goto postproc_signal;
+#endif
+
/* We know at this point that _rl_caught_signal == 0 */
#if defined (__MINGW32__)
@@ -878,6 +894,9 @@
/* fprintf(stderr, "rl_getc: result = %d errno = %d\n", result, errno); */
handle_error:
+ osig = _rl_caught_signal;
+ ostate = rl_readline_state;
+
/* If the error that we received was EINTR, then try again,
this is simply an interrupted system call to read (). We allow
the read to be interrupted if we caught SIGHUP, SIGTERM, or any
@@ -918,8 +937,17 @@
RL_CHECK_SIGNALS ();
#endif /* SIGALRM */
+postproc_signal:
+ /* POSIX says read(2)/pselect(2)/select(2) don't return EINTR for any
+ reason other than being interrupted by a signal, so we can safely
+ call the application's signal event hook. */
if (rl_signal_event_hook)
(*rl_signal_event_hook) ();
+#if defined (READLINE_CALLBACKS)
+ else if (osig == SIGINT && (ostate & RL_STATE_CALLBACK) && (ostate & (RL_STATE_ISEARCH|RL_STATE_NSEARCH|RL_STATE_NUMERICARG)))
+ /* just these cases for now */
+ _rl_abort_internal ();
+#endif
}
}
diff -Naur readline-8.2/nls.c readline-8.2-new/nls.c
--- readline-8.2/nls.c 2022-08-15 08:38:51.000000000 -0500
+++ readline-8.2-new/nls.c 2023-11-29 22:42:00.068959677 -0600
@@ -141,6 +141,10 @@
if (lspec == 0)
lspec = "";
ret = setlocale (LC_CTYPE, lspec); /* ok, since it does not change locale */
+ if (ret == 0 || *ret == 0)
+ ret = setlocale (LC_CTYPE, (char *)NULL);
+ if (ret == 0 || *ret == 0)
+ ret = RL_DEFAULT_LOCALE;
#else
ret = (lspec == 0 || *lspec == 0) ? RL_DEFAULT_LOCALE : lspec;
#endif
diff -Naur readline-8.2/patchlevel readline-8.2-new/patchlevel
--- readline-8.2/patchlevel 2020-05-21 13:22:40.000000000 -0500
+++ readline-8.2-new/patchlevel 2023-11-29 22:42:52.933309382 -0600
@@ -1,3 +1,3 @@
# Do not edit -- exists only for use by patch
-0
+7
READLINE PATCH REPORT
=====================
Readline-Release: 8.2
Patch-ID: readline82-008
Bug-Reported-by:
Bug-Reference-ID:
Bug-Reference-URL:
Bug-Description:
Add missing prototypes for several function declarations.
Patch (apply with `patch -p0'):
*** readline-8.2-patched/text.c Wed Oct 27 11:03:59 2021
--- readline/text.c Thu Nov 16 16:24:58 2023
***************
*** 1765,1770 ****
#if defined (READLINE_CALLBACKS)
static int
! _rl_char_search_callback (data)
! _rl_callback_generic_arg *data;
{
_rl_callback_func = 0;
--- 1765,1769 ----
#if defined (READLINE_CALLBACKS)
static int
! _rl_char_search_callback (_rl_callback_generic_arg *data)
{
_rl_callback_func = 0;
*** readline-8.2-patched/bind.c Wed Feb 9 11:02:22 2022
--- readline/bind.c Thu Nov 16 16:25:17 2023
***************
*** 1168,1174 ****
static int
! parse_comparison_op (s, indp)
! const char *s;
! int *indp;
{
int i, peekc, op;
--- 1168,1172 ----
static int
! parse_comparison_op (const char *s, int *indp)
{
int i, peekc, op;
*** readline-8.2-patched/rltty.c Fri Feb 18 11:14:22 2022
--- readline/rltty.c Thu Nov 16 16:25:36 2023
***************
*** 81,86 ****
to get the tty settings. */
static void
! set_winsize (tty)
! int tty;
{
#if defined (TIOCGWINSZ)
--- 81,85 ----
to get the tty settings. */
static void
! set_winsize (int tty)
{
#if defined (TIOCGWINSZ)
*** readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500
--- readline/patchlevel 2014-03-21 08:28:40.000000000 -0400
***************
*** 1,3 ****
# Do not edit -- exists only for use by patch
! 7
--- 1,3 ----
# Do not edit -- exists only for use by patch
! 8
READLINE PATCH REPORT
=====================
Readline-Release: 8.2
Patch-ID: readline82-009
Bug-Reported-by: Stefan H. Holek <stefan@epy.co.at>
Bug-Reference-ID: <50F8DA45-B7F3-4DE1-AB94-19AE42649CDC@epy.co.at>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2022-10/msg00021.html
Bug-Description:
Fix issue where the directory name portion of the word to be completed (the
part that is passed to opendir()) requires both tilde expansion and dequoting.
Readline only performed tilde expansion in this case, so filename completion
would fail.
Patch (apply with `patch -p0'):
*** readline-8.2-patched/complete.c 2022-04-05 10:47:06.000000000 -0400
--- readline/complete.c 2022-10-26 15:08:51.000000000 -0400
***************
*** 2527,2531 ****
xfree (dirname);
dirname = temp;
! tilde_dirname = 1;
}
--- 2527,2532 ----
xfree (dirname);
dirname = temp;
! if (*dirname != '~')
! tilde_dirname = 1; /* indicate successful tilde expansion */
}
***************
*** 2546,2554 ****
users_dirname = savestring (dirname);
}
! else if (tilde_dirname == 0 && rl_completion_found_quote && rl_filename_dequoting_function)
{
! /* delete single and double quotes */
xfree (dirname);
! dirname = savestring (users_dirname);
}
directory = opendir (dirname);
--- 2547,2560 ----
users_dirname = savestring (dirname);
}
! else if (rl_completion_found_quote && rl_filename_dequoting_function)
{
! /* We already ran users_dirname through the dequoting function.
! If tilde_dirname == 1, we successfully performed tilde expansion
! on dirname. Now we need to reconcile those results. We either
! just copy the already-dequoted users_dirname or tilde expand it
! if we tilde-expanded dirname. */
! temp = tilde_dirname ? tilde_expand (users_dirname) : savestring (users_dirname);
xfree (dirname);
! dirname = temp;
}
directory = opendir (dirname);
*** readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500
--- readline/patchlevel 2014-03-21 08:28:40.000000000 -0400
***************
*** 1,3 ****
# Do not edit -- exists only for use by patch
! 8
--- 1,3 ----
# Do not edit -- exists only for use by patch
! 9
READLINE PATCH REPORT
=====================
Readline-Release: 8.2
Patch-ID: readline82-010
Bug-Reported-by: Martin Castillo <castilma@uni-bremen.de>
Bug-Reference-ID: <2d42153b-cf65-caba-dff1-cd3bc6268c7e@uni-bremen.de>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2023-01/msg00000.html
Bug-Description:
Fix the case where text to be completed from the line buffer (quoted) is
compared to the common prefix of the possible matches (unquoted) and the
quoting makes the former appear to be longer than the latter. Readline
assumes the match doesn't add any characters to the word and doesn't display
multiple matches.
Patch (apply with `patch -p0'):
*** readline-8.2-patched/complete.c Tue Apr 5 10:47:06 2022
--- readline/complete.c Sat Jan 7 14:19:45 2023
***************
*** 2032,2038 ****
text = rl_copy_text (start, end);
matches = gen_completion_matches (text, start, end, our_func, found_quote, quote_char);
/* nontrivial_lcd is set if the common prefix adds something to the word
being completed. */
! nontrivial_lcd = matches && compare_match (text, matches[0]) != 0;
if (what_to_do == '!' || what_to_do == '@')
tlen = strlen (text);
--- 2038,2060 ----
text = rl_copy_text (start, end);
matches = gen_completion_matches (text, start, end, our_func, found_quote, quote_char);
+ /* If TEXT contains quote characters, it will be dequoted as part of
+ generating the matches, and the matches will not contain any quote
+ characters. We need to dequote TEXT before performing the comparison.
+ Since compare_match performs the dequoting, and we only want to do it
+ once, we don't call compare_matches after dequoting TEXT; we call
+ strcmp directly. */
/* nontrivial_lcd is set if the common prefix adds something to the word
being completed. */
! if (rl_filename_completion_desired && rl_filename_quoting_desired &&
! rl_completion_found_quote && rl_filename_dequoting_function)
! {
! char *t;
! t = (*rl_filename_dequoting_function) (text, rl_completion_quote_character);
! xfree (text);
! text = t;
! nontrivial_lcd = matches && strcmp (text, matches[0]) != 0;
! }
! else
! nontrivial_lcd = matches && strcmp (text, matches[0]) != 0;
if (what_to_do == '!' || what_to_do == '@')
tlen = strlen (text);
*** readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500
--- readline/patchlevel 2014-03-21 08:28:40.000000000 -0400
***************
*** 1,3 ****
# Do not edit -- exists only for use by patch
! 9
--- 1,3 ----
# Do not edit -- exists only for use by patch
! 10