From 590e8bc54d1354a6c6e03a65ece94d0002c691da Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Mon, 22 Jan 2024 14:34:20 +0100 Subject: [PATCH] Update to readline-8.2 patchlevel 10 Resolves: #2259635 --- readline-8.2-patch-10.patch | 38 ++++++++++++++++++++ readline-8.2-patch-2.patch | 25 +++++++++++++ readline-8.2-patch-3.patch | 20 +++++++++++ readline-8.2-patch-4.patch | 39 ++++++++++++++++++++ readline-8.2-patch-5.patch | 23 ++++++++++++ readline-8.2-patch-6.patch | 71 +++++++++++++++++++++++++++++++++++++ readline-8.2-patch-7.patch | 23 ++++++++++++ readline-8.2-patch-8.patch | 48 +++++++++++++++++++++++++ readline-8.2-patch-9.patch | 41 +++++++++++++++++++++ readline.spec | 15 +++++++- 10 files changed, 342 insertions(+), 1 deletion(-) create mode 100644 readline-8.2-patch-10.patch create mode 100644 readline-8.2-patch-2.patch create mode 100644 readline-8.2-patch-3.patch create mode 100644 readline-8.2-patch-4.patch create mode 100644 readline-8.2-patch-5.patch create mode 100644 readline-8.2-patch-6.patch create mode 100644 readline-8.2-patch-7.patch create mode 100644 readline-8.2-patch-8.patch create mode 100644 readline-8.2-patch-9.patch diff --git a/readline-8.2-patch-10.patch b/readline-8.2-patch-10.patch new file mode 100644 index 0000000..123a24f --- /dev/null +++ b/readline-8.2-patch-10.patch @@ -0,0 +1,38 @@ +diff --git a/complete.c b/complete.c +--- a/complete.c ++++ b/complete.c +@@ -2031,9 +2031,25 @@ rl_complete_internal (int what_to_do) + + 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. */ +- nontrivial_lcd = matches && compare_match (text, matches[0]) != 0; ++ 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); + xfree (text); +diff --git a/patchlevel b/patchlevel +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-9 ++10 diff --git a/readline-8.2-patch-2.patch b/readline-8.2-patch-2.patch new file mode 100644 index 0000000..e8f08c3 --- /dev/null +++ b/readline-8.2-patch-2.patch @@ -0,0 +1,25 @@ +diff --git a/display.c b/display.c +--- a/display.c ++++ b/display.c +@@ -2683,11 +2683,8 @@ rl_forced_update_display (void) + 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) (); +diff --git a/patchlevel b/patchlevel +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-1 ++2 diff --git a/readline-8.2-patch-3.patch b/readline-8.2-patch-3.patch new file mode 100644 index 0000000..93e8bf3 --- /dev/null +++ b/readline-8.2-patch-3.patch @@ -0,0 +1,20 @@ +diff --git a/colors.c b/colors.c +--- a/colors.c ++++ b/colors.c +@@ -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 --git a/patchlevel b/patchlevel +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-2 ++3 diff --git a/readline-8.2-patch-4.patch b/readline-8.2-patch-4.patch new file mode 100644 index 0000000..62997d0 --- /dev/null +++ b/readline-8.2-patch-4.patch @@ -0,0 +1,39 @@ +diff --git a/input.c b/input.c +--- a/input.c ++++ b/input.c +@@ -151,7 +151,9 @@ int rl_timeout_remaining (unsigned int *, unsigned int *); + + 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 @@ rl_gather_tyi (void) + 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 +@@ -805,7 +807,7 @@ rl_getc (FILE *stream) + int result; + unsigned char c; + int fd; +-#if defined (HAVE_PSELECT) ++#if defined (HAVE_PSELECT) || defined (HAVE_SELECT) + sigset_t empty_set; + fd_set readfds; + #endif +diff --git a/patchlevel b/patchlevel +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-3 ++4 diff --git a/readline-8.2-patch-5.patch b/readline-8.2-patch-5.patch new file mode 100644 index 0000000..085dad7 --- /dev/null +++ b/readline-8.2-patch-5.patch @@ -0,0 +1,23 @@ +diff --git a/callback.c b/callback.c +--- a/callback.c ++++ b/callback.c +@@ -115,7 +115,10 @@ rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *linefunc) + #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 --git a/patchlevel b/patchlevel +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-4 ++5 diff --git a/readline-8.2-patch-6.patch b/readline-8.2-patch-6.patch new file mode 100644 index 0000000..44723b4 --- /dev/null +++ b/readline-8.2-patch-6.patch @@ -0,0 +1,71 @@ +diff --git a/input.c b/input.c +--- a/input.c ++++ b/input.c +@@ -804,7 +804,7 @@ rl_read_key (void) + int + rl_getc (FILE *stream) + { +- int result; ++ int result, ostate, osig; + unsigned char c; + int fd; + #if defined (HAVE_PSELECT) || defined (HAVE_SELECT) +@@ -815,8 +815,22 @@ rl_getc (FILE *stream) + 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__) +@@ -880,6 +894,9 @@ rl_getc (FILE *stream) + /* 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 +@@ -920,8 +937,17 @@ handle_error: + 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 --git a/patchlevel b/patchlevel +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-5 ++6 diff --git a/readline-8.2-patch-7.patch b/readline-8.2-patch-7.patch new file mode 100644 index 0000000..dbcde60 --- /dev/null +++ b/readline-8.2-patch-7.patch @@ -0,0 +1,23 @@ +diff --git a/display.c b/display.c +--- a/display.c ++++ b/display.c +@@ -3338,9 +3338,9 @@ _rl_update_final (void) + 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 --git a/patchlevel b/patchlevel +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-6 ++7 diff --git a/readline-8.2-patch-8.patch b/readline-8.2-patch-8.patch new file mode 100644 index 0000000..1748abc --- /dev/null +++ b/readline-8.2-patch-8.patch @@ -0,0 +1,48 @@ +diff --git a/bind.c b/bind.c +--- a/bind.c ++++ b/bind.c +@@ -1167,9 +1167,7 @@ _rl_init_file_error (va_alist) + /* **************************************************************** */ + + static int +-parse_comparison_op (s, indp) +- const char *s; +- int *indp; ++parse_comparison_op (const char *s, int *indp) + { + int i, peekc, op; + +diff --git a/patchlevel b/patchlevel +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-7 ++8 +diff --git a/rltty.c b/rltty.c +--- a/rltty.c ++++ b/rltty.c +@@ -80,8 +80,7 @@ static int ksrflow; + /* Dummy call to force a backgrounded readline to stop before it tries + to get the tty settings. */ + static void +-set_winsize (tty) +- int tty; ++set_winsize (int tty) + { + #if defined (TIOCGWINSZ) + struct winsize w; +diff --git a/text.c b/text.c +--- a/text.c ++++ b/text.c +@@ -1764,8 +1764,7 @@ _rl_char_search (int count, int fdir, int bdir) + + #if defined (READLINE_CALLBACKS) + static int +-_rl_char_search_callback (data) +- _rl_callback_generic_arg *data; ++_rl_char_search_callback (_rl_callback_generic_arg *data) + { + _rl_callback_func = 0; + _rl_want_redisplay = 1; diff --git a/readline-8.2-patch-9.patch b/readline-8.2-patch-9.patch new file mode 100644 index 0000000..94829dc --- /dev/null +++ b/readline-8.2-patch-9.patch @@ -0,0 +1,41 @@ +diff --git a/complete.c b/complete.c +--- a/complete.c ++++ b/complete.c +@@ -2526,7 +2526,8 @@ rl_filename_completion_function (const char *text, int state) + temp = tilde_expand (dirname); + xfree (dirname); + dirname = temp; +- tilde_dirname = 1; ++ if (*dirname != '~') ++ tilde_dirname = 1; /* indicate successful tilde expansion */ + } + + /* We have saved the possibly-dequoted version of the directory name +@@ -2545,11 +2546,16 @@ rl_filename_completion_function (const char *text, int state) + xfree (users_dirname); + users_dirname = savestring (dirname); + } +- else if (tilde_dirname == 0 && rl_completion_found_quote && rl_filename_dequoting_function) ++ else if (rl_completion_found_quote && rl_filename_dequoting_function) + { +- /* delete single and double quotes */ ++ /* 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 = savestring (users_dirname); ++ dirname = temp; + } + directory = opendir (dirname); + +diff --git a/patchlevel b/patchlevel +--- a/patchlevel ++++ b/patchlevel +@@ -1,3 +1,3 @@ + # Do not edit -- exists only for use by patch + +-8 ++9 diff --git a/readline.spec b/readline.spec index 7ee7948..ce1e945 100644 --- a/readline.spec +++ b/readline.spec @@ -1,7 +1,7 @@ Summary: A library for editing typed command lines Name: readline Version: 8.2 -Release: 6%{?dist} +Release: 7%{?dist} # * Main sources are GPL-3.0-or-later # * examples/rlfe are GPL-2.0-or-later @@ -14,6 +14,15 @@ Source: ftp://ftp.gnu.org/gnu/readline/readline-%{version}.tar.gz # Official upstream patches # Patches are converted to apply with '-p1' Patch1: readline-8.2-patch-1.patch +Patch2: readline-8.2-patch-2.patch +Patch3: readline-8.2-patch-3.patch +Patch4: readline-8.2-patch-4.patch +Patch5: readline-8.2-patch-5.patch +Patch6: readline-8.2-patch-6.patch +Patch7: readline-8.2-patch-7.patch +Patch8: readline-8.2-patch-8.patch +Patch9: readline-8.2-patch-9.patch +Patch10: readline-8.2-patch-10.patch # Other patches # Remove RPATH, use CFLAGS @@ -88,6 +97,10 @@ rm -vf %{buildroot}%{_infodir}/dir* %{_libdir}/libhistory.a %changelog +* Mon Jan 22 2024 Siteshwar Vashisht - 8.2-7 +- Update to readline-8.2 patchlevel 10 + Resolves: #2259635 + * Mon Jan 22 2024 Fedora Release Engineering - 8.2-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild