!89 back port patches to fix some bug
From: @wangyuhang27 Reviewed-by: @openeuler-basic Signed-off-by: @openeuler-basic
This commit is contained in:
commit
df9fafefe1
@ -0,0 +1,27 @@
|
||||
From 6b9422dbe3917a0affb4898e38156d22cbec64e8 Mon Sep 17 00:00:00 2001
|
||||
From: Chet Ramey <chet.ramey@case.edu>
|
||||
Date: Tue, 4 Jan 2022 16:58:20 -0500
|
||||
Subject: [PATCH] Bash-5.1 patch 13: fix tilde expansion after unquoted colons
|
||||
in posix mode
|
||||
|
||||
Conflict:NA
|
||||
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=6b9422dbe3917a0affb4898e38156d22cbec64e8
|
||||
---
|
||||
subst.c | 1 +
|
||||
1 files changed, 1 insertions(+)
|
||||
|
||||
diff --git a/subst.c b/subst.c
|
||||
index 327de083..dda1d55c 100644
|
||||
--- a/subst.c
|
||||
+++ b/subst.c
|
||||
@@ -3825,6 +3825,7 @@ expand_string_assignment (string, quoted)
|
||||
#else
|
||||
td.flags = W_ASSIGNRHS;
|
||||
#endif
|
||||
+ td.flags |= (W_NOGLOB|W_TILDEEXP);
|
||||
td.word = savestring (string);
|
||||
value = call_expand_word_internal (&td, quoted, 0, (int *)NULL, (int *)NULL);
|
||||
FREE (td.word);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
From 72912fb8209105af961c851260a173115efe60be Mon Sep 17 00:00:00 2001
|
||||
From: Chet Ramey <chet.ramey@case.edu>
|
||||
Date: Tue, 4 Jan 2022 16:59:40 -0500
|
||||
Subject: [PATCH] Bash-5.1 patch 14: fix off-by-one error when reading
|
||||
multibyte characters from command substitution output
|
||||
|
||||
Conflict:NA
|
||||
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=72912fb8209105af961c851260a173115efe60be
|
||||
---
|
||||
subst.c | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/subst.c b/subst.c
|
||||
index dda1d55c..2b76256c 100644
|
||||
--- a/subst.c
|
||||
+++ b/subst.c
|
||||
@@ -6242,7 +6242,7 @@ read_comsub (fd, quoted, flags, rflag)
|
||||
/* read a multibyte character from buf */
|
||||
/* punt on the hard case for now */
|
||||
memset (&ps, '\0', sizeof (mbstate_t));
|
||||
- mblen = mbrtowc (&wc, bufp-1, bufn+1, &ps);
|
||||
+ mblen = mbrtowc (&wc, bufp-1, bufn, &ps);
|
||||
if (MB_INVALIDCH (mblen) || mblen == 0 || mblen == 1)
|
||||
istring[istring_index++] = c;
|
||||
else
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,139 @@
|
||||
From 8d3cecab33b1fd03dbb4a2c39a7d0309dca43fd3 Mon Sep 17 00:00:00 2001
|
||||
From: Chet Ramey <chet.ramey@case.edu>
|
||||
Date: Thu, 17 Jun 2021 17:10:49 -0400
|
||||
Subject: [PATCH] changes to documentation to reduce gender-specific language;
|
||||
fix a seg fault in `fc'
|
||||
|
||||
Conflict:Delete modifications in changlog and test cases and doc and builtins/set.def and builtins/common.c and builtins/common.h; W_ARRAYREF macro definition extension; add function builtin_arrayref_flags
|
||||
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=8d3cecab33b1fd03dbb4a2c39a7d0309dca43fd3
|
||||
---
|
||||
builtins/fc.def | 7 +++++--
|
||||
lib/readline/doc/rltech.texi | 9 +++++----
|
||||
lib/readline/doc/rluser.texi | 8 +++++---
|
||||
parse.y | 3 +--
|
||||
shell.h | 3 +++
|
||||
5 files changed, 19 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/builtins/fc.def b/builtins/fc.def
|
||||
index 467dbcb..9b8a997 100644
|
||||
--- a/builtins/fc.def
|
||||
+++ b/builtins/fc.def
|
||||
@@ -1,7 +1,7 @@
|
||||
This file is fc.def, from which is created fc.c.
|
||||
It implements the builtin "fc" in Bash.
|
||||
|
||||
-Copyright (C) 1987-2020 Free Software Foundation, Inc.
|
||||
+Copyright (C) 1987-2021 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -450,6 +450,8 @@ fc_builtin (list)
|
||||
for (i = reverse ? histend : histbeg; reverse ? i >= histbeg : i <= histend; reverse ? i-- : i++)
|
||||
{
|
||||
QUIT;
|
||||
+ if (hlist[i] == 0)
|
||||
+ continue;
|
||||
if (numbering)
|
||||
fprintf (stream, "%d", i + history_base);
|
||||
if (listing)
|
||||
@@ -459,7 +461,8 @@ fc_builtin (list)
|
||||
else
|
||||
fprintf (stream, "\t%c", histdata (i) ? '*' : ' ');
|
||||
}
|
||||
- fprintf (stream, "%s\n", histline (i));
|
||||
+ if (histline (i))
|
||||
+ fprintf (stream, "%s\n", histline (i));
|
||||
}
|
||||
|
||||
if (listing)
|
||||
diff --git a/lib/readline/doc/rltech.texi b/lib/readline/doc/rltech.texi
|
||||
index 1a689f6..f60f9f3 100644
|
||||
--- a/lib/readline/doc/rltech.texi
|
||||
+++ b/lib/readline/doc/rltech.texi
|
||||
@@ -1612,7 +1612,7 @@ main (int c, char **v)
|
||||
|
||||
Signals are asynchronous events sent to a process by the Unix kernel,
|
||||
sometimes on behalf of another process. They are intended to indicate
|
||||
-exceptional events, like a user pressing the interrupt key on his terminal,
|
||||
+exceptional events, like a user pressing the terminal's interrupt key,
|
||||
or a network connection being broken. There is a class of signals that can
|
||||
be sent to the process currently reading input from the keyboard. Since
|
||||
Readline changes the terminal attributes when it is called, it needs to
|
||||
@@ -2160,9 +2160,10 @@ shell variables and hostnames.
|
||||
|
||||
@deftypevar int rl_completion_query_items
|
||||
Up to this many items will be displayed in response to a
|
||||
-possible-completions call. After that, readline asks the user if she is sure
|
||||
-she wants to see them all. The default value is 100. A negative value
|
||||
-indicates that Readline should never ask the user.
|
||||
+possible-completions call. After that, readline asks the user for
|
||||
+confirmation before displaying them.
|
||||
+The default value is 100. A negative value
|
||||
+indicates that Readline should never ask for confirmation.
|
||||
@end deftypevar
|
||||
|
||||
@deftypevar {int} rl_completion_append_character
|
||||
diff --git a/lib/readline/doc/rluser.texi b/lib/readline/doc/rluser.texi
|
||||
index 26b0ff0..0780127 100644
|
||||
--- a/lib/readline/doc/rluser.texi
|
||||
+++ b/lib/readline/doc/rluser.texi
|
||||
@@ -339,7 +339,8 @@ Although the Readline library comes with a set of Emacs-like
|
||||
keybindings installed by default, it is possible to use a different set
|
||||
of keybindings.
|
||||
Any user can customize programs that use Readline by putting
|
||||
-commands in an @dfn{inputrc} file, conventionally in his home directory.
|
||||
+commands in an @dfn{inputrc} file,
|
||||
+conventionally in their home directory.
|
||||
The name of this
|
||||
@ifset BashFeatures
|
||||
file is taken from the value of the shell variable @env{INPUTRC}. If
|
||||
@@ -496,8 +497,9 @@ asked whether the list of possibilities should be displayed.
|
||||
If the number of possible completions is greater than or equal to this value,
|
||||
Readline will ask whether or not the user wishes to view them;
|
||||
otherwise, they are simply listed.
|
||||
-This variable must be set to an integer value greater than or equal to 0.
|
||||
-A negative value means Readline should never ask.
|
||||
+This variable must be set to an integer value greater than or equal to zero.
|
||||
+A zero value means Readline should never ask; negative values are
|
||||
+treated as zero.
|
||||
The default limit is @code{100}.
|
||||
|
||||
@item convert-meta
|
||||
diff --git a/parse.y b/parse.y
|
||||
index f4862ca..d545f14 100644
|
||||
--- a/parse.y
|
||||
+++ b/parse.y
|
||||
@@ -144,7 +144,6 @@ static int yy_readline_unget PARAMS((int));
|
||||
|
||||
static int yy_string_get PARAMS((void));
|
||||
static int yy_string_unget PARAMS((int));
|
||||
-static void rewind_input_string PARAMS((void));
|
||||
static int yy_stream_get PARAMS((void));
|
||||
static int yy_stream_unget PARAMS((int));
|
||||
|
||||
@@ -1614,7 +1613,7 @@ with_input_from_string (string, name)
|
||||
That is the true input location. Rewind bash_input.location.string by
|
||||
that number of characters, so it points to the last character actually
|
||||
consumed by the parser. */
|
||||
-static void
|
||||
+void
|
||||
rewind_input_string ()
|
||||
{
|
||||
int xchars;
|
||||
diff --git a/shell.h b/shell.h
|
||||
index 8b41792..91b31ac 100644
|
||||
--- a/shell.h
|
||||
+++ b/shell.h
|
||||
@@ -220,6 +220,9 @@ typedef struct _sh_input_line_state_t {
|
||||
} sh_input_line_state_t;
|
||||
|
||||
/* Let's try declaring these here. */
|
||||
+extern void shell_ungets PARAMS((char *));
|
||||
+extern void rewind_input_string PARAMS((void));
|
||||
+
|
||||
extern char *parser_remaining_input PARAMS((void));
|
||||
|
||||
extern sh_parser_state_t *save_parser_state PARAMS((sh_parser_state_t *));
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,134 @@
|
||||
From 70d7c6430db990b5880da40e86f9a364966e48dd Mon Sep 17 00:00:00 2001
|
||||
From: Chet Ramey <chet.ramey@case.edu>
|
||||
Date: Tue, 28 Sep 2021 15:13:02 -0400
|
||||
Subject: [PATCH] fixes for array subscripts and values containing 0x01
|
||||
characters
|
||||
|
||||
Conflict:Delete modifications in changlog and test cases; sh_single_quote in arrayfunc.c modify call method
|
||||
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=70d7c6430db990b5880da40e86f9a364966e48dd
|
||||
---
|
||||
arrayfunc.c | 47 ++++++++++++++++++++++++++++++++++++++---------
|
||||
1 file changed, 38 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/arrayfunc.c b/arrayfunc.c
|
||||
index b2c8ff0..3222d0b 100644
|
||||
--- a/arrayfunc.c
|
||||
+++ b/arrayfunc.c
|
||||
@@ -523,8 +523,17 @@ expand_compound_array_assignment (var, value, flags)
|
||||
shell expansions including pathname generation and word splitting. */
|
||||
/* First we split the string on whitespace, using the shell parser
|
||||
(ksh93 seems to do this). */
|
||||
+ /* XXX - this needs a rethink, maybe use split_at_delims */
|
||||
list = parse_string_to_word_list (val, 1, "array assign");
|
||||
|
||||
+ /* If the parser has quoted CTLESC and CTNLNUL with CTLESC in unquoted
|
||||
+ words, we need to remove those here because the code below assumes
|
||||
+ they are there because they exist in the original word. */
|
||||
+ /* XXX - if we rethink parse_string_to_word_list above, change this. */
|
||||
+ for (nlist = list; nlist; nlist = nlist->next)
|
||||
+ if ((nlist->word->flags & W_QUOTED) == 0)
|
||||
+ remove_quoted_escapes (nlist->word->word);
|
||||
+
|
||||
/* Note that we defer expansion of the assignment statements for associative
|
||||
arrays here, so we don't have to scan the subscript and find the ending
|
||||
bracket twice. See the caller below. */
|
||||
@@ -606,10 +615,13 @@ char *
|
||||
expand_and_quote_kvpair_word (w)
|
||||
char *w;
|
||||
{
|
||||
- char *t, *r;
|
||||
+ char *r, *s, *t;
|
||||
|
||||
t = w ? expand_assignment_string_to_string (w, 0) : 0;
|
||||
- r = sh_single_quote (t ? t : "");
|
||||
+ s = (t && strchr (t, CTLESC)) ? quote_escapes (t) : t;
|
||||
+ r = sh_single_quote (s ? s : "");
|
||||
+ if (s != t)
|
||||
+ free (s);
|
||||
free (t);
|
||||
return r;
|
||||
}
|
||||
@@ -895,7 +907,10 @@ quote_compound_array_word (w, type)
|
||||
|
||||
wlen = strlen (w);
|
||||
w[ind] = '\0';
|
||||
- sub = sh_single_quote (w+1);
|
||||
+ t = (strchr (w+1, CTLESC)) ? quote_escapes (w+1) : w+1;
|
||||
+ sub = sh_single_quote (t);
|
||||
+ if (t != w+1)
|
||||
+ free (t);
|
||||
w[ind] = RBRACK;
|
||||
|
||||
nword = xmalloc (wlen * 4 + 5); /* wlen*4 is max single quoted length */
|
||||
@@ -908,7 +923,10 @@ quote_compound_array_word (w, type)
|
||||
if (w[ind] == '+')
|
||||
nword[i++] = w[ind++];
|
||||
nword[i++] = w[ind++];
|
||||
- value = sh_single_quote (w + ind);
|
||||
+ t = (strchr (w+ind, CTLESC)) ? quote_escapes (w+ind) : w+ind;
|
||||
+ value = sh_single_quote (t);
|
||||
+ if (t != w+ind)
|
||||
+ free (t);
|
||||
strcpy (nword + i, value);
|
||||
|
||||
return nword;
|
||||
@@ -926,7 +944,7 @@ expand_and_quote_assoc_word (w, type)
|
||||
char *w;
|
||||
int type;
|
||||
{
|
||||
- char *nword, *key, *value, *t;
|
||||
+ char *nword, *key, *value, *s, *t;
|
||||
int ind, wlen, i;
|
||||
|
||||
if (w[0] != LBRACK)
|
||||
@@ -937,8 +955,11 @@ expand_and_quote_assoc_word (w, type)
|
||||
|
||||
w[ind] = '\0';
|
||||
t = expand_assignment_string_to_string (w+1, 0);
|
||||
+ s = (t && strchr (t, CTLESC)) ? quote_escapes (t) : t;
|
||||
+ key = sh_single_quote (s ? s : "");
|
||||
+ if (s != t)
|
||||
+ free (s);
|
||||
w[ind] = RBRACK;
|
||||
- key = sh_single_quote (t ? t : "");
|
||||
free (t);
|
||||
|
||||
wlen = STRLEN (key);
|
||||
@@ -953,7 +974,10 @@ expand_and_quote_assoc_word (w, type)
|
||||
nword[i++] = w[ind++];
|
||||
|
||||
t = expand_assignment_string_to_string (w+ind, 0);
|
||||
- value = sh_single_quote (t ? t : "");
|
||||
+ s = (t && strchr (t, CTLESC)) ? quote_escapes (t) : t;
|
||||
+ value = sh_single_quote (s ? s : "");
|
||||
+ if (s != t)
|
||||
+ free (s);
|
||||
free (t);
|
||||
nword = xrealloc (nword, wlen + 5 + STRLEN (value));
|
||||
strcpy (nword + i, value);
|
||||
@@ -973,7 +997,7 @@ quote_compound_array_list (list, type)
|
||||
WORD_LIST *list;
|
||||
int type;
|
||||
{
|
||||
- char *t;
|
||||
+ char *s, *t;
|
||||
WORD_LIST *l;
|
||||
|
||||
for (l = list; l; l = l->next)
|
||||
@@ -981,7 +1005,12 @@ quote_compound_array_list (list, type)
|
||||
if (l->word == 0 || l->word->word == 0)
|
||||
continue; /* should not happen, but just in case... */
|
||||
if ((l->word->flags & W_ASSIGNMENT) == 0)
|
||||
- t = sh_single_quote (l->word->word);
|
||||
+ {
|
||||
+ s = (strchr (l->word->word, CTLESC)) ? quote_escapes (l->word->word) : l->word->word;
|
||||
+ t = sh_single_quote (s);
|
||||
+ if (s != l->word->word)
|
||||
+ free (s);
|
||||
+ }
|
||||
else
|
||||
t = quote_compound_array_word (l->word->word, type);
|
||||
free (l->word->word);
|
||||
--
|
||||
2.33.0
|
||||
|
||||
27
bash.spec
27
bash.spec
@ -1,6 +1,6 @@
|
||||
Name: bash
|
||||
Version: 5.1.8
|
||||
Release: 7
|
||||
Release: 8
|
||||
Summary: It is the Bourne Again Shell
|
||||
License: GPLv3
|
||||
URL: https://www.gnu.org/software/bash
|
||||
@ -27,11 +27,16 @@ Patch140: bash-5.1-sw.patch
|
||||
Patch141: backport-fix-crash-in-readline-when-started-with-an-invalid.patch
|
||||
Patch142: backport-fix-CVE-2022-3715.patch
|
||||
|
||||
Patch6001: backport-Bash-5.1-patch-10-fix-for-wait-n-being-interrupted-b.patch
|
||||
Patch6002: backport-Bash-5.1-patch-11-save-and-restore-alias-parsing-whe.patch
|
||||
Patch6003: backport-Bash-5.1-patch-12-fix-race-condition-with-child-proc.patch
|
||||
Patch6004: backport-Bash-5.1-patch-15-fix-readline-display-of-some-chara.patch
|
||||
Patch6005: backport-Bash-5.1-patch-16-fix-interpretation-of-multiple-ins.patch
|
||||
Patch6000: backport-Bash-5.1-patch-10-fix-for-wait-n-being-interrupted-b.patch
|
||||
Patch6001: backport-Bash-5.1-patch-11-save-and-restore-alias-parsing-whe.patch
|
||||
Patch6002: backport-Bash-5.1-patch-12-fix-race-condition-with-child-proc.patch
|
||||
Patch6003: backport-Bash-5.1-patch-13-fix-tilde-expansion-after-unquoted.patch
|
||||
Patch6004: backport-Bash-5.1-patch-14-fix-off-by-one-error-when-reading-.patch
|
||||
Patch6005: backport-Bash-5.1-patch-15-fix-readline-display-of-some-chara.patch
|
||||
Patch6006: backport-Bash-5.1-patch-16-fix-interpretation-of-multiple-ins.patch
|
||||
|
||||
Patch6007: backport-changes-to-documentation-to-reduce-gender-specific-l.patch
|
||||
Patch6008: backport-fixes-for-array-subscripts-and-values-containing-0x0.patch
|
||||
|
||||
BuildRequires: gcc bison texinfo autoconf ncurses-devel
|
||||
# Required for bash tests
|
||||
@ -125,6 +130,16 @@ make check
|
||||
%exclude %{_infodir}/dir
|
||||
|
||||
%changelog
|
||||
* Thu Jun 15 2023 wangyuhang <wangyuhang27@huawei.com> -5.1.8-8
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: backport-Bash-5.1-patch-13-fix-tilde-expansion-after-unquoted.patch
|
||||
backport-Bash-5.1-patch-14-fix-off-by-one-error-when-reading-.patch
|
||||
backport-changes-to-documentation-to-reduce-gender-specific-l.patch
|
||||
backport-fixes-for-array-subscripts-and-values-containing-0x0.patch
|
||||
change PATCHLEVEL from 9 to 8, keep it consistent with the actual version of bash
|
||||
|
||||
* Mon Jan 16 2023 wangyuhang <wangyuhang27@huawei.com> -5.1.8-7
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user