Compare commits
10 Commits
d7f5e5330c
...
59abb42b26
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59abb42b26 | ||
|
|
3228879223 | ||
|
|
5a9592b18b | ||
|
|
2e83188621 | ||
|
|
47eb25badf | ||
|
|
c0943e7b59 | ||
|
|
ffb907e550 | ||
|
|
09cd4cf31e | ||
|
|
deaec7b668 | ||
|
|
d16be25dc1 |
@ -0,0 +1,31 @@
|
|||||||
|
From b1764f8226260d5b58958d613c7654f01e624dca Mon Sep 17 00:00:00 2001
|
||||||
|
From: Zhao Mengmeng <zhaomengmeng@kylinos.cn>
|
||||||
|
Date: Mon, 3 Jun 2024 16:49:46 +0800
|
||||||
|
Subject: [PATCH] Fix a performance regression while using large number of
|
||||||
|
environment variables
|
||||||
|
|
||||||
|
Resolves: RHEL-20020
|
||||||
|
Signed-off-by: Siteshwar Vashisht <svashisht@redhat.com>
|
||||||
|
---
|
||||||
|
execute_cmd.c | 4 ----
|
||||||
|
1 file changed, 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/execute_cmd.c b/execute_cmd.c
|
||||||
|
index 71d147c..2e33722 100644
|
||||||
|
--- a/execute_cmd.c
|
||||||
|
+++ b/execute_cmd.c
|
||||||
|
@@ -5482,11 +5482,7 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
|
||||||
|
{
|
||||||
|
/* If we're optimizing out the fork (implicit `exec'), decrement the
|
||||||
|
shell level like `exec' would do. */
|
||||||
|
-#if 0 /* TAG: bash-5.2 psmith 10/11/2020 */
|
||||||
|
if (nofork && pipe_in == NO_PIPE && pipe_out == NO_PIPE && (subshell_environment & SUBSHELL_PIPE) == 0)
|
||||||
|
-#else
|
||||||
|
- if (nofork && pipe_in == NO_PIPE && pipe_out == NO_PIPE)
|
||||||
|
-#endif
|
||||||
|
adjust_shell_level (-1);
|
||||||
|
|
||||||
|
maybe_make_export_env ();
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
From 8418224f32f4dda85019cae063370c18bbd2d036 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chet Ramey <chet.ramey@case.edu>
|
||||||
|
Date: Tue, 25 Jul 2023 10:18:35 -0400
|
||||||
|
Subject: [PATCH] changes for quoting special and multibyte characters in glob
|
||||||
|
patterns; changes to filename unicode normalization on macOS for globbing and
|
||||||
|
filename completion; send SIGCONT unconditionally to just-restarted job in
|
||||||
|
fg/bg
|
||||||
|
|
||||||
|
Conflict:partial round, only added function bashline_set_filename_hooks for this round
|
||||||
|
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=8418224f32f4dda85019cae063370c18bbd2d036
|
||||||
|
---
|
||||||
|
bashline.c | 13 +++++++++++++
|
||||||
|
bashline.h | 1 +
|
||||||
|
2 files changed, 14 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/bashline.c b/bashline.c
|
||||||
|
index a0e9044..4799de2 100644
|
||||||
|
--- a/bashline.c
|
||||||
|
+++ b/bashline.c
|
||||||
|
@@ -3257,6 +3257,19 @@ restore_directory_hook (hookf)
|
||||||
|
rl_directory_rewrite_hook = hookf;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Set the readline hooks that affect how directories and filenames are
|
||||||
|
+ converted. Extern so other parts of the shell can use. */
|
||||||
|
+void
|
||||||
|
+bashline_set_filename_hooks (void)
|
||||||
|
+{
|
||||||
|
+ /* Tell the completer that we might want to follow symbolic links or
|
||||||
|
+ do other expansion on directory names. */
|
||||||
|
+ set_directory_hook ();
|
||||||
|
+
|
||||||
|
+ rl_filename_rewrite_hook = bash_filename_rewrite_hook;
|
||||||
|
+ rl_filename_stat_hook = bash_filename_stat_hook;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Check whether not DIRNAME, with any trailing slash removed, exists. If
|
||||||
|
SHOULD_DEQUOTE is non-zero, we dequote the directory name first. */
|
||||||
|
static int
|
||||||
|
diff --git a/bashline.h b/bashline.h
|
||||||
|
index 48c9fec..7dfa913 100644
|
||||||
|
--- a/bashline.h
|
||||||
|
+++ b/bashline.h
|
||||||
|
@@ -53,6 +53,7 @@ extern int unbind_unix_command PARAMS((char *));
|
||||||
|
|
||||||
|
extern char **bash_default_completion PARAMS((const char *, int, int, int, int));
|
||||||
|
|
||||||
|
+extern void bashline_set_filename_hooks (void);
|
||||||
|
void set_directory_hook PARAMS((void));
|
||||||
|
|
||||||
|
/* Used by programmable completion code. */
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -0,0 +1,86 @@
|
|||||||
|
From fe24a6a55e8850298b496c5b9d82f1866eba190e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chet Ramey <chet.ramey@case.edu>
|
||||||
|
Date: Mon, 30 Oct 2023 12:16:07 -0400
|
||||||
|
Subject: [PATCH] changes to SIGINT handler while waiting for a child; skip
|
||||||
|
vertical whitespace after translating an integer
|
||||||
|
|
||||||
|
Conflict:partial round, only the modified content of jobs.c is rounded.
|
||||||
|
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=fe24a6a55e8850298b496c5b9d82f1866eba190e
|
||||||
|
---
|
||||||
|
jobs.c | 20 +++++++++++++-------
|
||||||
|
1 file changed, 13 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/jobs.c b/jobs.c
|
||||||
|
index 7c3b6e8..c22ac9f 100644
|
||||||
|
--- a/jobs.c
|
||||||
|
+++ b/jobs.c
|
||||||
|
@@ -2727,6 +2727,10 @@ wait_for_background_pids (ps)
|
||||||
|
#define INVALID_SIGNAL_HANDLER (SigHandler *)wait_for_background_pids
|
||||||
|
static SigHandler *old_sigint_handler = INVALID_SIGNAL_HANDLER;
|
||||||
|
|
||||||
|
+/* The current SIGINT handler as set by restore_sigint_handler. Only valid
|
||||||
|
+ immediately after restore_sigint_handler, used for continuations. */
|
||||||
|
+static SigHandler *cur_sigint_handler = INVALID_SIGNAL_HANDLER;
|
||||||
|
+
|
||||||
|
static int wait_sigint_received;
|
||||||
|
static int child_caught_sigint;
|
||||||
|
|
||||||
|
@@ -2743,6 +2747,7 @@ wait_sigint_cleanup ()
|
||||||
|
static void
|
||||||
|
restore_sigint_handler ()
|
||||||
|
{
|
||||||
|
+ cur_sigint_handler = old_sigint_handler;
|
||||||
|
if (old_sigint_handler != INVALID_SIGNAL_HANDLER)
|
||||||
|
{
|
||||||
|
set_signal_handler (SIGINT, old_sigint_handler);
|
||||||
|
@@ -2766,8 +2771,7 @@ wait_sigint_handler (sig)
|
||||||
|
restore_sigint_handler ();
|
||||||
|
/* If we got a SIGINT while in `wait', and SIGINT is trapped, do
|
||||||
|
what POSIX.2 says (see builtins/wait.def for more info). */
|
||||||
|
- if (this_shell_builtin && this_shell_builtin == wait_builtin &&
|
||||||
|
- signal_is_trapped (SIGINT) &&
|
||||||
|
+ if (signal_is_trapped (SIGINT) &&
|
||||||
|
((sigint_handler = trap_to_sighandler (SIGINT)) == trap_handler))
|
||||||
|
{
|
||||||
|
trap_handler (SIGINT); /* set pending_traps[SIGINT] */
|
||||||
|
@@ -2790,6 +2794,8 @@ wait_sigint_handler (sig)
|
||||||
|
{
|
||||||
|
set_exit_status (128+SIGINT);
|
||||||
|
restore_sigint_handler ();
|
||||||
|
+ if (cur_sigint_handler == INVALID_SIGNAL_HANDLER)
|
||||||
|
+ set_sigint_handler (); /* XXX - only do this in one place */
|
||||||
|
kill (getpid (), SIGINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -2934,15 +2940,15 @@ wait_for (pid, flags)
|
||||||
|
{
|
||||||
|
SigHandler *temp_sigint_handler;
|
||||||
|
|
||||||
|
- temp_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
|
||||||
|
- if (temp_sigint_handler == wait_sigint_handler)
|
||||||
|
+ temp_sigint_handler = old_sigint_handler;
|
||||||
|
+ old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
|
||||||
|
+ if (old_sigint_handler == wait_sigint_handler)
|
||||||
|
{
|
||||||
|
#if defined (DEBUG)
|
||||||
|
internal_warning ("wait_for: recursively setting old_sigint_handler to wait_sigint_handler: running_trap = %d", running_trap);
|
||||||
|
#endif
|
||||||
|
+ old_sigint_handler = temp_sigint_handler;
|
||||||
|
}
|
||||||
|
- else
|
||||||
|
- old_sigint_handler = temp_sigint_handler;
|
||||||
|
waiting_for_child = 0;
|
||||||
|
if (old_sigint_handler == SIG_IGN)
|
||||||
|
set_signal_handler (SIGINT, old_sigint_handler);
|
||||||
|
@@ -4148,7 +4154,7 @@ set_job_status_and_cleanup (job)
|
||||||
|
SIGINT (if we reset the sighandler to the default).
|
||||||
|
In this case, we have to fix things up. What a crock. */
|
||||||
|
if (temp_handler == trap_handler && signal_is_trapped (SIGINT) == 0)
|
||||||
|
- temp_handler = trap_to_sighandler (SIGINT);
|
||||||
|
+ temp_handler = trap_to_sighandler (SIGINT);
|
||||||
|
restore_sigint_handler ();
|
||||||
|
if (temp_handler == SIG_DFL)
|
||||||
|
termsig_handler (SIGINT); /* XXX */
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
From 09c32bc946baad7364b30abb491f72f7728b56d9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chet Ramey <chet.ramey@case.edu>
|
||||||
|
Date: Tue, 10 Oct 2023 12:00:19 -0400
|
||||||
|
Subject: [PATCH] fix for @E transformation; fixes for failures in arith for
|
||||||
|
and for commands; style changes to man page; fix for bug in read builtin if
|
||||||
|
it assigns to IFS
|
||||||
|
|
||||||
|
Conflict:partial round, only the modified content of execute_cmd.c is rounded.
|
||||||
|
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=09c32bc946baad7364b30abb491f72f7728b56d9
|
||||||
|
---
|
||||||
|
execute_cmd.c | 25 +++++++------------------
|
||||||
|
1 file changed, 7 insertions(+), 18 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/execute_cmd.c b/execute_cmd.c
|
||||||
|
index a855376..71d147c 100644
|
||||||
|
--- a/execute_cmd.c
|
||||||
|
+++ b/execute_cmd.c
|
||||||
|
@@ -2837,8 +2837,11 @@ execute_for_command (for_command)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
save_line_number = line_number;
|
||||||
|
+ line_number = for_command->line; /* for expansion error messages */
|
||||||
|
+
|
||||||
|
if (check_identifier (for_command->name, 1) == 0)
|
||||||
|
{
|
||||||
|
+ line_number = save_line_number;
|
||||||
|
if (posixly_correct && interactive_shell == 0)
|
||||||
|
{
|
||||||
|
last_command_exit_value = EX_BADUSAGE;
|
||||||
|
@@ -2850,7 +2853,6 @@ execute_for_command (for_command)
|
||||||
|
loop_level++;
|
||||||
|
identifier = for_command->name->word;
|
||||||
|
|
||||||
|
- line_number = for_command->line; /* for expansion error messages */
|
||||||
|
list = releaser = expand_words_no_vars (for_command->map_list);
|
||||||
|
|
||||||
|
begin_unwind_frame ("for");
|
||||||
|
@@ -3075,13 +3077,8 @@ execute_arith_for_command (arith_for_command)
|
||||||
|
|
||||||
|
/* Evaluate the initialization expression. */
|
||||||
|
expresult = eval_arith_for_expr (arith_for_command->init, &expok);
|
||||||
|
- if (expok == 0)
|
||||||
|
- {
|
||||||
|
- line_number = save_lineno;
|
||||||
|
- return (EXECUTION_FAILURE);
|
||||||
|
- }
|
||||||
|
|
||||||
|
- while (1)
|
||||||
|
+ while (expok)
|
||||||
|
{
|
||||||
|
/* Evaluate the test expression. */
|
||||||
|
line_number = arith_lineno;
|
||||||
|
@@ -3089,10 +3086,8 @@ execute_arith_for_command (arith_for_command)
|
||||||
|
line_number = save_lineno;
|
||||||
|
|
||||||
|
if (expok == 0)
|
||||||
|
- {
|
||||||
|
- body_status = EXECUTION_FAILURE;
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
REAP ();
|
||||||
|
if (expresult == 0)
|
||||||
|
break;
|
||||||
|
@@ -3120,18 +3115,12 @@ execute_arith_for_command (arith_for_command)
|
||||||
|
line_number = arith_lineno;
|
||||||
|
expresult = eval_arith_for_expr (arith_for_command->step, &expok);
|
||||||
|
line_number = save_lineno;
|
||||||
|
-
|
||||||
|
- if (expok == 0)
|
||||||
|
- {
|
||||||
|
- body_status = EXECUTION_FAILURE;
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
loop_level--;
|
||||||
|
line_number = save_lineno;
|
||||||
|
|
||||||
|
- return (body_status);
|
||||||
|
+ return (expok ? body_status : EXECUTION_FAILURE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -0,0 +1,237 @@
|
|||||||
|
From 35465406cdae9cd4a15e7f6699e657b5d09bf7bd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chet Ramey <chet.ramey@case.edu>
|
||||||
|
Date: Fri, 2 Feb 2024 14:39:50 -0500
|
||||||
|
Subject: [PATCH] fix for cd when curent directory doesn't exist; fix wait -n
|
||||||
|
in posix mode to delete any job that it returns; fix some variables where
|
||||||
|
readonly can be circumvented; fix some overflows in printf
|
||||||
|
|
||||||
|
Conflict:only the modified content of builtins/printf.def is rounded. The bindflags variable in the upstream community patch does not exist, so 0 is used instead of bindflags, which is consistent with the current version
|
||||||
|
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=35465406cdae9cd4a15e7f6699e657b5d09bf7bd
|
||||||
|
---
|
||||||
|
builtins/printf.def | 122 +++++++++++++++++++++++---------------------
|
||||||
|
1 file changed, 65 insertions(+), 57 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/builtins/printf.def b/builtins/printf.def
|
||||||
|
index 0a5f489..b2d1094 100644
|
||||||
|
--- a/builtins/printf.def
|
||||||
|
+++ b/builtins/printf.def
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
This file is printf.def, from which is created printf.c.
|
||||||
|
It implements the builtin "printf" in Bash.
|
||||||
|
|
||||||
|
-Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
||||||
|
+Copyright (C) 1997-2024 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This file is part of GNU Bash, the Bourne Again SHell.
|
||||||
|
|
||||||
|
@@ -107,6 +107,50 @@ $END
|
||||||
|
extern int errno;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+/* We free the buffer used by mklong() if it's `too big'. */
|
||||||
|
+#define PRETURN(value) \
|
||||||
|
+ do \
|
||||||
|
+ { \
|
||||||
|
+ QUIT; \
|
||||||
|
+ retval = value; \
|
||||||
|
+ if (conv_bufsize > 4096 ) \
|
||||||
|
+ { \
|
||||||
|
+ free (conv_buf); \
|
||||||
|
+ conv_bufsize = 0; \
|
||||||
|
+ conv_buf = 0; \
|
||||||
|
+ } \
|
||||||
|
+ if (vflag) \
|
||||||
|
+ { \
|
||||||
|
+ SHELL_VAR *v; \
|
||||||
|
+ v = builtin_bind_variable (vname, vbuf, 0); \
|
||||||
|
+ stupidly_hack_special_variables (vname); \
|
||||||
|
+ if (v == 0 || readonly_p (v) || noassign_p (v)) \
|
||||||
|
+ retval = EXECUTION_FAILURE; \
|
||||||
|
+ if (vbsize > 4096) \
|
||||||
|
+ { \
|
||||||
|
+ free (vbuf); \
|
||||||
|
+ vbsize = 0; \
|
||||||
|
+ vbuf = 0; \
|
||||||
|
+ } \
|
||||||
|
+ else if (vbuf) \
|
||||||
|
+ vbuf[0] = 0; \
|
||||||
|
+ } \
|
||||||
|
+ else \
|
||||||
|
+ { \
|
||||||
|
+ if (ferror (stdout) == 0) \
|
||||||
|
+ fflush (stdout); \
|
||||||
|
+ QUIT; \
|
||||||
|
+ if (ferror (stdout)) \
|
||||||
|
+ { \
|
||||||
|
+ sh_wrerror (); \
|
||||||
|
+ clearerr (stdout); \
|
||||||
|
+ retval = EXECUTION_FAILURE; \
|
||||||
|
+ } \
|
||||||
|
+ } \
|
||||||
|
+ return (retval); \
|
||||||
|
+ } \
|
||||||
|
+ while (0)
|
||||||
|
+
|
||||||
|
#define PC(c) \
|
||||||
|
do { \
|
||||||
|
char b[2]; \
|
||||||
|
@@ -122,7 +166,9 @@ extern int errno;
|
||||||
|
#define PF(f, func) \
|
||||||
|
do { \
|
||||||
|
int nw; \
|
||||||
|
- clearerr (stdout); \
|
||||||
|
+ if (vflag == 0) \
|
||||||
|
+ clearerr (stdout); \
|
||||||
|
+ errno = 0; \
|
||||||
|
if (have_fieldwidth && have_precision) \
|
||||||
|
nw = vflag ? vbprintf (f, fieldwidth, precision, func) : printf (f, fieldwidth, precision, func); \
|
||||||
|
else if (have_fieldwidth) \
|
||||||
|
@@ -131,56 +177,17 @@ extern int errno;
|
||||||
|
nw = vflag ? vbprintf (f, precision, func) : printf (f, precision, func); \
|
||||||
|
else \
|
||||||
|
nw = vflag ? vbprintf (f, func) : printf (f, func); \
|
||||||
|
- tw += nw; \
|
||||||
|
- QUIT; \
|
||||||
|
- if (ferror (stdout)) \
|
||||||
|
+ if (nw < 0 || ferror (stdout)) \
|
||||||
|
{ \
|
||||||
|
- sh_wrerror (); \
|
||||||
|
- clearerr (stdout); \
|
||||||
|
- return (EXECUTION_FAILURE); \
|
||||||
|
+ QUIT; \
|
||||||
|
+ if (vflag) \
|
||||||
|
+ builtin_error ("%s", strerror (errno)); \
|
||||||
|
+ PRETURN (EXECUTION_FAILURE); \
|
||||||
|
} \
|
||||||
|
+ tw += nw; \
|
||||||
|
+ QUIT; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
-/* We free the buffer used by mklong() if it's `too big'. */
|
||||||
|
-#define PRETURN(value) \
|
||||||
|
- do \
|
||||||
|
- { \
|
||||||
|
- QUIT; \
|
||||||
|
- if (vflag) \
|
||||||
|
- { \
|
||||||
|
- SHELL_VAR *v; \
|
||||||
|
- v = builtin_bind_variable (vname, vbuf, 0); \
|
||||||
|
- stupidly_hack_special_variables (vname); \
|
||||||
|
- if (v == 0 || readonly_p (v) || noassign_p (v)) \
|
||||||
|
- return (EXECUTION_FAILURE); \
|
||||||
|
- } \
|
||||||
|
- if (conv_bufsize > 4096 ) \
|
||||||
|
- { \
|
||||||
|
- free (conv_buf); \
|
||||||
|
- conv_bufsize = 0; \
|
||||||
|
- conv_buf = 0; \
|
||||||
|
- } \
|
||||||
|
- if (vbsize > 4096) \
|
||||||
|
- { \
|
||||||
|
- free (vbuf); \
|
||||||
|
- vbsize = 0; \
|
||||||
|
- vbuf = 0; \
|
||||||
|
- } \
|
||||||
|
- else if (vbuf) \
|
||||||
|
- vbuf[0] = 0; \
|
||||||
|
- if (ferror (stdout) == 0) \
|
||||||
|
- fflush (stdout); \
|
||||||
|
- QUIT; \
|
||||||
|
- if (ferror (stdout)) \
|
||||||
|
- { \
|
||||||
|
- sh_wrerror (); \
|
||||||
|
- clearerr (stdout); \
|
||||||
|
- return (EXECUTION_FAILURE); \
|
||||||
|
- } \
|
||||||
|
- return (value); \
|
||||||
|
- } \
|
||||||
|
- while (0)
|
||||||
|
-
|
||||||
|
#define SKIP1 "#'-+ 0"
|
||||||
|
#define LENMODS "hjlLtz"
|
||||||
|
|
||||||
|
@@ -228,7 +235,7 @@ static int conversion_error;
|
||||||
|
static int vflag = 0;
|
||||||
|
static char *vbuf, *vname;
|
||||||
|
static size_t vbsize;
|
||||||
|
-static int vblen;
|
||||||
|
+static size_t vblen;
|
||||||
|
|
||||||
|
static intmax_t tw;
|
||||||
|
|
||||||
|
@@ -305,6 +312,7 @@ printf_builtin (list)
|
||||||
|
return ((v == 0 || readonly_p (v) || noassign_p (v)) ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* If the format string is empty after preprocessing, return immediately. */
|
||||||
|
if (list->word->word == 0 || list->word->word[0] == '\0')
|
||||||
|
return (EXECUTION_SUCCESS);
|
||||||
|
|
||||||
|
@@ -313,10 +321,6 @@ printf_builtin (list)
|
||||||
|
|
||||||
|
garglist = orig_arglist = list->next;
|
||||||
|
|
||||||
|
- /* If the format string is empty after preprocessing, return immediately. */
|
||||||
|
- if (format == 0 || *format == 0)
|
||||||
|
- return (EXECUTION_SUCCESS);
|
||||||
|
-
|
||||||
|
/* Basic algorithm is to scan the format string for conversion
|
||||||
|
specifications -- once one is found, find out if the field
|
||||||
|
width or precision is a '*'; if it is, gather up value. Note,
|
||||||
|
@@ -681,7 +685,7 @@ printf_builtin (list)
|
||||||
|
modstart[1] = nextch;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (ferror (stdout))
|
||||||
|
+ if (vflag == 0 && ferror (stdout))
|
||||||
|
{
|
||||||
|
/* PRETURN will print error message. */
|
||||||
|
PRETURN (EXECUTION_FAILURE);
|
||||||
|
@@ -811,7 +815,7 @@ printstr (fmt, string, len, fieldwidth, precision)
|
||||||
|
for (; padlen < 0; padlen++)
|
||||||
|
PC (' ');
|
||||||
|
|
||||||
|
- return (ferror (stdout) ? -1 : 0);
|
||||||
|
+ return ((vflag == 0 && ferror (stdout)) ? -1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Convert STRING by expanding the escape sequences specified by the
|
||||||
|
@@ -1029,7 +1033,7 @@ vbadd (buf, blen)
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
if (strlen (vbuf) != vblen)
|
||||||
|
- internal_error ("printf:vbadd: vblen (%d) != strlen (vbuf) (%d)", vblen, (int)strlen (vbuf));
|
||||||
|
+ internal_error ("printf:vbadd: vblen (%zu) != strlen (vbuf) (%zu)", vblen, strlen (vbuf));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return vbuf;
|
||||||
|
@@ -1051,6 +1055,8 @@ vbprintf (format, va_alist)
|
||||||
|
SH_VA_START (args, format);
|
||||||
|
blen = vsnprintf (vbuf + vblen, vbsize - vblen, format, args);
|
||||||
|
va_end (args);
|
||||||
|
+ if (blen < 0)
|
||||||
|
+ return (blen);
|
||||||
|
|
||||||
|
nlen = vblen + blen + 1;
|
||||||
|
if (nlen >= vbsize)
|
||||||
|
@@ -1060,6 +1066,8 @@ vbprintf (format, va_alist)
|
||||||
|
SH_VA_START (args, format);
|
||||||
|
blen = vsnprintf (vbuf + vblen, vbsize - vblen, format, args);
|
||||||
|
va_end (args);
|
||||||
|
+ if (blen < 0)
|
||||||
|
+ return (blen);
|
||||||
|
}
|
||||||
|
|
||||||
|
vblen += blen;
|
||||||
|
@@ -1067,7 +1075,7 @@ vbprintf (format, va_alist)
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
if (strlen (vbuf) != vblen)
|
||||||
|
- internal_error ("printf:vbprintf: vblen (%d) != strlen (vbuf) (%d)", vblen, (int)strlen (vbuf));
|
||||||
|
+ internal_error ("printf:vbprintf: vblen (%zu) != strlen (vbuf) (%zu)", vblen, strlen (vbuf));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return (blen);
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
From f6a78e24d8928574fb239978c10d3509619271a2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chet Ramey <chet.ramey@case.edu>
|
||||||
|
Date: Fri, 28 Jul 2023 11:35:44 -0400
|
||||||
|
Subject: [PATCH] fixes for $LINENO in multi-line simple commands; printf
|
||||||
|
out-of-range values now cause a non-zero return status
|
||||||
|
|
||||||
|
Conflict:partial round, only the modified content of builtins/complete.def is rounded.
|
||||||
|
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=f6a78e24d8928574fb239978c10d3509619271a2
|
||||||
|
---
|
||||||
|
builtins/complete.def | 2 +
|
||||||
|
1 files changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/builtins/complete.def b/builtins/complete.def
|
||||||
|
index 74d966d5..aeae2438 100644
|
||||||
|
--- a/builtins/complete.def
|
||||||
|
+++ b/builtins/complete.def
|
||||||
|
@@ -724,6 +724,8 @@ compgen_builtin (WORD_LIST *list)
|
||||||
|
|
||||||
|
rval = EXECUTION_FAILURE;
|
||||||
|
|
||||||
|
+ bashline_set_filename_hooks ();
|
||||||
|
+
|
||||||
|
/* probably don't have to save these, just being safe */
|
||||||
|
old_line = pcomp_line;
|
||||||
|
old_ind = pcomp_ind;
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
From b30389070ab27e0429a7c16bae492afd1a8b0f6c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chet Ramey <chet.ramey@case.edu>
|
||||||
|
Date: Mon, 6 Nov 2023 09:26:02 -0500
|
||||||
|
Subject: [PATCH] renamed several functions beginning with legal_; changed all
|
||||||
|
callers
|
||||||
|
|
||||||
|
Conflict:partial round, only the modified content of brace_expand_word_list is rounded.
|
||||||
|
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=b30389070ab27e0429a7c16bae492afd1a8b0f6c
|
||||||
|
---
|
||||||
|
subst.c | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/subst.c b/subst.c
|
||||||
|
index 779bed3..a5429f4 100644
|
||||||
|
--- a/subst.c
|
||||||
|
+++ b/subst.c
|
||||||
|
@@ -11526,6 +11526,12 @@ brace_expand_word_list (tlist, eflags)
|
||||||
|
if (mbschr (tlist->word->word, LBRACE))
|
||||||
|
{
|
||||||
|
expansions = brace_expand (tlist->word->word);
|
||||||
|
+ if (expansions == 0)
|
||||||
|
+ {
|
||||||
|
+ expansions = strvec_create (2);
|
||||||
|
+ expansions[0] = savestring (tlist->word->word);
|
||||||
|
+ expansions[1] = NULL;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
for (eindex = 0; temp_string = expansions[eindex]; eindex++)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
73
bash.spec
73
bash.spec
@ -1,14 +1,6 @@
|
|||||||
%if %{?openEuler:1}0
|
|
||||||
%global ENABLE_RELOC 0
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%if %{ENABLE_RELOC}
|
|
||||||
%global ldflags_options -Wl,--emit-relocs
|
|
||||||
%endif
|
|
||||||
|
|
||||||
Name: bash
|
Name: bash
|
||||||
Version: 5.1.8
|
Version: 5.1.8
|
||||||
Release: 11
|
Release: 16
|
||||||
Summary: It is the Bourne Again Shell
|
Summary: It is the Bourne Again Shell
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
URL: https://www.gnu.org/software/bash
|
URL: https://www.gnu.org/software/bash
|
||||||
@ -47,6 +39,13 @@ Patch6008: backport-fixes-for-array-subscripts-and-values-containing-0x0.patch
|
|||||||
Patch6009: backport-fix-for-nofork-comsub-command-printing-fix-for-crash.patch
|
Patch6009: backport-fix-for-nofork-comsub-command-printing-fix-for-crash.patch
|
||||||
Patch6010: backport-fix-small-memleak-in-globbing.patch
|
Patch6010: backport-fix-small-memleak-in-globbing.patch
|
||||||
Patch6011: backport-fix-for-leak-when-completing-command-word-with-glob-.patch
|
Patch6011: backport-fix-for-leak-when-completing-command-word-with-glob-.patch
|
||||||
|
Patch6012: backport-fix-for-E-transformation-fixes-for-failures-in-arith.patch
|
||||||
|
Patch6013: backport-changes-for-quoting-special-and-multibyte-characters.patch
|
||||||
|
Patch6014: backport-fixes-for-LINENO-in-multi-line-simple-commands-print.patch
|
||||||
|
Patch6015: backport-changes-to-SIGINT-handler-while-waiting-for-a-child-.patch
|
||||||
|
Patch6016: backport-renamed-several-functions-beginning-with-legal_-chan.patch
|
||||||
|
Patch6017: backport-fix-for-cd-when-curent-directory-doesn-t-exist-fix-w.patch
|
||||||
|
Patch6018: backport-Fix-a-performance-regression-while-using-large-numbe.patch
|
||||||
|
|
||||||
BuildRequires: gcc bison texinfo autoconf ncurses-devel
|
BuildRequires: gcc bison texinfo autoconf ncurses-devel
|
||||||
# Required for bash tests
|
# Required for bash tests
|
||||||
@ -71,16 +70,6 @@ Requires: pkgconf-pkg-config
|
|||||||
%description devel
|
%description devel
|
||||||
This package contains development files for %{name}.
|
This package contains development files for %{name}.
|
||||||
|
|
||||||
%if %{?ENABLE_RELOC}
|
|
||||||
%package relocation
|
|
||||||
Summary: Relocations for %{name}
|
|
||||||
Requires: %{name} = %{version}-%{release}
|
|
||||||
BuildRequires: sysboost-devel
|
|
||||||
|
|
||||||
%description relocation
|
|
||||||
This package contains relocations for %{name}.
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%package help
|
%package help
|
||||||
Summary: Documents for %{name}
|
Summary: Documents for %{name}
|
||||||
Buildarch: noarch
|
Buildarch: noarch
|
||||||
@ -96,17 +85,12 @@ Man pages and other related documents for %{name}.
|
|||||||
|
|
||||||
%build
|
%build
|
||||||
autoconf
|
autoconf
|
||||||
%configure --with-bash-malloc=no --with-afs LDFLAGS="%{?ldflags_options}"
|
%configure --with-bash-malloc=no --with-afs
|
||||||
MFLAGS="CPPFLAGS=-D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='\"/usr/local/bin:/usr/bin\"' `getconf LFS_CFLAGS`"
|
MFLAGS="CPPFLAGS=-D_GNU_SOURCE -DRECYCLES_PIDS -DDEFAULT_PATH_VALUE='\"/usr/local/bin:/usr/bin\"' `getconf LFS_CFLAGS`"
|
||||||
make "$MFLAGS" version.h
|
make "$MFLAGS" version.h
|
||||||
make "$MFLAGS" -C builtins
|
make "$MFLAGS" -C builtins
|
||||||
%make_build "$MFLAGS"
|
%make_build "$MFLAGS"
|
||||||
|
|
||||||
%if %{?ENABLE_RELOC}
|
|
||||||
objreloc $RPM_BUILD_DIR/%{name}-%{version}/bash
|
|
||||||
rm -rf $RPM_BUILD_DIR/%{name}-%{version}/bash.prim
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%make_install install-headers
|
%make_install install-headers
|
||||||
ln -sf bash %{buildroot}%{_bindir}/sh
|
ln -sf bash %{buildroot}%{_bindir}/sh
|
||||||
@ -115,11 +99,6 @@ install -pDm 644 %SOURCE2 %{buildroot}/etc/skel/.bash_profile
|
|||||||
install -pDm 644 %SOURCE3 %{buildroot}/etc/skel/.bash_logout
|
install -pDm 644 %SOURCE3 %{buildroot}/etc/skel/.bash_logout
|
||||||
install -pDm 644 ./configs/alias.sh %{buildroot}%{_sysconfdir}/profile.d/alias.sh
|
install -pDm 644 ./configs/alias.sh %{buildroot}%{_sysconfdir}/profile.d/alias.sh
|
||||||
|
|
||||||
%if %{?ENABLE_RELOC}
|
|
||||||
mkdir -p ${RPM_BUILD_ROOT}/usr/lib/relocation/%{_bindir}
|
|
||||||
install -pDm 400 $RPM_BUILD_DIR/%{name}-%{version}/bash.relocation ${RPM_BUILD_ROOT}/usr/lib/relocation/%{_bindir}/bash.relocation
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# bug #820192, need to add execable alternatives for regular built-ins
|
# bug #820192, need to add execable alternatives for regular built-ins
|
||||||
for ea in alias bg cd command fc fg getopts hash jobs read type ulimit umask unalias wait
|
for ea in alias bg cd command fc fg getopts hash jobs read type ulimit umask unalias wait
|
||||||
do
|
do
|
||||||
@ -143,12 +122,6 @@ make check
|
|||||||
%{_bindir}/{hash,getopts,jobs,read,type,ulimit,umask,unalias}
|
%{_bindir}/{hash,getopts,jobs,read,type,ulimit,umask,unalias}
|
||||||
%config(noreplace) %{_sysconfdir}/profile.d/alias.sh
|
%config(noreplace) %{_sysconfdir}/profile.d/alias.sh
|
||||||
|
|
||||||
%if %{ENABLE_RELOC}
|
|
||||||
%files relocation
|
|
||||||
%defattr(-,root,root)
|
|
||||||
/usr/lib/relocation/%{_bindir}/bash.relocation
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%{_includedir}/%{name}
|
%{_includedir}/%{name}
|
||||||
@ -166,6 +139,34 @@ make check
|
|||||||
%exclude %{_infodir}/dir
|
%exclude %{_infodir}/dir
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jun 20 2024 wangyuhang<wangyuhang27@huawei.com> - 5.1.8-16
|
||||||
|
- rebuild for new release
|
||||||
|
|
||||||
|
* Mon Jun 03 2024 Zhao Mengmeng <zhaomengmeng@kylinos.cn> - 5.1.8-15
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: Fix a performance regression while using large number of environment variables
|
||||||
|
|
||||||
|
* Fri Mar 29 2024 wangyuhang<wangyuhang27@huawei.com> - 5.1.8-14
|
||||||
|
- fix some overflows in printf
|
||||||
|
|
||||||
|
* Wed Mar 27 2024 wangyuhang <wangyuhang27@huawei.com> -5.1.8-13
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:Relocations are no longer required.
|
||||||
|
|
||||||
|
* Fri Dec 15 2023 wangyuhang <wangyuhang27@huawei.com> -5.1.8-12
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: add backport-fix-for-E-transformation-fixes-for-failures-in-arith.patch
|
||||||
|
backport-changes-for-quoting-special-and-multibyte-characters.patch
|
||||||
|
backport-fixes-for-LINENO-in-multi-line-simple-commands-print.patch
|
||||||
|
backport-changes-to-SIGINT-handler-while-waiting-for-a-child-.patch
|
||||||
|
backport-renamed-several-functions-beginning-with-legal_-chan.patch
|
||||||
|
|
||||||
* Tue Oct 17 2023 wangyuhang <wangyuhang27@huawei.com> -5.1.8-11
|
* Tue Oct 17 2023 wangyuhang <wangyuhang27@huawei.com> -5.1.8-11
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user