Update to bash-5.1 patchlevel 8

Resolves: #1938684
This commit is contained in:
Siteshwar Vashisht 2021-07-23 12:36:23 +02:00
parent c5e54a162d
commit 66f2dd6994
9 changed files with 458 additions and 2 deletions

50
bash-5.1-patch-1.patch Normal file
View File

@ -0,0 +1,50 @@
diff --git a/Makefile.in b/Makefile.in
--- a/Makefile.in
+++ b/Makefile.in
@@ -1315,6 +1315,7 @@ bashline.o: trap.h flags.h assoc.h $(BASHINCDIR)/ocache.h
bashline.o: $(DEFSRC)/common.h $(GLOB_LIBSRC)/glob.h alias.h
bashline.o: pcomplete.h ${BASHINCDIR}/chartypes.h input.h
bashline.o: ${BASHINCDIR}/shmbutil.h ${BASHINCDIR}/shmbchar.h
+bashline.o: ${DEFDIR}/builtext.h
bracecomp.o: config.h bashansi.h ${BASHINCDIR}/ansi_stdlib.h
bracecomp.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h
bracecomp.o: command.h ${BASHINCDIR}/stdc.h error.h
@@ -1435,6 +1436,7 @@ builtins/evalstring.o: quit.h unwind_prot.h ${BASHINCDIR}/maxpath.h jobs.h built
builtins/evalstring.o: dispose_cmd.h make_cmd.h subst.h externs.h
builtins/evalstring.o: jobs.h builtins.h flags.h input.h execute_cmd.h
builtins/evalstring.o: bashhist.h $(DEFSRC)/common.h pathnames.h
+builtins/evalstring.o: ${DEFDIR}/builtext.h
builtins/getopt.o: config.h ${BASHINCDIR}/memalloc.h
builtins/getopt.o: shell.h syntax.h bashjmp.h command.h general.h xmalloc.h error.h
builtins/getopt.o: variables.h arrayfunc.h conftypes.h quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h
diff --git a/builtins/Makefile.in b/builtins/Makefile.in
--- a/builtins/Makefile.in
+++ b/builtins/Makefile.in
@@ -361,7 +361,7 @@ evalstring.o: $(topdir)/dispose_cmd.h $(topdir)/make_cmd.h $(topdir)/subst.h
evalstring.o: $(topdir)/externs.h $(topdir)/jobs.h $(topdir)/builtins.h
evalstring.o: $(topdir)/flags.h $(topdir)/input.h $(topdir)/execute_cmd.h
evalstring.o: $(topdir)/bashhist.h $(srcdir)/common.h
-evalstring.o: $(topdir)/trap.h $(topdir)/redir.h ../pathnames.h
+evalstring.o: $(topdir)/trap.h $(topdir)/redir.h ../pathnames.h ./builtext.h
#evalstring.o: $(topdir)/y.tab.h
getopt.o: ../config.h $(BASHINCDIR)/memalloc.h
getopt.o: $(topdir)/shell.h $(topdir)/syntax.h $(topdir)/bashjmp.h $(topdir)/command.h
diff --git a/patchlevel.h b/patchlevel.h
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -1,6 +1,6 @@
/* patchlevel.h -- current bash patch level */
-/* Copyright (C) 2001-2016 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -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 0
+#define PATCHLEVEL 1
#endif /* _PATCHLEVEL_H_ */

29
bash-5.1-patch-2.patch Normal file
View File

@ -0,0 +1,29 @@
diff --git a/builtins/wait.def b/builtins/wait.def
--- a/builtins/wait.def
+++ b/builtins/wait.def
@@ -213,11 +213,11 @@ wait_builtin (list)
}
status = wait_for_any_job (wflags, &pstat);
- if (status < 0)
- status = 127;
-
if (vname && status >= 0)
bind_var_to_int (vname, pstat.pid);
+
+ if (status < 0)
+ status = 127;
if (list)
unset_waitlist ();
WAIT_RETURN (status);
diff --git a/patchlevel.h b/patchlevel.h
--- 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 1
+#define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */

27
bash-5.1-patch-3.patch Normal file
View File

@ -0,0 +1,27 @@
diff --git a/patchlevel.h b/patchlevel.h
--- 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 2
+#define PATCHLEVEL 3
#endif /* _PATCHLEVEL_H_ */
diff --git a/subst.c b/subst.c
--- a/subst.c
+++ b/subst.c
@@ -6356,8 +6356,10 @@ command_substitute (string, quoted, flags)
#if defined (JOB_CONTROL)
old_pipeline_pgrp = pipeline_pgrp;
- /* Don't reset the pipeline pgrp if we're already a subshell in a pipeline. */
- if ((subshell_environment & SUBSHELL_PIPE) == 0)
+ /* Don't reset the pipeline pgrp if we're already a subshell in a pipeline or
+ we've already forked to run a disk command (and are expanding redirections,
+ for example). */
+ if ((subshell_environment & (SUBSHELL_FORK|SUBSHELL_PIPE)) == 0)
pipeline_pgrp = shell_pgrp;
cleanup_the_pipeline ();
#endif /* JOB_CONTROL */

97
bash-5.1-patch-4.patch Normal file
View File

@ -0,0 +1,97 @@
diff --git a/arrayfunc.c b/arrayfunc.c
--- a/arrayfunc.c
+++ b/arrayfunc.c
@@ -597,6 +597,27 @@ assign_assoc_from_kvlist (var, nlist, h, flags)
free (aval);
}
}
+
+/* Return non-zero if L appears to be a key-value pair associative array
+ compound assignment. */
+int
+kvpair_assignment_p (l)
+ WORD_LIST *l;
+{
+ return (l && (l->word->flags & W_ASSIGNMENT) == 0 && l->word->word[0] != '['); /*]*/
+}
+
+char *
+expand_and_quote_kvpair_word (w)
+ char *w;
+{
+ char *t, *r;
+
+ t = w ? expand_assignment_string_to_string (w, 0) : 0;
+ r = sh_single_quote (t ? t : "");
+ free (t);
+ return r;
+}
#endif
/* Callers ensure that VAR is not NULL. Associative array assignments have not
@@ -640,7 +661,7 @@ assign_compound_array_list (var, nlist, flags)
last_ind = (a && (flags & ASS_APPEND)) ? array_max_index (a) + 1 : 0;
#if ASSOC_KVPAIR_ASSIGNMENT
- if (assoc_p (var) && nlist && (nlist->word->flags & W_ASSIGNMENT) == 0 && nlist->word->word[0] != '[') /*]*/
+ if (assoc_p (var) && kvpair_assignment_p (nlist))
{
iflags = flags & ~ASS_APPEND;
assign_assoc_from_kvlist (var, nlist, nhash, iflags);
diff --git a/arrayfunc.h b/arrayfunc.h
--- a/arrayfunc.h
+++ b/arrayfunc.h
@@ -67,6 +67,9 @@ extern SHELL_VAR *assign_array_var_from_string PARAMS((SHELL_VAR *, char *, int)
extern char *expand_and_quote_assoc_word PARAMS((char *, int));
extern void quote_compound_array_list PARAMS((WORD_LIST *, int));
+extern int kvpair_assignment_p PARAMS((WORD_LIST *));
+extern char *expand_and_quote_kvpair_word PARAMS((char *));
+
extern int unbind_array_element PARAMS((SHELL_VAR *, char *, int));
extern int skipsubscript PARAMS((const char *, int, int));
diff --git a/patchlevel.h b/patchlevel.h
--- 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 3
+#define PATCHLEVEL 4
#endif /* _PATCHLEVEL_H_ */
diff --git a/subst.c b/subst.c
--- a/subst.c
+++ b/subst.c
@@ -11604,6 +11604,7 @@ expand_oneword (value, flags)
{
WORD_LIST *l, *nl;
char *t;
+ int kvpair;
if (flags == 0)
{
@@ -11618,11 +11619,21 @@ expand_oneword (value, flags)
{
/* Associative array */
l = parse_string_to_word_list (value, 1, "array assign");
+#if ASSOC_KVPAIR_ASSIGNMENT
+ kvpair = kvpair_assignment_p (l);
+#endif
+
/* For associative arrays, with their arbitrary subscripts, we have to
expand and quote in one step so we don't have to search for the
closing right bracket more than once. */
for (nl = l; nl; nl = nl->next)
{
+#if ASSOC_KVPAIR_ASSIGNMENT
+ if (kvpair)
+ /* keys and values undergo the same set of expansions */
+ t = expand_and_quote_kvpair_word (nl->word->word);
+ else
+#endif
if ((nl->word->flags & W_ASSIGNMENT) == 0)
t = sh_single_quote (nl->word->word ? nl->word->word : "");
else

85
bash-5.1-patch-5.patch Normal file
View File

@ -0,0 +1,85 @@
From cc978a670597afc3251baca3a7db553f36946c22 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
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

44
bash-5.1-patch-6.patch Normal file
View File

@ -0,0 +1,44 @@
From f3cd936b81006df41a1c8509891dea1edeaef8e6 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
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

71
bash-5.1-patch-7.patch Normal file
View File

@ -0,0 +1,71 @@
From b72f88db852104cf49cfb4762eda6e8f4fd20a70 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
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

49
bash-5.1-patch-8.patch Normal file
View File

@ -0,0 +1,49 @@
From ce23728687ce9e584333367075c9deef413553fa Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
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

View File

@ -1,12 +1,12 @@
#% define beta_tag rc2 #% define beta_tag rc2
%define patchleveltag .0 %define patchleveltag .8
%define baseversion 5.1 %define baseversion 5.1
%bcond_without tests %bcond_without tests
Version: %{baseversion}%{patchleveltag} Version: %{baseversion}%{patchleveltag}
Name: bash Name: bash
Summary: The GNU Bourne Again shell Summary: The GNU Bourne Again shell
Release: 3%{?dist} Release: 1%{?dist}
License: GPLv3+ License: GPLv3+
Url: https://www.gnu.org/software/bash Url: https://www.gnu.org/software/bash
Source0: https://ftp.gnu.org/gnu/bash/bash-%{baseversion}.tar.gz Source0: https://ftp.gnu.org/gnu/bash/bash-%{baseversion}.tar.gz
@ -20,6 +20,7 @@ Source3: dot-bash_logout
# Official upstream patches # Official upstream patches
# Patches are converted to apply with '-p1' # Patches are converted to apply with '-p1'
%{lua:for i=1,8 do print(string.format("Patch%u: bash-5.1-patch-%u.patch\n", i, i)) end}
# Other patches # Other patches
# We don't want to add '/etc:/usr/etc' in standard utils path. # We don't want to add '/etc:/usr/etc' in standard utils path.
@ -313,6 +314,9 @@ end
%{_libdir}/pkgconfig/%{name}.pc %{_libdir}/pkgconfig/%{name}.pc
%changelog %changelog
* Fri Jul 23 2021 Siteshwar Vashisht <svashisht@redhat.com> - 5.1.8-1
- Update to bash-5.1 patchlevel 8
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 5.1.0-3 * Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 5.1.0-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937