Update to bash-5.1 patchlevel 4

This commit is contained in:
Siteshwar Vashisht 2021-02-17 10:34:38 +01:00
parent 7ccb669ec2
commit 4945b8399d
5 changed files with 209 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

View File

@ -1,12 +1,12 @@
#% define beta_tag rc2
%define patchleveltag .0
%define patchleveltag .4
%define baseversion 5.1
%bcond_without tests
Version: %{baseversion}%{patchleveltag}
Name: bash
Summary: The GNU Bourne Again shell
Release: 2%{?dist}
Release: 1%{?dist}
License: GPLv3+
Url: https://www.gnu.org/software/bash
Source0: https://ftp.gnu.org/gnu/bash/bash-%{baseversion}.tar.gz
@ -20,6 +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}
# Other patches
# We don't want to add '/etc:/usr/etc' in standard utils path.
@ -313,6 +314,9 @@ end
%{_libdir}/pkgconfig/%{name}.pc
%changelog
* Wed Feb 17 2021 Siteshwar Vashisht <svashisht@redhat.com> - 5.1.4-1
- Update to bash-5.1 patchlevel 4
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.1.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild