From 6c3e8120c6be34cc89dab3f4e26f7d18eef365c4 Mon Sep 17 00:00:00 2001 From: Rmys Date: Tue, 24 Sep 2024 13:19:39 +0300 Subject: [PATCH] bash rebuild --- .../base/bash/files/official/bash52-033.patch | 80 ++++++ .../base/bash/files/official/bash52-034.patch | 143 +++++++++++ .../base/bash/files/official/bash52-035.patch | 129 ++++++++++ .../base/bash/files/official/bash52-036.patch | 237 ++++++++++++++++++ .../base/bash/files/official/bash52-037.patch | 71 ++++++ system/base/bash/pspec.xml | 12 + 6 files changed, 672 insertions(+) create mode 100644 system/base/bash/files/official/bash52-033.patch create mode 100644 system/base/bash/files/official/bash52-034.patch create mode 100644 system/base/bash/files/official/bash52-035.patch create mode 100644 system/base/bash/files/official/bash52-036.patch create mode 100644 system/base/bash/files/official/bash52-037.patch diff --git a/system/base/bash/files/official/bash52-033.patch b/system/base/bash/files/official/bash52-033.patch new file mode 100644 index 00000000..ca29aea9 --- /dev/null +++ b/system/base/bash/files/official/bash52-033.patch @@ -0,0 +1,80 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 5.2 +Patch-ID: bash52-033 + +Bug-Reported-by: Florian Weimer +Bug-Reference-ID: <87leasmvoo.fsf@oldenburg.str.redhat.com> +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2023-11/msg00104.html + +Bug-Description: + +A typo in the autoconf test for strtold causes false negatives for strtold +being available and working when compiled with gcc-14. + +Patch (apply with `patch -p0'): + +*** ../bash-5.2-patched/configure.ac Fri Aug 11 14:52:31 2023 +--- configure.ac Tue Nov 21 12:00:25 2023 +*************** +*** 899,903 **** + [AC_LANG_PROGRAM( + [[#include ]], +! [[long double r; char *foo, bar; r = strtold(foo, &bar);]] + )], + [bash_cv_strtold_broken=no],[bash_cv_strtold_broken=yes]) +--- 900,904 ---- + [AC_LANG_PROGRAM( + [[#include ]], +! [[long double r; char *foo, *bar; r = strtold(foo, &bar);]] + )], + [bash_cv_strtold_broken=no],[bash_cv_strtold_broken=yes]) + +*** ../bash-5.2-patched/configure Fri Aug 18 16:27:53 2023 +--- configure Tue Nov 21 12:00:30 2023 +*************** +*** 15923,15927 **** + main (void) + { +! long double r; char *foo, bar; r = strtold(foo, &bar); + + ; +--- 15932,15936 ---- + main (void) + { +! long double r; char *foo, *bar; r = strtold(foo, &bar); + + ; + +*** ../bash-5.2-patched/builtins/printf.def Fri Jun 24 10:09:50 2022 +--- builtins/printf.def Tue Aug 13 10:36:55 2024 +*************** +*** 710,714 **** + + p = getfloatmax (); +! f = mklong (start, "L", 1); + PF (f, p); + } +--- 710,714 ---- + + p = getfloatmax (); +! f = mklong (start, FLOATMAX_CONV, USE_LONG_DOUBLE); + PF (f, p); + } + +*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400 +--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 32 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 33 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/system/base/bash/files/official/bash52-034.patch b/system/base/bash/files/official/bash52-034.patch new file mode 100644 index 00000000..17c0d669 --- /dev/null +++ b/system/base/bash/files/official/bash52-034.patch @@ -0,0 +1,143 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 5.2 +Patch-ID: bash52-034 + +Bug-Reported-by: Wiley Young +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2023-05/msg00146.html + +Bug-Description: + +If we parse a compound assignment during an alias expansion, it's possible +to have the current input string popped out from underneath the parse. In +this case, we should not restore the input we were using when we began to +parse the compound assignment. + +Patch (apply with `patch -p0'): + +*** ../bash-5.2-patched/parse.y Fri May 26 16:57:03 2023 +--- parse.y Thu Jun 1 16:30:19 2023 +*************** +*** 6854,6860 **** + { + WORD_LIST *wl, *rl; +! int tok, orig_line_number, assignok; + sh_parser_state_t ps; + char *ret; + + orig_line_number = line_number; +--- 6858,6865 ---- + { + WORD_LIST *wl, *rl; +! int tok, orig_line_number, assignok, ea, restore_pushed_strings; + sh_parser_state_t ps; + char *ret; ++ STRING_SAVER *ss; + + orig_line_number = line_number; +*************** +*** 6879,6882 **** +--- 6884,6893 ---- + esacs_needed_count = expecting_in_token = 0; + ++ /* We're not pushing any new input here, we're reading from the current input ++ source. If that's an alias, we have to be prepared for the alias to get ++ popped out from underneath us. */ ++ ss = (ea = expanding_alias ()) ? pushed_string_list : (STRING_SAVER *)NULL; ++ restore_pushed_strings = 0; ++ + while ((tok = read_token (READ)) != ')') + { +*************** +*** 6902,6906 **** +--- 6913,6926 ---- + } + ++ /* Check whether or not an alias got popped out from underneath us and ++ fix up after restore_parser_state. */ ++ if (ea && ss && ss != pushed_string_list) ++ { ++ restore_pushed_strings = 1; ++ ss = pushed_string_list; ++ } + restore_parser_state (&ps); ++ if (restore_pushed_strings) ++ pushed_string_list = ss; + + if (wl == &parse_string_error) +*** ../bash-5.2-patched/y.tab.c Mon Sep 23 10:02:46 2024 +--- y.tab.c Mon Sep 23 10:02:49 2024 +*************** +*** 8804,8812 **** + int *retlenp; + { + WORD_LIST *wl, *rl; +! int tok, orig_line_number, assignok; + sh_parser_state_t ps; + char *ret; + + orig_line_number = line_number; + save_parser_state (&ps); +--- 8804,8813 ---- + int *retlenp; + { + WORD_LIST *wl, *rl; +! int tok, orig_line_number, assignok, ea, restore_pushed_strings; + sh_parser_state_t ps; + char *ret; ++ STRING_SAVER *ss; + + orig_line_number = line_number; + save_parser_state (&ps); +*************** +*** 8829,8834 **** +--- 8830,8841 ---- + + esacs_needed_count = expecting_in_token = 0; + ++ /* We're not pushing any new input here, we're reading from the current input ++ source. If that's an alias, we have to be prepared for the alias to get ++ popped out from underneath us. */ ++ ss = (ea = expanding_alias ()) ? pushed_string_list : (STRING_SAVER *)NULL; ++ restore_pushed_strings = 0; ++ + while ((tok = read_token (READ)) != ')') + { + if (tok == '\n') /* Allow newlines in compound assignments */ +*************** +*** 8852,8858 **** +--- 8859,8874 ---- + wl = make_word_list (yylval.word, wl); + } + ++ /* Check whether or not an alias got popped out from underneath us and ++ fix up after restore_parser_state. */ ++ if (ea && ss && ss != pushed_string_list) ++ { ++ restore_pushed_strings = 1; ++ ss = pushed_string_list; ++ } + restore_parser_state (&ps); ++ if (restore_pushed_strings) ++ pushed_string_list = ss; + + if (wl == &parse_string_error) + { + +*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400 +--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 33 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 34 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/system/base/bash/files/official/bash52-035.patch b/system/base/bash/files/official/bash52-035.patch new file mode 100644 index 00000000..5b1fb376 --- /dev/null +++ b/system/base/bash/files/official/bash52-035.patch @@ -0,0 +1,129 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 5.2 +Patch-ID: bash52-035 + +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: + +There are systems that supply one of select or pselect, but not both. + +Patch (apply with `patch -p0'): + +https://lists.gnu.org/archive/html/bug-bash/2022-11/msg00058.html + +*** ../bash/bash-5.2-patched/lib/readline/input.c 2022-04-08 15:43:24.000000000 -0400 +--- lib/readline/input.c 2022-11-16 09:10:41.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; +--- 808,812 ---- + unsigned char c; + int fd; +! #if defined (HAVE_PSELECT) || defined (HAVE_SELECT) + sigset_t empty_set; + fd_set readfds; +*** ../bash-5.2-patched/lib/sh/input_avail.c 2021-05-24 11:16:33.000000000 -0400 +--- lib/sh/input_avail.c 2022-11-16 09:12:48.000000000 -0500 +*************** +*** 34,40 **** + #endif /* HAVE_SYS_FILE_H */ + +! #if defined (HAVE_PSELECT) +! # include +! #endif + + #if defined (HAVE_UNISTD_H) +--- 34,38 ---- + #endif /* HAVE_SYS_FILE_H */ + +! #include + + #if defined (HAVE_UNISTD_H) +*************** +*** 108,115 **** + { + int result, chars_avail; +- #if defined(HAVE_SELECT) +- fd_set readfds, exceptfds; +- #endif + #if defined (HAVE_PSELECT) || defined (HAVE_SELECT) + sigset_t set, oset; + #endif +--- 106,111 ---- + { + int result, chars_avail; + #if defined (HAVE_PSELECT) || defined (HAVE_SELECT) ++ fd_set readfds, exceptfds; + sigset_t set, oset; + #endif +*************** +*** 122,132 **** + chars_avail = 0; + +! #if defined (HAVE_SELECT) + FD_ZERO (&readfds); + FD_ZERO (&exceptfds); + FD_SET (fd, &readfds); + FD_SET (fd, &exceptfds); +- #endif +- #if defined (HAVE_SELECT) || defined (HAVE_PSELECT) + sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set); + # ifdef SIGCHLD +--- 115,123 ---- + chars_avail = 0; + +! #if defined (HAVE_PSELECT) || defined (HAVE_SELECT) + FD_ZERO (&readfds); + FD_ZERO (&exceptfds); + FD_SET (fd, &readfds); + FD_SET (fd, &exceptfds); + sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set); + # ifdef SIGCHLD + +*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400 +--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 34 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 35 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/system/base/bash/files/official/bash52-036.patch b/system/base/bash/files/official/bash52-036.patch new file mode 100644 index 00000000..4aef5f2b --- /dev/null +++ b/system/base/bash/files/official/bash52-036.patch @@ -0,0 +1,237 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 5.2 +Patch-ID: bash52-036 + +Bug-Reported-by: Grisha Levit +Bug-Reference-ID: +Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2023-04/msg00082.html + +Bug-Description: + +When readline is accumulating bytes until it reads a complete multibyte +character, reading a byte that makes the multibyte character invalid can +result in discarding the bytes in the partial character. + +Patch (apply with `patch -p0'): + +*** ../bash-5.2-patched/lib/readline/text.c Mon May 1 09:37:52 2023 +--- lib/readline/text.c Mon May 29 12:22:29 2023 +*************** +*** 86,90 **** + rl_insert_text (const char *string) + { +! register int i, l; + + l = (string && *string) ? strlen (string) : 0; +--- 86,91 ---- + rl_insert_text (const char *string) + { +! register int i; +! size_t l; + + l = (string && *string) ? strlen (string) : 0; +*************** +*** 705,709 **** + /* Insert the character C at the current location, moving point forward. + If C introduces a multibyte sequence, we read the whole sequence and +! then insert the multibyte char into the line buffer. */ + int + _rl_insert_char (int count, int c) +--- 706,714 ---- + /* Insert the character C at the current location, moving point forward. + If C introduces a multibyte sequence, we read the whole sequence and +! then insert the multibyte char into the line buffer. +! If C == 0, we immediately insert any pending partial multibyte character, +! assuming that we have read a character that doesn't map to self-insert. +! This doesn't completely handle characters that are part of a multibyte +! character but map to editing functions. */ + int + _rl_insert_char (int count, int c) +*************** +*** 719,727 **** + #endif + + if (count <= 0) + return 0; + +! #if defined (HANDLE_MULTIBYTE) +! if (MB_CUR_MAX == 1 || rl_byte_oriented) + { + incoming[0] = c; +--- 724,749 ---- + #endif + ++ #if !defined (HANDLE_MULTIBYTE) + if (count <= 0) + return 0; ++ #else ++ if (count < 0) ++ return 0; ++ if (count == 0) ++ { ++ if (pending_bytes_length == 0) ++ return 0; ++ if (stored_count <= 0) ++ stored_count = count; ++ else ++ count = stored_count; + +! memcpy (incoming, pending_bytes, pending_bytes_length); +! incoming[pending_bytes_length] = '\0'; +! incoming_length = pending_bytes_length; +! pending_bytes_length = 0; +! memset (&ps, 0, sizeof (mbstate_t)); +! } +! else if (MB_CUR_MAX == 1 || rl_byte_oriented) + { + incoming[0] = c; +*************** +*** 731,734 **** +--- 753,759 ---- + else if (_rl_utf8locale && (c & 0x80) == 0) + { ++ if (pending_bytes_length) ++ _rl_insert_char (0, 0); ++ + incoming[0] = c; + incoming[1] = '\0'; +*************** +*** 765,769 **** + incoming_length = 1; + pending_bytes_length--; +! memmove (pending_bytes, pending_bytes + 1, pending_bytes_length); + /* Clear the state of the byte sequence, because in this case the + effect of mbstate is undefined. */ +--- 790,795 ---- + incoming_length = 1; + pending_bytes_length--; +! if (pending_bytes_length) +! memmove (pending_bytes, pending_bytes + 1, pending_bytes_length); + /* Clear the state of the byte sequence, because in this case the + effect of mbstate is undefined. */ +*************** +*** 828,832 **** +--- 854,862 ---- + xfree (string); + ++ #if defined (HANDLE_MULTIBYTE) ++ return (pending_bytes_length != 0); ++ #else + return 0; ++ #endif + } + +*************** +*** 861,864 **** +--- 891,896 ---- + incoming_length = 0; + stored_count = 0; ++ ++ return (pending_bytes_length != 0); + #else /* !HANDLE_MULTIBYTE */ + char str[TEXT_COUNT_MAX+1]; +*************** +*** 874,880 **** + count -= decreaser; + } +- #endif /* !HANDLE_MULTIBYTE */ + + return 0; + } + +--- 906,912 ---- + count -= decreaser; + } + + return 0; ++ #endif /* !HANDLE_MULTIBYTE */ + } + +*************** +*** 904,910 **** + stored_count = 0; + } +! #endif +! + return 0; + } + +--- 936,944 ---- + stored_count = 0; + } +! +! return (pending_bytes_length != 0); +! #else + return 0; ++ #endif + } + +*************** +*** 984,987 **** +--- 1018,1026 ---- + } + ++ /* If we didn't insert n and there are pending bytes, we need to insert ++ them if _rl_insert_char didn't do that on its own. */ ++ if (r == 1 && rl_insert_mode == RL_IM_INSERT) ++ r = _rl_insert_char (0, 0); /* flush partial multibyte char */ ++ + if (n != (unsigned short)-2) /* -2 = sentinel value for having inserted N */ + { +*************** +*** 1055,1058 **** +--- 1094,1099 ---- + rl_quoted_insert (int count, int key) + { ++ int r; ++ + /* Let's see...should the callback interface futz with signal handling? */ + #if defined (HANDLE_SIGNALS) +*************** +*** 1073,1085 **** + if (count < 0) + { +- int r; +- + do + r = _rl_insert_next (1); + while (r == 0 && ++count < 0); +- return r; + } + +! return _rl_insert_next (count); + } + +--- 1114,1128 ---- + if (count < 0) + { + do + r = _rl_insert_next (1); + while (r == 0 && ++count < 0); + } ++ else ++ r = _rl_insert_next (count); + +! if (r == 1) +! _rl_insert_char (0, 0); /* insert partial multibyte character */ +! +! return r; + } + +*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400 +--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 35 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 36 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/system/base/bash/files/official/bash52-037.patch b/system/base/bash/files/official/bash52-037.patch new file mode 100644 index 00000000..99c9bede --- /dev/null +++ b/system/base/bash/files/official/bash52-037.patch @@ -0,0 +1,71 @@ + BASH PATCH REPORT + ================= + +Bash-Release: 5.2 +Patch-ID: bash52-037 + +Bug-Reported-by: Martin Castillo +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'): + +*** ../bash-5.2-patched/lib/readline/complete.c Tue Apr 5 10:47:06 2022 +--- lib/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); + +*** ../bash-5.2/patchlevel.h 2020-06-22 14:51:03.000000000 -0400 +--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400 +*************** +*** 26,30 **** + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 36 + + #endif /* _PATCHLEVEL_H_ */ +--- 26,30 ---- + looks for to find the patch level (for the sccs version string). */ + +! #define PATCHLEVEL 37 + + #endif /* _PATCHLEVEL_H_ */ diff --git a/system/base/bash/pspec.xml b/system/base/bash/pspec.xml index 91e97739..2b81384d 100755 --- a/system/base/bash/pspec.xml +++ b/system/base/bash/pspec.xml @@ -51,6 +51,11 @@ official/bash52-030.patch official/bash52-031.patch official/bash52-032.patch + official/bash52-033.patch + official/bash52-034.patch + official/bash52-035.patch + official/bash52-036.patch + official/bash52-037.patch @@ -100,6 +105,13 @@ + + 2024-09-24 + 5.2.37 + Rebuild. + Mustafa Cinasal + muscnsl@gmail.com + 2024-08-02 5.2.32