From b2cba1378511ef28a180ecdb40df1a5495992bfa Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Sat, 29 May 2021 23:46:21 +0200 Subject: [PATCH] Update to bash-5.1 patchlevel 8 --- bash-5.1-patch-5.patch | 85 ++++++++++++++++++++++++++++++++++++++++++ bash-5.1-patch-6.patch | 44 ++++++++++++++++++++++ bash-5.1-patch-7.patch | 71 +++++++++++++++++++++++++++++++++++ bash-5.1-patch-8.patch | 49 ++++++++++++++++++++++++ bash.spec | 7 +++- 5 files changed, 254 insertions(+), 2 deletions(-) create mode 100644 bash-5.1-patch-5.patch create mode 100644 bash-5.1-patch-6.patch create mode 100644 bash-5.1-patch-7.patch create mode 100644 bash-5.1-patch-8.patch diff --git a/bash-5.1-patch-5.patch b/bash-5.1-patch-5.patch new file mode 100644 index 0000000..51da516 --- /dev/null +++ b/bash-5.1-patch-5.patch @@ -0,0 +1,85 @@ +From cc978a670597afc3251baca3a7db553f36946c22 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Tue, 4 May 2021 14:29:06 -0400 +Subject: [PATCH] Bash-5.1 patch 5: fix memory leaks in compound array + assignments + +--- + arrayfunc.c | 11 +++-------- + patchlevel.h | 2 +- + subst.c | 2 ++ + 3 files changed, 6 insertions(+), 9 deletions(-) + +diff --git a/arrayfunc.c b/arrayfunc.c +index 8231ba1e..9338dfc7 100644 +--- a/arrayfunc.c ++++ b/arrayfunc.c +@@ -564,12 +564,9 @@ assign_assoc_from_kvlist (var, nlist, h, flags) + { + WORD_LIST *list; + char *akey, *aval, *k, *v; +- int free_aval; + + for (list = nlist; list; list = list->next) + { +- free_aval = 0; +- + k = list->word->word; + v = list->next ? list->next->word->word : 0; + +@@ -577,24 +574,22 @@ assign_assoc_from_kvlist (var, nlist, h, flags) + list = list->next; + + akey = expand_assignment_string_to_string (k, 0); +- aval = expand_assignment_string_to_string (v, 0); +- + if (akey == 0 || *akey == 0) + { + err_badarraysub (k); + FREE (akey); + continue; + } ++ ++ aval = expand_assignment_string_to_string (v, 0); + if (aval == 0) + { + aval = (char *)xmalloc (1); + aval[0] = '\0'; /* like do_assignment_internal */ +- free_aval = 1; + } + + bind_assoc_var_internal (var, h, akey, aval, flags); +- if (free_aval) +- free (aval); ++ free (aval); + } + } + +diff --git a/patchlevel.h b/patchlevel.h +index e1429c24..c7f39aec 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 4 ++#define PATCHLEVEL 5 + + #endif /* _PATCHLEVEL_H_ */ +diff --git a/subst.c b/subst.c +index 6132316a..1d24188e 100644 +--- a/subst.c ++++ b/subst.c +@@ -11673,6 +11673,8 @@ expand_compound_assignment_word (tlist, flags) + free (value); + + value = string_list (l); ++ dispose_words (l); ++ + wlen = STRLEN (value); + + /* Now, let's rebuild the string */ +-- +2.29.2 + diff --git a/bash-5.1-patch-6.patch b/bash-5.1-patch-6.patch new file mode 100644 index 0000000..cfa603d --- /dev/null +++ b/bash-5.1-patch-6.patch @@ -0,0 +1,44 @@ +From f3cd936b81006df41a1c8509891dea1edeaef8e6 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Tue, 4 May 2021 14:30:17 -0400 +Subject: [PATCH] Bash-5.1 patch 6: make sure child processes forked to execute + command substitutions are in the right process group + +--- + patchlevel.h | 2 +- + subst.c | 7 +++++++ + 2 files changed, 8 insertions(+), 1 deletion(-) + +diff --git a/patchlevel.h b/patchlevel.h +index c7f39aec..6257aeeb 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 5 ++#define PATCHLEVEL 6 + + #endif /* _PATCHLEVEL_H_ */ +diff --git a/subst.c b/subst.c +index 1d24188e..462752de 100644 +--- a/subst.c ++++ b/subst.c +@@ -6412,6 +6412,13 @@ command_substitute (string, quoted, flags) + /* The currently executing shell is not interactive. */ + interactive = 0; + ++#if defined (JOB_CONTROL) ++ /* Invariant: in child processes started to run command substitutions, ++ pipeline_pgrp == shell_pgrp. Other parts of the shell assume this. */ ++ if (pipeline_pgrp > 0 && pipeline_pgrp != shell_pgrp) ++ shell_pgrp = pipeline_pgrp; ++#endif ++ + set_sigint_handler (); /* XXX */ + + free_pushed_string_input (); +-- +2.29.2 + diff --git a/bash-5.1-patch-7.patch b/bash-5.1-patch-7.patch new file mode 100644 index 0000000..fecdae5 --- /dev/null +++ b/bash-5.1-patch-7.patch @@ -0,0 +1,71 @@ +From b72f88db852104cf49cfb4762eda6e8f4fd20a70 Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Tue, 4 May 2021 14:31:05 -0400 +Subject: [PATCH] Bash-5.1 patch 7: fix version comparisons in readline startup + files + +--- + lib/readline/bind.c | 15 ++++++++------- + patchlevel.h | 2 +- + 2 files changed, 9 insertions(+), 8 deletions(-) + +diff --git a/lib/readline/bind.c b/lib/readline/bind.c +index 87596dce..76103786 100644 +--- a/lib/readline/bind.c ++++ b/lib/readline/bind.c +@@ -1234,7 +1234,7 @@ parser_if (char *args) + #endif /* VI_MODE */ + else if (_rl_strnicmp (args, "version", 7) == 0) + { +- int rlversion, versionarg, op, previ, major, minor; ++ int rlversion, versionarg, op, previ, major, minor, opresult; + + _rl_parsing_conditionalized_out = 1; + rlversion = RL_VERSION_MAJOR*10 + RL_VERSION_MINOR; +@@ -1294,24 +1294,25 @@ parser_if (char *args) + switch (op) + { + case OP_EQ: +- _rl_parsing_conditionalized_out = rlversion == versionarg; ++ opresult = rlversion == versionarg; + break; + case OP_NE: +- _rl_parsing_conditionalized_out = rlversion != versionarg; ++ opresult = rlversion != versionarg; + break; + case OP_GT: +- _rl_parsing_conditionalized_out = rlversion > versionarg; ++ opresult = rlversion > versionarg; + break; + case OP_GE: +- _rl_parsing_conditionalized_out = rlversion >= versionarg; ++ opresult = rlversion >= versionarg; + break; + case OP_LT: +- _rl_parsing_conditionalized_out = rlversion < versionarg; ++ opresult = rlversion < versionarg; + break; + case OP_LE: +- _rl_parsing_conditionalized_out = rlversion <= versionarg; ++ opresult = rlversion <= versionarg; + break; + } ++ _rl_parsing_conditionalized_out = 1 - opresult; + } + /* Check to see if the first word in ARGS is the same as the + value stored in rl_readline_name. */ +diff --git a/patchlevel.h b/patchlevel.h +index 6257aeeb..c5ed66ab 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 6 ++#define PATCHLEVEL 7 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.29.2 + diff --git a/bash-5.1-patch-8.patch b/bash-5.1-patch-8.patch new file mode 100644 index 0000000..700652b --- /dev/null +++ b/bash-5.1-patch-8.patch @@ -0,0 +1,49 @@ +From ce23728687ce9e584333367075c9deef413553fa Mon Sep 17 00:00:00 2001 +From: Chet Ramey +Date: Tue, 4 May 2021 14:31:53 -0400 +Subject: [PATCH] Bash-5.1 patch 8: clean up FIFOs created by redirections in + child processes + +--- + execute_cmd.c | 8 +++++++- + patchlevel.h | 2 +- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/execute_cmd.c b/execute_cmd.c +index d2a0dd71..90129e06 100644 +--- a/execute_cmd.c ++++ b/execute_cmd.c +@@ -5556,11 +5556,17 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out, + #if defined (PROCESS_SUBSTITUTION) + /* Try to remove named pipes that may have been created as the + result of redirections. */ +- unlink_fifo_list (); ++ unlink_all_fifos (); + #endif /* PROCESS_SUBSTITUTION */ + exit (EXECUTION_FAILURE); + } + ++#if defined (PROCESS_SUBSTITUTION) && !defined (HAVE_DEV_FD) ++ /* This should only contain FIFOs created as part of redirection ++ expansion. */ ++ unlink_all_fifos (); ++#endif ++ + if (async) + interactive = old_interactive; + +diff --git a/patchlevel.h b/patchlevel.h +index c5ed66ab..10fde2ee 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 7 ++#define PATCHLEVEL 8 + + #endif /* _PATCHLEVEL_H_ */ +-- +2.29.2 + diff --git a/bash.spec b/bash.spec index 22bbfc9..8848b75 100644 --- a/bash.spec +++ b/bash.spec @@ -1,5 +1,5 @@ #% define beta_tag rc2 -%define patchleveltag .4 +%define patchleveltag .8 %define baseversion 5.1 %bcond_without tests @@ -20,7 +20,7 @@ Source3: dot-bash_logout # Official upstream patches # Patches are converted to apply with '-p1' -%{lua:for i=1,4 do print(string.format("Patch%u: bash-5.1-patch-%u.patch\n", i, i)) end} +%{lua:for i=1,8 do print(string.format("Patch%u: bash-5.1-patch-%u.patch\n", i, i)) end} # Other patches # We don't want to add '/etc:/usr/etc' in standard utils path. @@ -314,6 +314,9 @@ end %{_libdir}/pkgconfig/%{name}.pc %changelog +* Sat May 29 2021 Siteshwar Vashisht - 5.1.8-1 +- Update to bash-5.1 patchlevel 8 + * Wed Feb 17 2021 Siteshwar Vashisht - 5.1.4-1 - Update to bash-5.1 patchlevel 4