From 528eed1bd6ab2a128f46b8b015b63cbd569bc05b3c0d5398dadeee0e7baf89c1 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Tue, 21 Nov 2023 07:05:04 +0000 Subject: [PATCH] Update to readline 8.2 patchlevel 7 OBS-URL: https://build.opensuse.org/package/show/Base:System/readline?expand=0&rev=35 --- readline-6.3-input.dif | 4 +- readline.changes | 28 ++++++++++++ readline.spec | 38 +++++++++++----- readline82-002 | 48 ++++++++++++++++++++ readline82-002.sig | Bin 0 -> 95 bytes readline82-003 | 43 ++++++++++++++++++ readline82-003.sig | Bin 0 -> 95 bytes readline82-004 | 65 +++++++++++++++++++++++++++ readline82-004.sig | Bin 0 -> 95 bytes readline82-005 | 50 +++++++++++++++++++++ readline82-005.sig | Bin 0 -> 95 bytes readline82-006 | 99 +++++++++++++++++++++++++++++++++++++++++ readline82-006.sig | Bin 0 -> 95 bytes readline82-007 | 48 ++++++++++++++++++++ readline82-007.sig | Bin 0 -> 95 bytes 15 files changed, 411 insertions(+), 12 deletions(-) create mode 100644 readline82-002 create mode 100644 readline82-002.sig create mode 100644 readline82-003 create mode 100644 readline82-003.sig create mode 100644 readline82-004 create mode 100644 readline82-004.sig create mode 100644 readline82-005 create mode 100644 readline82-005.sig create mode 100644 readline82-006 create mode 100644 readline82-006.sig create mode 100644 readline82-007 create mode 100644 readline82-007.sig diff --git a/readline-6.3-input.dif b/readline-6.3-input.dif index cfe6a56..6d5dff0 100644 --- a/readline-6.3-input.dif +++ b/readline-6.3-input.dif @@ -5,7 +5,7 @@ --- lib/readline/input.c +++ lib/readline/input.c 2018-11-29 08:29:58.432878428 +0000 -@@ -799,6 +799,8 @@ rl_read_key (void) +@@ -801,6 +801,8 @@ rl_read_key (void) return (c); } @@ -14,7 +14,7 @@ int rl_getc (FILE *stream) { -@@ -846,7 +848,10 @@ rl_getc (FILE *stream) +@@ -862,7 +864,10 @@ rl_getc (FILE *stream) /* If zero characters are returned, then the file that we are reading from is empty! Return EOF in that case. */ if (result == 0) diff --git a/readline.changes b/readline.changes index aef1162..eea838f 100644 --- a/readline.changes +++ b/readline.changes @@ -1,3 +1,31 @@ +------------------------------------------------------------------- +Tue Nov 21 07:04:06 UTC 2023 - Dr. Werner Fink + +- Add upstream patch readline82-002 + * It's possible for readline to try to zero out a line that's not null- + terminated, leading to a memory fault. +- Add upstream patch readline82-003 +- Add upstream patch readline82-004 +- Add upstream patch readline82-005 + * If an application is using readline in callback mode, and a signal arrives + after readline checks for it in rl_callback_read_char() but before it + restores the application's signal handlers, it won't get processed until the + next time the application calls rl_callback_read_char(). Readline needs to + check for and resend any pending signals after restoring the application's + signal handlers. +- Add upstream patch readline82-006 + * This is a variant of the same issue as the one fixed by patch 5. In this + case, the signal arrives and is pending before readline calls rl_getc(). + When this happens, the pending signal will be handled by the loop, but may + alter or destroy some state that the callback uses. Readline needs to treat + this case the same way it would if a signal interrupts pselect/select, so + compound operations like searches and reading numeric arguments get cleaned + up properly. +- Add upstream patch readline82-007 + * If readline is called with no prompt, it should display a newline if return + is typed on an empty line. It should still suppress the final newline if + return is typed on the last (empty) line of a multi-line command. + ------------------------------------------------------------------- Fri Oct 21 08:36:57 UTC 2022 - Dr. Werner Fink diff --git a/readline.spec b/readline.spec index 889dc92..18df3fa 100644 --- a/readline.spec +++ b/readline.spec @@ -1,7 +1,7 @@ # # spec file for package readline # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -34,7 +34,19 @@ Source4: https://tiswww.case.edu/php/chet/gpgkey.asc#/%{name}.keyring # signatures for official patches # official patches Patch101: readline82-001 +Patch102: readline82-002 +Patch103: readline82-003 +Patch104: readline82-004 +Patch105: readline82-005 +Patch106: readline82-006 +Patch107: readline82-007 Source101: readline82-001.sig +Source102: readline82-002.sig +Source103: readline82-003.sig +Source104: readline82-004.sig +Source105: readline82-005.sig +Source106: readline82-006.sig +Source107: readline82-007.sig # local patches Patch200: readline-%{version}.dif Patch201: readline-6.3-input.dif @@ -105,16 +117,22 @@ as well as programming with the interface of the readline library. %prep %setup -q -n readline-%{version}%{rextend} # official patches -%patch101 -p0 +%patch -P101 -p0 +%patch -P102 -p0 +%patch -P103 -p0 +%patch -P104 -p0 +%patch -P105 -p0 +%patch -P106 -p0 +%patch -P107 -p0 # local patches -%patch201 -p2 -b .zerotty -%patch202 -p2 -b .conf -%patch203 -p2 -b .metamode -%patch205 -b .xm -%patch206 -b .destdir -%patch207 -p2 -b .tmp -%patch208 -p2 -b .screen -%patch200 -b .0 +%patch -P201 -p2 -b .zerotty +%patch -P202 -p2 -b .conf +%patch -P203 -p2 -b .metamode +%patch -P205 -b .xm +%patch -P206 -b .destdir +%patch -P207 -p2 -b .tmp +%patch -P208 -p2 -b .screen +%patch -P200 -b .0 %build %global _lto_cflags %{_lto_cflags} -ffat-lto-objects diff --git a/readline82-002 b/readline82-002 new file mode 100644 index 0000000..8327280 --- /dev/null +++ b/readline82-002 @@ -0,0 +1,48 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 8.2 +Patch-ID: readline82-002 + +Bug-Reported-by: srobertson@peratonlabs.com +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-09/msg00049.html + +Bug-Description: + +It's possible for readline to try to zero out a line that's not null- +terminated, leading to a memory fault. + +Patch (apply with `patch -p0'): + +*** ../readline-8.2-patched/display.c 2022-04-05 10:47:31.000000000 -0400 +--- display.c 2022-12-13 13:11:22.000000000 -0500 +*************** +*** 2684,2692 **** + + if (visible_line) +! { +! temp = visible_line; +! while (*temp) +! *temp++ = '\0'; +! } + rl_on_new_line (); + forced_display++; +--- 2735,2740 ---- + + if (visible_line) +! memset (visible_line, 0, line_size); +! + rl_on_new_line (); + forced_display++; +*** ../readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 1 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 2 diff --git a/readline82-002.sig b/readline82-002.sig new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..58496af3201d0be2b52274608e2a3fefe53b3e36b028eac19f3b078c86f7c0b3 GIT binary patch literal 95 zcmeB(WnmCxVvrS6WT{~^{ms#}J}2#1z|P$fnIBSKm8@oEN)7LlXW-%#fQh)CWLVJN uHt$#!XK2_JBUhhG$+jIPagJgPbHy8Wmp<)wi7S0C7aXe58F6RM9y +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2023-08/msg00018.html + +Bug-Description: + +Patch (apply with `patch -p0'): + +The custom color prefix that readline uses to color possible completions +must have a leading `.'. + +*** ../readline-8.2-patched/colors.c 2021-12-08 11:38:25.000000000 -0500 +--- colors.c 2023-08-28 16:40:04.000000000 -0400 +*************** +*** 74,78 **** + static void restore_default_color (void); + +! #define RL_COLOR_PREFIX_EXTENSION "readline-colored-completion-prefix" + + COLOR_EXT_TYPE *_rl_color_ext_list = 0; +--- 74,78 ---- + static void restore_default_color (void); + +! #define RL_COLOR_PREFIX_EXTENSION ".readline-colored-completion-prefix" + + COLOR_EXT_TYPE *_rl_color_ext_list = 0; +*** ../readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 2 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 3 diff --git a/readline82-003.sig b/readline82-003.sig new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..8cb0236e47a52df89e330fed98dfedb203dc7e75033f000b8616cbea9829f425 GIT binary patch literal 95 zcmeB(WnmCxVvrS6WT{~^{ms#}J}2#1z|P$fnIBSKm8@oEN)7K)W8mTxfQfkhV3_Z_ vnETby({=ONCaB9wKUol9rd`9#Fju@$1_SLrtS~+P?q*k#;3J literal 0 HcmV?d00001 diff --git a/readline82-004 b/readline82-004 new file mode 100644 index 0000000..364971a --- /dev/null +++ b/readline82-004 @@ -0,0 +1,65 @@ + READLINE PATCH REPORT + ===================== + +Readline-Release: 8.2 +Patch-ID: readline82-004 + +Bug-Reported-by: Henry Bent +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2022-11/msg00044.html + +Bug-Description: + +Patch (apply with `patch -p0'): + +There are systems that supply one of select or pselect, but not both. + +*** ../readline-8.2-patched/input.c 2022-04-08 15:43:24.000000000 -0400 +--- input.c 2022-11-28 09:41:08.000000000 -0500 +*************** +*** 152,156 **** +--- 152,158 ---- + 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); +*************** +*** 249,253 **** + int chars_avail, k; + char input; +! #if defined(HAVE_SELECT) + fd_set readfds, exceptfds; + struct timeval timeout; +--- 251,255 ---- + int chars_avail, k; + char input; +! #if defined (HAVE_PSELECT) || defined (HAVE_SELECT) + fd_set readfds, exceptfds; + struct timeval timeout; +*************** +*** 806,810 **** + unsigned char c; + int fd; +! #if defined (HAVE_PSELECT) + sigset_t empty_set; + fd_set readfds; +--- 815,819 ---- + unsigned char c; + int fd; +! #if defined (HAVE_PSELECT) || defined (HAVE_SELECT) + sigset_t empty_set; + fd_set readfds; +*** ../readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 3 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 4 diff --git a/readline82-004.sig b/readline82-004.sig new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..837fa466e79c478d484148247ce3ddb2ca1e445e67164bf5c192de38c0effa23 GIT binary patch literal 95 zcmeB(WnmCxVvrS6WT{~^{ms#}J}2#1z|P$fnIBSKm8@oEN)7K)XW-%#fQdX{W|(J_ vminby>qY4q8}ZlNCH=FeFRB$`n8TeEYjORg +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2022-09/msg00005.html + +Bug-Description: + +If an application is using readline in callback mode, and a signal arrives +after readline checks for it in rl_callback_read_char() but before it +restores the application's signal handlers, it won't get processed until the +next time the application calls rl_callback_read_char(). Readline needs to +check for and resend any pending signals after restoring the application's +signal handlers. + +Patch (apply with `patch -p0'): + +*** ../readline-8.2-patched/callback.c 2022-04-29 12:02:56.000000000 -0400 +--- callback.c 2022-10-11 10:59:06.000000000 -0400 +*************** +*** 116,120 **** + do { \ + if (rl_persistent_signal_handlers == 0) \ +! rl_clear_signals (); \ + return; \ + } while (0) +--- 116,123 ---- + do { \ + if (rl_persistent_signal_handlers == 0) \ +! { \ +! rl_clear_signals (); \ +! if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \ +! } \ + return; \ + } while (0) +*** ../readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 4 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 5 diff --git a/readline82-005.sig b/readline82-005.sig new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..b2a0fff7b7db267721e0e0914dd19e130ed8a2a1ee81b8a5840a84b172a4feb6 GIT binary patch literal 95 zcmeB(WnmCxVvrS6WT{~^{ms#}J}2#1z|P$fnIBSKm8@oEN)7K)XW-%#fQfj2WLPlW vF64Qx=Hr4h!7nEkxUH`G?zX#xVV-W!u7?_YS^F+d6@31=zNR@$`Y9&>@ +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2022-09/msg00001.html + +Bug-Description: + +This is a variant of the same issue as the one fixed by patch 5. In this +case, the signal arrives and is pending before readline calls rl_getc(). +When this happens, the pending signal will be handled by the loop, but may +alter or destroy some state that the callback uses. Readline needs to treat +this case the same way it would if a signal interrupts pselect/select, so +compound operations like searches and reading numeric arguments get cleaned +up properly. + +Patch (apply with `patch -p0'): + +*** ../readline-8.2-patched/input.c 2022-12-22 16:15:48.000000000 -0500 +--- input.c 2023-01-10 11:53:45.000000000 -0500 +*************** +*** 812,816 **** + rl_getc (FILE *stream) + { +! int result; + unsigned char c; + int fd; +--- 812,816 ---- + rl_getc (FILE *stream) + { +! int result, ostate, osig; + unsigned char c; + int fd; +*************** +*** 823,828 **** +--- 823,842 ---- + 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 */ + +*************** +*** 888,891 **** +--- 902,908 ---- + + 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 +*************** +*** 928,933 **** +--- 945,959 ---- + #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 + } + } +*** ../readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 5 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 6 diff --git a/readline82-006.sig b/readline82-006.sig new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..e1ae5496ffe487d8514a80eb6afc650ab04129beaf4c782c4f6b4d2b5287a1eb GIT binary patch literal 95 zcmeB(WnmCxVvrS6WT{~^{ms#}J}2#1z|P$fnIBSKm8@oEN)7K)XW-%#fQg*9W0 +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-readline/2022-11/msg00002.html + +Bug-Description: + +If readline is called with no prompt, it should display a newline if return +is typed on an empty line. It should still suppress the final newline if +return is typed on the last (empty) line of a multi-line command. + +Patch (apply with `patch -p0'): + +*** ../readline-8.2-patched/display.c 2022-04-05 10:47:31.000000000 -0400 +--- display.c 2022-12-13 13:11:22.000000000 -0500 +*************** +*** 3342,3348 **** + &last_face[_rl_screenwidth - 1 + woff], 1); + } +! _rl_vis_botlin = 0; +! if (botline_length > 0 || _rl_last_c_pos > 0) + rl_crlf (); + fflush (rl_outstream); + rl_display_fixed++; +--- 3394,3400 ---- + &last_face[_rl_screenwidth - 1 + woff], 1); + } +! 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++; +*** ../readline-8.2/patchlevel 2013-11-15 08:11:11.000000000 -0500 +--- patchlevel 2014-03-21 08:28:40.000000000 -0400 +*************** +*** 1,3 **** + # Do not edit -- exists only for use by patch + +! 6 +--- 1,3 ---- + # Do not edit -- exists only for use by patch + +! 7 diff --git a/readline82-007.sig b/readline82-007.sig new file mode 100644 index 0000000000000000000000000000000000000000000000000000000000000000..a2d132d9d624e22d405961a13d0770976c6d0c0875f81a728c68f65d0a23fc7a GIT binary patch literal 95 zcmeB(WnmCxVvrS6WT{~^{ms#}J}2#1z|P$fnIBSKm8@oEN)7K)XW-%#fQfW)GtBpy v``t>ru1RBRb4|_pJQ3ENf7e}Qm}korqt6?6IWDr#d3)c<#oq5XznuaAoPQ^{ literal 0 HcmV?d00001