!93 bash: update to 5.2.15

From: @wangyuhang27 
Reviewed-by: @openeuler-basic 
Signed-off-by: @openeuler-basic
This commit is contained in:
openeuler-ci-bot 2023-07-17 11:31:50 +00:00 committed by Gitee
commit 9037a4e811
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
23 changed files with 142 additions and 888 deletions

View File

@ -1,38 +0,0 @@
From 910fcdc415abeb3d7d85fb46ee0d3e804a4c47a6 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Wed, 17 Nov 2021 16:45:23 -0500
Subject: [PATCH] Bash-5.1 patch 10: fix for wait -n being interrupted by a
trapped signal
Conflict:NA
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=910fcdc415abeb3d7d85fb46ee0d3e804a4c47a6
---
builtins/wait.def | 5 ++++-
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/builtins/wait.def b/builtins/wait.def
index 824c83fe..e70a4d94 100644
--- a/builtins/wait.def
+++ b/builtins/wait.def
@@ -111,7 +111,8 @@ int
wait_builtin (list)
WORD_LIST *list;
{
- int status, code, opt, nflag, wflags;
+ int status, code, opt, nflag;
+ volatile int wflags;
char *vname;
SHELL_VAR *pidvar;
struct procstat pstat;
@@ -180,6 +181,8 @@ wait_builtin (list)
last_command_exit_signal = wait_signal_received;
status = 128 + wait_signal_received;
wait_sigint_cleanup ();
+ if (wflags & JWAIT_WAITING)
+ unset_waitlist ();
WAIT_RETURN (status);
}
--
2.33.0

View File

@ -1,68 +0,0 @@
From c839339fbfd2bb7ee4a523b64c7f3734ba36b9bc Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Wed, 17 Nov 2021 16:46:40 -0500
Subject: [PATCH] Bash-5.1 patch 11: save and restore alias parsing when
performing compound array assignment
Conflict:NA
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=c839339fbfd2bb7ee4a523b64c7f3734ba36b9bc
---
parse.y | 4 ----
y.tab.c | 4 ----
2 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/parse.y b/parse.y
index df1231da..f25575b5 100644
--- a/parse.y
+++ b/parse.y
@@ -6493,10 +6493,8 @@ parse_string_to_word_list (s, flags, whom)
old_expand_aliases = expand_aliases;
push_stream (1);
-#if 0 /* TAG: bash-5.2 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> 11/17/2020 */
if (ea = expanding_alias ())
parser_save_alias ();
-#endif
last_read_token = WORD; /* WORD to allow reserved words here */
current_command_line_count = 0;
echo_input_at_read = expand_aliases = 0;
@@ -6531,10 +6529,8 @@ parse_string_to_word_list (s, flags, whom)
last_read_token = '\n';
pop_stream ();
-#if 0 /* TAG: bash-5.2 */
if (ea)
parser_restore_alias ();
-#endif
#if defined (HISTORY)
remember_on_history = old_remember_on_history;
diff --git a/y.tab.c b/y.tab.c
index dcc5b7f3..c11d7aaa 100644
--- a/y.tab.c
+++ b/y.tab.c
@@ -8787,10 +8787,8 @@ parse_string_to_word_list (s, flags, whom)
old_expand_aliases = expand_aliases;
push_stream (1);
-#if 0 /* TAG: bash-5.2 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> 11/17/2020 */
if (ea = expanding_alias ())
parser_save_alias ();
-#endif
last_read_token = WORD; /* WORD to allow reserved words here */
current_command_line_count = 0;
echo_input_at_read = expand_aliases = 0;
@@ -8825,10 +8823,8 @@ parse_string_to_word_list (s, flags, whom)
last_read_token = '\n';
pop_stream ();
-#if 0 /* TAG: bash-5.2 */
if (ea)
parser_restore_alias ();
-#endif
#if defined (HISTORY)
remember_on_history = old_remember_on_history;
--
2.33.0

View File

@ -1,184 +0,0 @@
From 15409324f1974d41c183904ad575da7188058c1c Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Wed, 17 Nov 2021 16:47:24 -0500
Subject: [PATCH] Bash-5.1 patch 12: fix race condition with child processes
and resetting trapped signals
Conflict:NA
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=15409324f1974d41c183904ad575da7188058c1c
---
command.h | 1 +
execute_cmd.c | 8 +++++++-
jobs.c | 2 ++
nojobs.c | 2 ++
sig.c | 10 +++++++++-
subst.c | 2 ++
trap.c | 26 ++++++++++++++++++++++++++
7 files changed, 50 insertions(+), 3 deletions(-)
diff --git a/command.h b/command.h
index 914198f9..b8477528 100644
--- a/command.h
+++ b/command.h
@@ -124,6 +124,7 @@ enum command_type { cm_for, cm_case, cm_while, cm_if, cm_simple, cm_select,
#define SUBSHELL_PROCSUB 0x20 /* subshell caused by <(command) or >(command) */
#define SUBSHELL_COPROC 0x40 /* subshell from a coproc pipeline */
#define SUBSHELL_RESETTRAP 0x80 /* subshell needs to reset trap strings on first call to trap */
+#define SUBSHELL_IGNTRAP 0x100 /* subshell should reset trapped signals from trap_handler */
/* A structure which represents a word. */
typedef struct word_desc {
diff --git a/execute_cmd.c b/execute_cmd.c
index 90129e06..425679a2 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -1547,6 +1547,9 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
clear_pending_traps ();
reset_signal_handlers ();
subshell_environment |= SUBSHELL_RESETTRAP;
+ /* Note that signal handlers have been reset, so we should no longer
+ reset the handler and resend trapped signals to ourselves. */
+ subshell_environment &= ~SUBSHELL_IGNTRAP;
/* We are in a subshell, so forget that we are running a trap handler or
that the signal handler has changed (we haven't changed it!) */
@@ -4320,7 +4323,8 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
already_forked = 1;
cmdflags |= CMD_NO_FORK;
- subshell_environment = SUBSHELL_FORK; /* XXX */
+ /* We redo some of what make_child() does with SUBSHELL_IGNTRAP */
+ subshell_environment = SUBSHELL_FORK|SUBSHELL_IGNTRAP; /* XXX */
if (pipe_in != NO_PIPE || pipe_out != NO_PIPE)
subshell_environment |= SUBSHELL_PIPE;
if (async)
@@ -4574,6 +4578,7 @@ run_builtin:
trap strings if we run trap to change a signal disposition. */
reset_signal_handlers ();
subshell_environment |= SUBSHELL_RESETTRAP;
+ subshell_environment &= ~SUBSHELL_IGNTRAP;
if (async)
{
@@ -5514,6 +5519,7 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
reset_terminating_signals (); /* XXX */
/* Cancel traps, in trap.c. */
restore_original_signals ();
+ subshell_environment &= ~SUBSHELL_IGNTRAP;
#if defined (JOB_CONTROL)
FREE (p);
diff --git a/jobs.c b/jobs.c
index a581f305..7c3b6e83 100644
--- a/jobs.c
+++ b/jobs.c
@@ -2217,6 +2217,8 @@ make_child (command, flags)
signals to the default state for a new process. */
pid_t mypid;
+ subshell_environment |= SUBSHELL_IGNTRAP;
+
/* If this ends up being changed to modify or use `command' in the
child process, go back and change callers who free `command' in
the child process when this returns. */
diff --git a/nojobs.c b/nojobs.c
index c5fc83d9..f2563ca0 100644
--- a/nojobs.c
+++ b/nojobs.c
@@ -575,6 +575,8 @@ make_child (command, flags)
last_asynchronous_pid = getpid ();
#endif
+ subshell_environment |= SUBSHELL_IGNTRAP;
+
default_tty_job_signals ();
}
else
diff --git a/sig.c b/sig.c
index 6964d862..e6537d26 100644
--- a/sig.c
+++ b/sig.c
@@ -55,7 +55,8 @@
# include "bashhist.h"
#endif
-extern void initialize_siglist ();
+extern void initialize_siglist PARAMS((void));
+extern void set_original_signal PARAMS((int, SigHandler *));
#if !defined (JOB_CONTROL)
extern void initialize_job_signals PARAMS((void));
@@ -255,6 +256,13 @@ initialize_terminating_signals ()
sigaction (XSIG (i), &act, &oact);
XHANDLER(i) = oact.sa_handler;
XSAFLAGS(i) = oact.sa_flags;
+
+#if 0
+ set_original_signal (XSIG(i), XHANDLER(i)); /* optimization */
+#else
+ set_original_signal (XSIG(i), act.sa_handler); /* optimization */
+#endif
+
/* Don't do anything with signals that are ignored at shell entry
if the shell is not interactive. */
/* XXX - should we do this for interactive shells, too? */
diff --git a/subst.c b/subst.c
index 462752de..327de083 100644
--- a/subst.c
+++ b/subst.c
@@ -5951,6 +5951,7 @@ process_substitute (string, open_for_read_in_child)
free_pushed_string_input ();
/* Cancel traps, in trap.c. */
restore_original_signals (); /* XXX - what about special builtins? bash-4.2 */
+ subshell_environment &= ~SUBSHELL_IGNTRAP;
QUIT; /* catch any interrupts we got post-fork */
setup_async_signals ();
#if 0
@@ -6382,6 +6383,7 @@ command_substitute (string, quoted, flags)
}
QUIT; /* catch any interrupts we got post-fork */
subshell_environment |= SUBSHELL_RESETTRAP;
+ subshell_environment &= ~SUBSHELL_IGNTRAP;
}
#if defined (JOB_CONTROL)
diff --git a/trap.c b/trap.c
index c7f8ded5..1b27fb3a 100644
--- a/trap.c
+++ b/trap.c
@@ -481,6 +481,32 @@ trap_handler (sig)
SIGRETURN (0);
}
+ /* This means we're in a subshell, but have not yet reset the handler for
+ trapped signals. We're not supposed to execute the trap in this situation;
+ we should restore the original signal and resend the signal to ourselves
+ to preserve the Posix "signal traps that are not being ignored shall be
+ set to the default action" semantics. */
+ if ((subshell_environment & SUBSHELL_IGNTRAP) && trap_list[sig] != (char *)IGNORE_SIG)
+ {
+ sigset_t mask;
+
+ /* Paranoia */
+ if (original_signals[sig] == IMPOSSIBLE_TRAP_HANDLER)
+ original_signals[sig] = SIG_DFL;
+
+ restore_signal (sig);
+
+ /* Make sure we let the signal we just caught through */
+ sigemptyset (&mask);
+ sigprocmask (SIG_SETMASK, (sigset_t *)NULL, &mask);
+ sigdelset (&mask, sig);
+ sigprocmask (SIG_SETMASK, &mask, (sigset_t *)NULL);
+
+ kill (getpid (), sig);
+
+ SIGRETURN (0);
+ }
+
if ((sig >= NSIG) ||
(trap_list[sig] == (char *)DEFAULT_SIG) ||
(trap_list[sig] == (char *)IGNORE_SIG))
--
2.33.0

View File

@ -1,27 +0,0 @@
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

View File

@ -1,28 +0,0 @@
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

View File

@ -1,28 +0,0 @@
From 18ad612ea80ba978ae8271800814737e224a4baf Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Tue, 4 Jan 2022 17:01:33 -0500
Subject: [PATCH] Bash-5.1 patch 15: fix readline display of some characters >
128 in certain single-byte encodings
Conflict:NA
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=18ad612ea80ba978ae8271800814737e224a4baf
---
lib/readline/display.c | 2 +-
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/readline/display.c b/lib/readline/display.c
index 38b3d0e7..f5d32945 100644
--- a/lib/readline/display.c
+++ b/lib/readline/display.c
@@ -1598,7 +1598,7 @@ puts_face (const char *str, const char *face, int n)
char cur_face;
for (cur_face = FACE_NORMAL, i = 0; i < n; i++)
- putc_face (str[i], face[i], &cur_face);
+ putc_face ((unsigned char) str[i], face[i], &cur_face);
putc_face (EOF, FACE_NORMAL, &cur_face);
}
--
2.33.0

View File

@ -1,42 +0,0 @@
From 9439ce094c9aa7557a9d53ac7b412a23aa66e36b Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Tue, 4 Jan 2022 17:03:45 -0500
Subject: [PATCH] Bash-5.1 patch 16: fix interpretation of multiple instances
of ! in [[ conditional commands
Conflict:NA
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=9439ce094c9aa7557a9d53ac7b412a23aa66e36b
---
parse.y | 2 +-
y.tab.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/parse.y b/parse.y
index f25575b5..f4168c7c 100644
--- a/parse.y
+++ b/parse.y
@@ -4796,7 +4796,7 @@ cond_term ()
dispose_word (yylval.word); /* not needed */
term = cond_term ();
if (term)
- term->flags |= CMD_INVERT_RETURN;
+ term->flags ^= CMD_INVERT_RETURN;
}
else if (tok == WORD && yylval.word->word[0] == '-' && yylval.word->word[1] && yylval.word->word[2] == 0 && test_unop (yylval.word->word))
{
diff --git a/y.tab.c b/y.tab.c
index c11d7aaa..78b38250 100644
--- a/y.tab.c
+++ b/y.tab.c
@@ -7090,7 +7090,7 @@ cond_term ()
dispose_word (yylval.word); /* not needed */
term = cond_term ();
if (term)
- term->flags |= CMD_INVERT_RETURN;
+ term->flags ^= CMD_INVERT_RETURN;
}
else if (tok == WORD && yylval.word->word[0] == '-' && yylval.word->word[1] && yylval.word->word[2] == 0 && test_unop (yylval.word->word))
{
--
2.33.0

View File

@ -1,139 +0,0 @@
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

View File

@ -1,27 +0,0 @@
From 9cef6d01181525de119832d2b6a925899cdec08e Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Fri, 9 Sep 2022 16:44:32 -0400
Subject: [PATCH] Bash-5.2-rc4 release
Conflict:backport partial patch to fix CVE-2022-3715
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=9cef6d01181525de119832d2b6a925899cdec08e
---
subst.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/subst.c b/subst.c
index 677eeed..8fd03f3 100644
--- a/subst.c
+++ b/subst.c
@@ -7959,7 +7959,7 @@ parameter_brace_transform (varname, value, ind, xform, rtype, quoted, pflags, fl
return ((char *)NULL);
}
- if (valid_parameter_transform (xform) == 0)
+ if (xform[0] == 0 || valid_parameter_transform (xform) == 0)
{
this_command_name = oname;
#if 0 /* TAG: bash-5.2 Martin Schulte <gnu@schrader-schulte.de> 10/2020 */
--
2.33.0

View File

@ -1,52 +0,0 @@
From a99d905216cc0aac5de0c3050f4afc54e21c6bc5 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Wed, 5 Oct 2022 10:37:38 -0400
Subject: [PATCH] Bash-5.2 patch 2: fix crash in readline when started with an
invalid locale specification
---
lib/readline/nls.c | 8 +++++++-
patchlevel.h | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/readline/nls.c b/lib/readline/nls.c
index d2f67e0..5d1cd19 100644
--- a/lib/readline/nls.c
+++ b/lib/readline/nls.c
@@ -56,6 +56,8 @@
static int utf8locale PARAMS((char *));
+#define RL_DEFAULT_LOCALE "C"
+
#if !defined (HAVE_SETLOCALE)
/* A list of legal values for the LANG or LC_CTYPE environment variables.
If a locale name in this list is the value for the LC_ALL, LC_CTYPE,
@@ -136,7 +138,11 @@ _rl_init_locale (void)
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;
+
_rl_utf8locale = (ret && *ret) ? utf8locale (ret) : 0;
return ret;
diff --git a/patchlevel.h b/patchlevel.h
index 10fde2e..17586ff 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -25,6 +25,6 @@
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
looks for to find the patch level (for the sccs version string). */
-#define PATCHLEVEL 8
+#define PATCHLEVEL 9
#endif /* _PATCHLEVEL_H_ */
--
2.35.1

View File

@ -1,134 +0,0 @@
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

View File

@ -10,10 +10,10 @@ Subject: [PATCH] bash-2.05a-interpreter
3 files changed, 151 insertions(+), 1 deletion(-)
diff --git a/config.h.in b/config.h.in
index ab316d4..11d1d68 100644
index d6d5293..da5b9d8 100644
--- a/config.h.in
+++ b/config.h.in
@@ -775,6 +775,9 @@
@@ -765,6 +765,9 @@
/* Define if you have the pselect function. */
#undef HAVE_PSELECT
@ -23,7 +23,7 @@ index ab316d4..11d1d68 100644
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
@@ -981,6 +984,9 @@
@@ -971,6 +974,9 @@
/* Define if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@ -34,10 +34,10 @@ index ab316d4..11d1d68 100644
#undef HAVE_GRP_H
diff --git a/configure.ac b/configure.ac
index 2fe3e7d..f1b7f1b 100644
index 50a6e20..6619788 100644
--- a/configure.ac
+++ b/configure.ac
@@ -827,7 +827,7 @@ dnl checks for system calls
@@ -843,7 +843,7 @@ dnl checks for system calls
AC_CHECK_FUNCS(dup2 eaccess fcntl getdtablesize getentropy getgroups \
gethostname getpagesize getpeername getrandom getrlimit \
getrusage gettimeofday kill killpg lstat pselect readlink \
@ -47,7 +47,7 @@ index 2fe3e7d..f1b7f1b 100644
dnl checks for c library functions
diff --git a/execute_cmd.c b/execute_cmd.c
index d2a0dd7..374843d 100644
index 41d3cf8..457a2e9 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -41,6 +41,10 @@
@ -61,7 +61,7 @@ index d2a0dd7..374843d 100644
#include "posixtime.h"
#if defined (HAVE_SYS_RESOURCE_H) && !defined (RLIMTYPE)
@@ -5832,6 +5836,14 @@ shell_execve (command, args, env)
@@ -5991,6 +5995,14 @@ shell_execve (command, args, env)
{
/* The file has the execute bits set, but the kernel refuses to
run it for some reason. See why. */
@ -76,7 +76,7 @@ index d2a0dd7..374843d 100644
#if defined (HAVE_HASH_BANG_EXEC)
READ_SAMPLE_BUF (command, sample, sample_len);
if (sample_len > 0)
@@ -5841,6 +5853,7 @@ shell_execve (command, args, env)
@@ -6000,6 +6012,7 @@ shell_execve (command, args, env)
char *interp;
int ilen;
@ -84,7 +84,7 @@ index d2a0dd7..374843d 100644
interp = getinterp (sample, sample_len, (int *)NULL);
ilen = strlen (interp);
errno = i;
@@ -5856,6 +5869,137 @@ shell_execve (command, args, env)
@@ -6015,6 +6028,137 @@ shell_execve (command, args, env)
return (EX_NOEXEC);
}
#endif
@ -223,5 +223,5 @@ index d2a0dd7..374843d 100644
file_error (command);
}
--
2.23.0
2.33.0

View File

@ -8,18 +8,18 @@ Subject: [PATCH] bash-2.05b-pgrp_sync
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 6899e82..d131798 100644
index cc97bd4..6162f6e 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1332,7 +1332,7 @@ main()
@@ -1324,7 +1324,7 @@ main()
wait(&status);
exit(ok ? 0 : 5);
}
-], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
+], bash_cv_pgrp_pipe=yes,bash_cv_pgrp_pipe=yes,
-]])], [bash_cv_pgrp_pipe=no], [bash_cv_pgrp_pipe=yes],
+]])], [bash_cv_pgrp_pipe=yes], [bash_cv_pgrp_pipe=yes],
[AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
bash_cv_pgrp_pipe=no])
])
bash_cv_pgrp_pipe=no]
)])
--
2.23.0
2.33.0

View File

@ -8,10 +8,10 @@ Subject: [PATCH] bash-4.0-nobits
1 file changed, 107 insertions(+), 4 deletions(-)
diff --git a/execute_cmd.c b/execute_cmd.c
index 374843d..99674df 100644
index 457a2e9..c78881e 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -5875,6 +5875,7 @@ shell_execve (command, args, env)
@@ -6034,6 +6034,7 @@ shell_execve (command, args, env)
&& memcmp (sample, ELFMAG, SELFMAG) == 0)
{
off_t offset = -1;
@ -19,7 +19,7 @@ index 374843d..99674df 100644
/* It is an ELF file. Now determine whether it is dynamically
linked and if yes, get the offset of the interpreter
@@ -5884,13 +5885,61 @@ shell_execve (command, args, env)
@@ -6043,13 +6044,61 @@ shell_execve (command, args, env)
{
Elf32_Ehdr ehdr;
Elf32_Phdr *phdr;
@ -60,7 +60,7 @@ index 374843d..99674df 100644
+ if (lseek (fd, shdr[ehdr.e_shstrndx].sh_offset,
+ SEEK_SET) != -1)
+ sample_len = read (fd, strings,
+ shdr[ehdr.e_shstrndx].sh_size);
+ shdr[ehdr.e_shstrndx].sh_size);
+ else
+ sample_len = -1;
+#endif
@ -82,7 +82,7 @@ index 374843d..99674df 100644
nphdr = ehdr.e_phnum;
phdr = (Elf32_Phdr *) malloc (nphdr * ehdr.e_phentsize);
if (phdr != NULL)
@@ -5920,13 +5969,60 @@ shell_execve (command, args, env)
@@ -6079,13 +6128,60 @@ shell_execve (command, args, env)
{
Elf64_Ehdr ehdr;
Elf64_Phdr *phdr;
@ -122,7 +122,7 @@ index 374843d..99674df 100644
+ if (lseek (fd, shdr[ehdr.e_shstrndx].sh_offset,
+ SEEK_SET) != -1)
+ sample_len = read (fd, strings,
+ shdr[ehdr.e_shstrndx].sh_size);
+ shdr[ehdr.e_shstrndx].sh_size);
+ else
+ sample_len = -1;
+#endif
@ -144,7 +144,7 @@ index 374843d..99674df 100644
nphdr = ehdr.e_phnum;
phdr = (Elf64_Phdr *) malloc (nphdr * ehdr.e_phentsize);
if (phdr != NULL)
@@ -5986,8 +6082,15 @@ shell_execve (command, args, env)
@@ -6145,8 +6241,15 @@ shell_execve (command, args, env)
{
close (fd);
errno = i;
@ -163,5 +163,5 @@ index 374843d..99674df 100644
return (EX_NOEXEC);
}
--
2.23.0
2.33.0

View File

@ -8,10 +8,10 @@ Subject: [PATCH] bash-4.2-coverity
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/execute_cmd.c b/execute_cmd.c
index 99674df..657c047 100644
index c78881e..d59a1fa 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -5886,7 +5886,7 @@ shell_execve (command, args, env)
@@ -6045,7 +6045,7 @@ shell_execve (command, args, env)
Elf32_Ehdr ehdr;
Elf32_Phdr *phdr;
Elf32_Shdr *shdr;
@ -20,7 +20,7 @@ index 99674df..657c047 100644
/* We have to copy the data since the sample buffer
might not be aligned correctly to be accessed as
@@ -5894,12 +5894,12 @@ shell_execve (command, args, env)
@@ -6053,12 +6053,12 @@ shell_execve (command, args, env)
memcpy (&ehdr, sample, sizeof (Elf32_Ehdr));
nshdr = ehdr.e_shnum;
@ -35,7 +35,7 @@ index 99674df..657c047 100644
ehdr.e_shoff);
#else
if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
@@ -5941,11 +5941,11 @@ shell_execve (command, args, env)
@@ -6100,11 +6100,11 @@ shell_execve (command, args, env)
}
nphdr = ehdr.e_phnum;
@ -49,7 +49,7 @@ index 99674df..657c047 100644
ehdr.e_phoff);
#else
if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
@@ -5970,7 +5970,7 @@ shell_execve (command, args, env)
@@ -6129,7 +6129,7 @@ shell_execve (command, args, env)
Elf64_Ehdr ehdr;
Elf64_Phdr *phdr;
Elf64_Shdr *shdr;
@ -58,7 +58,7 @@ index 99674df..657c047 100644
/* We have to copy the data since the sample buffer
might not be aligned correctly to be accessed as
@@ -5978,11 +5978,11 @@ shell_execve (command, args, env)
@@ -6137,11 +6137,11 @@ shell_execve (command, args, env)
memcpy (&ehdr, sample, sizeof (Elf64_Ehdr));
nshdr = ehdr.e_shnum;
@ -72,7 +72,7 @@ index 99674df..657c047 100644
ehdr.e_shoff);
#else
if (lseek (fd, ehdr.e_shoff, SEEK_SET) != -1)
@@ -6024,11 +6024,11 @@ shell_execve (command, args, env)
@@ -6183,11 +6183,11 @@ shell_execve (command, args, env)
}
nphdr = ehdr.e_phnum;
@ -86,7 +86,7 @@ index 99674df..657c047 100644
ehdr.e_phoff);
#else
if (lseek (fd, ehdr.e_phoff, SEEK_SET) != -1)
@@ -6050,8 +6050,8 @@ shell_execve (command, args, env)
@@ -6209,8 +6209,8 @@ shell_execve (command, args, env)
if (offset != -1)
{
@ -97,7 +97,7 @@ index 99674df..657c047 100644
char *interp = NULL;
do
@@ -6100,7 +6100,8 @@ shell_execve (command, args, env)
@@ -6259,7 +6259,8 @@ shell_execve (command, args, env)
}
#endif
#if defined (HAVE_HASH_BANG_EXEC) || defined (HAVE_ELF_H)
@ -108,5 +108,5 @@ index 99674df..657c047 100644
errno = i;
--
2.23.0
2.33.0

View File

@ -8,10 +8,10 @@ Subject: [PATCH] bash-4.3-memleak-lc_all
1 file changed, 2 deletions(-)
diff --git a/locale.c b/locale.c
index 17ccc58..a6c07a3 100644
index fabf7b1..d3f2665 100644
--- a/locale.c
+++ b/locale.c
@@ -78,8 +78,6 @@ set_default_locale ()
@@ -80,8 +80,6 @@ set_default_locale ()
{
#if defined (HAVE_SETLOCALE)
default_locale = setlocale (LC_ALL, "");
@ -21,5 +21,5 @@ index 17ccc58..a6c07a3 100644
default_locale = savestring ("C");
#endif /* HAVE_SETLOCALE */
--
2.23.0
2.33.0

View File

@ -4,28 +4,29 @@ Date: Mon, 31 May 2021 22:52:29 +0800
Subject: [PATCH] bash-4.3-noecho
---
parse.y | 2 ++
parse.y | 3 +++
subst.c | 5 +++++
2 files changed, 7 insertions(+)
2 files changed, 8 insertions(+)
diff --git a/parse.y b/parse.y
index df1231d..2449fa8 100644
index 1d12e63..8dca179 100644
--- a/parse.y
+++ b/parse.y
@@ -4482,6 +4482,8 @@ xparse_dolparen (base, string, indp, flags)
@@ -4262,6 +4262,9 @@ xparse_dolparen (base, string, indp, flags)
save_parser_state (&ps);
save_input_line_state (&ls);
orig_eof_token = shell_eof_token;
+ /* avoid echoing every substitution again */
+ echo_input_at_read = 0;
+
#if defined (ALIAS) || defined (DPAREN_ARITHMETIC)
saved_pushed_strings = pushed_string_list; /* separate parsing context */
pushed_string_list = (STRING_SAVER *)NULL;
#endif
diff --git a/subst.c b/subst.c
index 9ccbf33..8a9ee5c 100644
index 1ac6eb2..2e76b80 100644
--- a/subst.c
+++ b/subst.c
@@ -9453,6 +9453,7 @@ param_expand (string, sindex, quoted, expanded_something,
@@ -10239,6 +10239,7 @@ param_expand (string, sindex, quoted, expanded_something,
WORD_LIST *list, *l;
WORD_DESC *tdesc, *ret;
int tflag, nullarg;
@ -33,7 +34,7 @@ index 9ccbf33..8a9ee5c 100644
/*itrace("param_expand: `%s' pflags = %d", string+*sindex, pflags);*/
zindex = *sindex;
@@ -9843,6 +9844,9 @@ arithsub:
@@ -10631,6 +10632,9 @@ arithsub:
}
comsub:
@ -43,7 +44,7 @@ index 9ccbf33..8a9ee5c 100644
if (pflags & PF_NOCOMSUB)
/* we need zindex+1 because string[zindex] == RPAREN */
temp1 = substring (string, *sindex, zindex+1);
@@ -9855,6 +9859,7 @@ comsub:
@@ -10643,6 +10647,7 @@ comsub:
}
FREE (temp);
temp = temp1;
@ -52,5 +53,5 @@ index 9ccbf33..8a9ee5c 100644
/* Do POSIX.2d9-style arithmetic substitution. This will probably go
--
2.23.0
2.33.0

View File

@ -1,7 +1,24 @@
diff -Nuar bash-5.1.8.org/configure bash-5.1.8.sw/configure
--- bash-5.1.8.org/configure 2021-10-15 16:12:05.691193735 +0800
+++ bash-5.1.8.sw/configure 2021-10-15 16:32:01.231145759 +0800
@@ -2890,6 +2890,7 @@
From 2f3bec93b49804f8d6651478d1675e8f46668029 Mon Sep 17 00:00:00 2001
From: wangyuhang <wangyuhang27@huawei.com>
Date: Mon, 17 Jul 2023 16:07:51 +0800
Subject: [PATCH] bash-5.1-sw.patch
---
configure | 3 ++-
configure.ac | 1 +
general.h | 2 +-
lib/intl/dcigettext.c | 2 +-
m4/host-cpu-c-abi.m4 | 9 +++++++++
m4/intdiv0.m4 | 2 +-
support/config.guess | 8 ++++++++
support/config.sub | 1 +
8 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 4731375..e4c6de3 100755
--- a/configure
+++ b/configure
@@ -3271,6 +3271,7 @@ opt_with_installed_readline=no
case "${host_cpu}-${host_os}" in
# mostly obsolete platforms
alpha*-*) opt_bash_malloc=no ;; # alpha running osf/1 or linux
@ -9,7 +26,7 @@ diff -Nuar bash-5.1.8.org/configure bash-5.1.8.sw/configure
*[Cc]ray*-*) opt_bash_malloc=no ;; # Crays
*-osf1*) opt_bash_malloc=no ;; # other osf/1 machines
*-dgux*) opt_bash_malloc=no ;; # DG/UX machines
@@ -7875,7 +7876,7 @@
@@ -8490,7 +8491,7 @@ then :
# Guess based on the CPU.
case "$host_cpu" in
@ -18,10 +35,11 @@ diff -Nuar bash-5.1.8.org/configure bash-5.1.8.sw/configure
gt_cv_int_divbyzero_sigfpe="guessing yes";;
*)
gt_cv_int_divbyzero_sigfpe="guessing no";;
diff -Nuar bash-5.1.8.org/configure.ac bash-5.1.8.sw/configure.ac
--- bash-5.1.8.org/configure.ac 2021-10-15 16:12:05.727193733 +0800
+++ bash-5.1.8.sw/configure.ac 2021-10-15 16:32:26.167144759 +0800
@@ -65,6 +65,7 @@
diff --git a/configure.ac b/configure.ac
index 6619788..5cd5a3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,7 @@ dnl look in the NOTES file for more
case "${host_cpu}-${host_os}" in
# mostly obsolete platforms
alpha*-*) opt_bash_malloc=no ;; # alpha running osf/1 or linux
@ -29,9 +47,10 @@ diff -Nuar bash-5.1.8.org/configure.ac bash-5.1.8.sw/configure.ac
*[[Cc]]ray*-*) opt_bash_malloc=no ;; # Crays
*-osf1*) opt_bash_malloc=no ;; # other osf/1 machines
*-dgux*) opt_bash_malloc=no ;; # DG/UX machines
diff -Nuar bash-5.1.8.org/general.h bash-5.1.8.sw/general.h
--- bash-5.1.8.org/general.h 2021-10-15 16:12:05.726193734 +0800
+++ bash-5.1.8.sw/general.h 2021-10-15 16:28:55.053153230 +0800
diff --git a/general.h b/general.h
index 8064c50..2505694 100644
--- a/general.h
+++ b/general.h
@@ -57,7 +57,7 @@
/* Hardly used anymore */
#define pointer_to_int(x) (int)((char *)x - (char *)0)
@ -41,10 +60,11 @@ diff -Nuar bash-5.1.8.org/general.h bash-5.1.8.sw/general.h
extern char *strchr (), *strrchr ();
#endif
diff -Nuar bash-5.1.8.org/lib/intl/dcigettext.c bash-5.1.8.sw/lib/intl/dcigettext.c
--- bash-5.1.8.org/lib/intl/dcigettext.c 2021-10-15 16:12:05.686193735 +0800
+++ bash-5.1.8.sw/lib/intl/dcigettext.c 2021-10-15 16:28:45.480153615 +0800
@@ -74,7 +74,7 @@
diff --git a/lib/intl/dcigettext.c b/lib/intl/dcigettext.c
index c0f347e..8abf933 100644
--- a/lib/intl/dcigettext.c
+++ b/lib/intl/dcigettext.c
@@ -74,7 +74,7 @@ extern int errno;
#ifdef _LIBC
/* Guess whether integer division by zero raises signal SIGFPE.
Set to 1 only if you know for sure. In case of doubt, set to 0. */
@ -53,23 +73,24 @@ diff -Nuar bash-5.1.8.org/lib/intl/dcigettext.c bash-5.1.8.sw/lib/intl/dcigettex
|| defined __m68k__ || defined __s390__
# define INTDIV0_RAISES_SIGFPE 1
# else
diff -Nuar bash-5.1.8.org/m4/host-cpu-c-abi.m4 bash-5.1.8.sw/m4/host-cpu-c-abi.m4
--- bash-5.1.8.org/m4/host-cpu-c-abi.m4 2021-10-15 16:12:05.726193734 +0800
+++ bash-5.1.8.sw/m4/host-cpu-c-abi.m4 2021-10-15 16:26:05.539160033 +0800
@@ -91,6 +91,12 @@
diff --git a/m4/host-cpu-c-abi.m4 b/m4/host-cpu-c-abi.m4
index 4407296..057dfe3 100644
--- a/m4/host-cpu-c-abi.m4
+++ b/m4/host-cpu-c-abi.m4
@@ -90,6 +90,12 @@ changequote([,])dnl
[gl_cv_host_cpu_c_abi=i386])
;;
changequote(,)dnl
+changequote(,)dnl
+ sw_64* )
+changequote([,])dnl
+ gl_cv_host_cpu_c_abi=sw_64
+ ;;
+
+changequote(,)dnl
changequote(,)dnl
alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] )
changequote([,])dnl
gl_cv_host_cpu_c_abi=alpha
@@ -355,6 +361,9 @@
@@ -355,6 +361,9 @@ EOF
#ifndef __x86_64__
#undef __x86_64__
#endif
@ -79,10 +100,11 @@ diff -Nuar bash-5.1.8.org/m4/host-cpu-c-abi.m4 bash-5.1.8.sw/m4/host-cpu-c-abi.m
#ifndef __alpha__
#undef __alpha__
#endif
diff -Nuar bash-5.1.8.org/m4/intdiv0.m4 bash-5.1.8.sw/m4/intdiv0.m4
--- bash-5.1.8.org/m4/intdiv0.m4 2021-10-15 16:12:05.726193734 +0800
+++ bash-5.1.8.sw/m4/intdiv0.m4 2021-10-15 16:25:19.697161872 +0800
@@ -69,7 +69,7 @@
diff --git a/m4/intdiv0.m4 b/m4/intdiv0.m4
index 40dd43b..198700a 100644
--- a/m4/intdiv0.m4
+++ b/m4/intdiv0.m4
@@ -69,7 +69,7 @@ int main ()
# Guess based on the CPU.
changequote(,)dnl
case "$host_cpu" in
@ -91,13 +113,14 @@ diff -Nuar bash-5.1.8.org/m4/intdiv0.m4 bash-5.1.8.sw/m4/intdiv0.m4
gt_cv_int_divbyzero_sigfpe="guessing yes";;
*)
gt_cv_int_divbyzero_sigfpe="guessing no";;
diff -Nuar bash-5.1.8.org/support/config.guess bash-5.1.8.sw/support/config.guess
--- bash-5.1.8.org/support/config.guess 2021-10-15 16:12:05.690193735 +0800
+++ bash-5.1.8.sw/support/config.guess 2021-10-15 16:21:57.441169989 +0800
@@ -924,6 +924,14 @@
diff --git a/support/config.guess b/support/config.guess
index 7f76b62..f8d09d9 100644
--- a/support/config.guess
+++ b/support/config.guess
@@ -976,6 +976,14 @@ EOF
UNAME_MACHINE=aarch64_be
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;;
GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
;;
+ sw_64:Linux:*:*)
+ case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in
+ sw) UNAME_MACHINE=sw_64 ;;
@ -107,12 +130,13 @@ diff -Nuar bash-5.1.8.org/support/config.guess bash-5.1.8.sw/support/config.gues
+ echo "$UNAME_MACHINE"-sunway-linux-"$LIBC"
+ exit ;;
alpha:Linux:*:*)
case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
EV5) UNAME_MACHINE=alphaev5 ;;
diff -Nuar bash-5.1.8.org/support/config.sub bash-5.1.8.sw/support/config.sub
--- bash-5.1.8.org/support/config.sub 2021-10-15 16:12:05.690193735 +0800
+++ bash-5.1.8.sw/support/config.sub 2021-10-15 16:18:49.228177541 +0800
@@ -1160,6 +1160,7 @@
diff --git a/support/config.sub b/support/config.sub
index 9b62e37..1dc8d91 100644
--- a/support/config.sub
+++ b/support/config.sub
@@ -1182,6 +1182,7 @@ case $cpu-$vendor in
| a29k \
| aarch64 | aarch64_be \
| abacus \
@ -120,3 +144,6 @@ diff -Nuar bash-5.1.8.org/support/config.sub bash-5.1.8.sw/support/config.sub
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \
| alphapca5[67] | alpha64pca5[67] \
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: bash
Version: 5.1.8
Release: 8
Version: 5.2.15
Release: 1
Summary: It is the Bourne Again Shell
License: GPLv3
URL: https://www.gnu.org/software/bash
@ -11,7 +11,6 @@ Source2: dot-bash_profile
Source3: dot-bash_logout
# PATCH-FIX-UPSTREAM
Patch115: bash-2.05a-interpreter.patch
Patch118: bash-2.05b-pgrp_sync.patch
Patch125: bash-4.0-nobits.patch
@ -24,19 +23,6 @@ Patch137: bugfix-Forbidden-non-root-user-to-clear-history.patch
Patch138: enable-dot-logout-and-source-bashrc-through-ssh.patch
Patch139: cd-alias.patch
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
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
@ -130,6 +116,12 @@ make check
%exclude %{_infodir}/dir
%changelog
* Mon Jul 17 2023 wangyuhang <wangyuhang27@huawei.com> -5.2.15-1
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: update to 5.2.15
* Thu Jun 15 2023 wangyuhang <wangyuhang27@huawei.com> -5.1.8-8
- Type:bugfix
- ID:NA

View File

@ -10,7 +10,7 @@ Subject: [PATCH] bugfix-Forbidden-non-root-user-to-clear-history
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/bashhist.c b/bashhist.c
index d2155dc..e61bde6 100644
index 90cd8c3..7c73492 100644
--- a/bashhist.c
+++ b/bashhist.c
@@ -345,8 +345,9 @@ load_history ()
@ -26,10 +26,10 @@ index d2155dc..e61bde6 100644
}
diff --git a/lib/readline/history.c b/lib/readline/history.c
index 67158b1..3c1652b 100644
index 81d4c16..4682a4e 100644
--- a/lib/readline/history.c
+++ b/lib/readline/history.c
@@ -590,9 +590,14 @@ history_is_stifled (void)
@@ -597,9 +597,14 @@ history_is_stifled (void)
return (history_stifled);
}
@ -45,25 +45,25 @@ index 67158b1..3c1652b 100644
register int i;
/* This loses because we cannot free the data. */
@@ -604,4 +609,5 @@ clear_history (void)
@@ -611,4 +616,5 @@ clear_history (void)
history_offset = history_length = 0;
history_base = 1; /* reset history base to default */
+ return 0;
}
diff --git a/lib/readline/history.h b/lib/readline/history.h
index cc3de29..78f8f52 100644
index 5208f9a..d826658 100644
--- a/lib/readline/history.h
+++ b/lib/readline/history.h
@@ -110,7 +110,7 @@ extern histdata_t free_history_entry PARAMS((HIST_ENTRY *));
extern HIST_ENTRY *replace_history_entry PARAMS((int, const char *, histdata_t));
@@ -115,7 +115,7 @@ extern histdata_t free_history_entry (HIST_ENTRY *);
extern HIST_ENTRY *replace_history_entry (int, const char *, histdata_t);
/* Clear the history list and start over. */
-extern void clear_history PARAMS((void));
+extern int clear_history PARAMS((void));
-extern void clear_history (void);
+extern int clear_history (void);
/* Stifle the history list, remembering only MAX number of entries. */
extern void stifle_history PARAMS((int));
extern void stifle_history (int);
--
2.27.0
2.33.0

View File

@ -19,4 +19,5 @@ index 0000000..563121b
+alias ..='cd ..'
+alias ...='cd ../..'
--
2.27.0
2.33.0

View File

@ -8,10 +8,10 @@ Subject: [PATCH] enable-dot-logout-and-source-bashrc-through-ssh
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/config-top.h b/config-top.h
index 735f75e..4fee122 100644
index db4ab6e..18a28b7 100644
--- a/config-top.h
+++ b/config-top.h
@@ -94,17 +94,17 @@
@@ -100,17 +100,17 @@
/* #define SYS_BASHRC "/etc/bash.bashrc" */
/* System-wide .bash_logout for login shells. */
@ -33,5 +33,5 @@ index 735f75e..4fee122 100644
/* Define if you want the case-toggling operators (~[~]) and the
`capcase' variable attribute (declare -c). */
--
2.23.0
2.33.0