bash 5.1.p4

This commit is contained in:
Idris Kalp
2021-03-01 22:51:00 +03:00
parent 00b3f6fb22
commit 446d1ba43e
60 changed files with 329 additions and 2953 deletions
@@ -1,49 +0,0 @@
From 8ddc8d6e3a3d85eec6d4ba9b9ed2bc36bce56716 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 14 Nov 2016 14:26:51 -0500
Subject: [PATCH] Bash-4.4 patch 1
---
lib/readline/history.c | 6 +++++-
patchlevel.h | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/readline/history.c b/lib/readline/history.c
index 3b8dbc5..9ff25a7 100644
--- a/lib/readline/history.c
+++ b/lib/readline/history.c
@@ -57,6 +57,8 @@ extern int errno;
/* How big to make the_history when we first allocate it. */
#define DEFAULT_HISTORY_INITIAL_SIZE 502
+#define MAX_HISTORY_INITIAL_SIZE 8192
+
/* The number of slots to increase the_history by. */
#define DEFAULT_HISTORY_GROW_SIZE 50
@@ -307,7 +309,9 @@ add_history (string)
if (history_size == 0)
{
if (history_stifled && history_max_entries > 0)
- history_size = history_max_entries + 2;
+ history_size = (history_max_entries > MAX_HISTORY_INITIAL_SIZE)
+ ? MAX_HISTORY_INITIAL_SIZE
+ : history_max_entries + 2;
else
history_size = DEFAULT_HISTORY_INITIAL_SIZE;
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
diff --git a/patchlevel.h b/patchlevel.h
index 1cd7c96..40db1a3 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 0
+#define PATCHLEVEL 1
#endif /* _PATCHLEVEL_H_ */
--
2.9.3
@@ -1,39 +0,0 @@
From 5b9762d6f0cd36ff1b88bde22efa30ad0ed27ec6 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Fri, 20 Jan 2017 15:38:38 -0500
Subject: [PATCH] Bash-4.4 patch 10
---
builtins/read.def | 3 ++-
patchlevel.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/builtins/read.def b/builtins/read.def
index 48fda33..33821f3 100644
--- a/builtins/read.def
+++ b/builtins/read.def
@@ -181,7 +181,8 @@ read_builtin (list)
WORD_LIST *list;
{
register char *varname;
- int size, i, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2;
+ int size, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2;
+ volatile int i;
int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul;
int raw, edit, nchars, silent, have_timeout, ignore_delim, fd, lastsig, t_errno;
unsigned int tmsec, tmusec;
diff --git a/patchlevel.h b/patchlevel.h
index 02f1d60..8002af7 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 9
+#define PATCHLEVEL 10
#endif /* _PATCHLEVEL_H_ */
--
2.9.3
@@ -1,39 +0,0 @@
From 76bb456d8fcd870cd31b7bf9d90798cd97cee2ab Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Fri, 20 Jan 2017 15:38:49 -0500
Subject: [PATCH] Bash-4.4 patch 11
---
patchlevel.h | 2 +-
sig.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/patchlevel.h b/patchlevel.h
index 8002af7..772676c 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 10
+#define PATCHLEVEL 11
#endif /* _PATCHLEVEL_H_ */
diff --git a/sig.c b/sig.c
index ad01631..e5bb739 100644
--- a/sig.c
+++ b/sig.c
@@ -585,7 +585,8 @@ termsig_handler (sig)
#if defined (JOB_CONTROL)
if (sig == SIGHUP && (interactive || (subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB))))
hangup_all_jobs ();
- end_job_control ();
+ if ((subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB)) == 0)
+ end_job_control ();
#endif /* JOB_CONTROL */
#if defined (PROCESS_SUBSTITUTION)
--
2.9.3
@@ -1,119 +0,0 @@
From bc007799f0e1362100375bb95d952d28de4c62fb Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Fri, 27 Jan 2017 11:25:44 -0500
Subject: [PATCH] Bash-4.4 patch 12
---
patchlevel.h | 2 +-
subst.c | 32 ++++++++++++++++++++------------
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/patchlevel.h b/patchlevel.h
index 772676c..93dbe0d 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 11
+#define PATCHLEVEL 12
#endif /* _PATCHLEVEL_H_ */
diff --git a/subst.c b/subst.c
index 027a13e..dbf0157 100644
--- a/subst.c
+++ b/subst.c
@@ -2825,11 +2825,15 @@ list_string (string, separators, quoted)
/* Parse a single word from STRING, using SEPARATORS to separate fields.
ENDPTR is set to the first character after the word. This is used by
- the `read' builtin. This is never called with SEPARATORS != $IFS;
- it should be simplified.
+ the `read' builtin.
+
+ This is never called with SEPARATORS != $IFS, and takes advantage of that.
XXX - this function is very similar to list_string; they should be
combined - XXX */
+
+#define islocalsep(c) (local_cmap[(unsigned char)(c)] != 0)
+
char *
get_word_from_string (stringp, separators, endptr)
char **stringp, *separators, **endptr;
@@ -2837,6 +2841,7 @@ get_word_from_string (stringp, separators, endptr)
register char *s;
char *current_word;
int sindex, sh_style_split, whitesep, xflags;
+ unsigned char local_cmap[UCHAR_MAX+1]; /* really only need single-byte chars here */
size_t slen;
if (!stringp || !*stringp || !**stringp)
@@ -2846,20 +2851,23 @@ get_word_from_string (stringp, separators, endptr)
separators[1] == '\t' &&
separators[2] == '\n' &&
separators[3] == '\0';
- for (xflags = 0, s = ifs_value; s && *s; s++)
+ memset (local_cmap, '\0', sizeof (local_cmap));
+ for (xflags = 0, s = separators; s && *s; s++)
{
if (*s == CTLESC) xflags |= SX_NOCTLESC;
if (*s == CTLNUL) xflags |= SX_NOESCCTLNUL;
+ local_cmap[(unsigned char)*s] = 1; /* local charmap of separators */
}
s = *stringp;
slen = 0;
/* Remove sequences of whitespace at the beginning of STRING, as
- long as those characters appear in IFS. */
- if (sh_style_split || !separators || !*separators)
+ long as those characters appear in SEPARATORS. This happens if
+ SEPARATORS == $' \t\n' or if IFS is unset. */
+ if (sh_style_split || separators == 0)
{
- for (; *s && spctabnl (*s) && isifs (*s); s++);
+ for (; *s && spctabnl (*s) && islocalsep (*s); s++);
/* If the string is nothing but whitespace, update it and return. */
if (!*s)
@@ -2878,9 +2886,9 @@ get_word_from_string (stringp, separators, endptr)
This obeys the field splitting rules in Posix.2. */
sindex = 0;
- /* Don't need string length in ADVANCE_CHAR or string_extract_verbatim
- unless multibyte chars are possible. */
- slen = (MB_CUR_MAX > 1) ? STRLEN (s) : 1;
+ /* Don't need string length in ADVANCE_CHAR unless multibyte chars are
+ possible, but need it in string_extract_verbatim for bounds checking */
+ slen = STRLEN (s);
current_word = string_extract_verbatim (s, slen, &sindex, separators, xflags);
/* Set ENDPTR to the first character after the end of the word. */
@@ -2899,19 +2907,19 @@ get_word_from_string (stringp, separators, endptr)
/* Now skip sequences of space, tab, or newline characters if they are
in the list of separators. */
- while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex]))
+ while (s[sindex] && spctabnl (s[sindex]) && islocalsep (s[sindex]))
sindex++;
/* If the first separator was IFS whitespace and the current character is
a non-whitespace IFS character, it should be part of the current field
delimiter, not a separate delimiter that would result in an empty field.
Look at POSIX.2, 3.6.5, (3)(b). */
- if (s[sindex] && whitesep && isifs (s[sindex]) && !spctabnl (s[sindex]))
+ if (s[sindex] && whitesep && islocalsep (s[sindex]) && !spctabnl (s[sindex]))
{
sindex++;
/* An IFS character that is not IFS white space, along with any adjacent
IFS white space, shall delimit a field. */
- while (s[sindex] && spctabnl (s[sindex]) && isifs (s[sindex]))
+ while (s[sindex] && spctabnl (s[sindex]) && islocalsep(s[sindex]))
sindex++;
}
--
2.9.3
@@ -1,38 +0,0 @@
From 1aef9c7b55dcef4af239caf93e01419e1c8e04ad Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 29 Jan 2018 16:03:33 -0500
Subject: [PATCH] Bash-4.4 patch 13
---
patchlevel.h | 2 +-
redir.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/patchlevel.h b/patchlevel.h
index 93dbe0db..779671cd 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 12
+#define PATCHLEVEL 13
#endif /* _PATCHLEVEL_H_ */
diff --git a/redir.c b/redir.c
index 25488eaf..1858b0b0 100644
--- a/redir.c
+++ b/redir.c
@@ -469,6 +469,8 @@ here_document_to_fd (redirectee, ri)
return (fd);
}
+ SET_CLOSE_ON_EXEC (fd);
+
errno = r = 0; /* XXX */
/* write_here_document returns 0 on success, errno on failure. */
if (redirectee->word)
--
2.13.6
@@ -1,85 +0,0 @@
From 2fb21d75bfddd724b0e45d4a51455a166467e496 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 29 Jan 2018 16:03:47 -0500
Subject: [PATCH] Bash-4.4 patch 14
---
execute_cmd.c | 19 ++++++++++++++++---
patchlevel.h | 2 +-
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/execute_cmd.c b/execute_cmd.c
index 2a3df6d6..76a80766 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -726,6 +726,8 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
{
ofifo = num_fifos ();
ofifo_list = copy_fifo_list ((int *)&osize);
+ begin_unwind_frame ("internal_fifos");
+ add_unwind_protect (xfree, ofifo_list);
saved_fifo = 1;
}
else
@@ -741,7 +743,10 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
dispose_exec_redirects ();
#if defined (PROCESS_SUBSTITUTION)
if (saved_fifo)
- free ((void *)ofifo_list);
+ {
+ free ((void *)ofifo_list);
+ discard_unwind_frame ("internal_fifos");
+ }
#endif
return (last_command_exit_value = EXECUTION_FAILURE);
}
@@ -1060,6 +1065,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
if (nfifo > ofifo)
close_new_fifos ((char *)ofifo_list, osize);
free ((void *)ofifo_list);
+ discard_unwind_frame ("internal_fifos");
}
#endif
@@ -4977,9 +4983,14 @@ execute_builtin_or_function (words, builtin, var, redirects,
char *ofifo_list;
#endif
-#if defined (PROCESS_SUBSTITUTION)
+#if defined (PROCESS_SUBSTITUTION)
+ begin_unwind_frame ("saved_fifos");
+ /* If we return, we longjmp and don't get a chance to restore the old
+ fifo list, so we add an unwind protect to free it */
ofifo = num_fifos ();
ofifo_list = copy_fifo_list (&osize);
+ if (ofifo_list)
+ add_unwind_protect (xfree, ofifo_list);
#endif
if (do_redirections (redirects, RX_ACTIVE|RX_UNDOABLE) != 0)
@@ -5063,7 +5074,9 @@ execute_builtin_or_function (words, builtin, var, redirects,
nfifo = num_fifos ();
if (nfifo > ofifo)
close_new_fifos (ofifo_list, osize);
- free (ofifo_list);
+ if (ofifo_list)
+ free (ofifo_list);
+ discard_unwind_frame ("saved_fifos");
#endif
return (result);
diff --git a/patchlevel.h b/patchlevel.h
index 779671cd..09a3cc84 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 13
+#define PATCHLEVEL 14
#endif /* _PATCHLEVEL_H_ */
--
2.13.6
@@ -1,38 +0,0 @@
From 9cce630e80008e74fa9a1d9408367341caf363f2 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 29 Jan 2018 16:04:01 -0500
Subject: [PATCH] Bash-4.4 patch 15
---
patchlevel.h | 2 +-
subst.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/patchlevel.h b/patchlevel.h
index 09a3cc84..6e9ed3fc 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 14
+#define PATCHLEVEL 15
#endif /* _PATCHLEVEL_H_ */
diff --git a/subst.c b/subst.c
index dbf0157e..fc00cab0 100644
--- a/subst.c
+++ b/subst.c
@@ -5906,6 +5906,8 @@ process_substitute (string, open_for_read_in_child)
parent. */
expanding_redir = 0;
+ remove_quoted_escapes (string);
+
subshell_level++;
result = parse_and_execute (string, "process substitution", (SEVAL_NONINT|SEVAL_NOHIST));
subshell_level--;
--
2.13.6
@@ -1,68 +0,0 @@
From c9f1b04651dae16e33f0aa8974c5122e26b362ae Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 29 Jan 2018 16:04:20 -0500
Subject: [PATCH] Bash-4.4 patch 16
---
lib/sh/zread.c | 23 +++++++++--------------
patchlevel.h | 2 +-
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/lib/sh/zread.c b/lib/sh/zread.c
index 868f9705..496f20b8 100644
--- a/lib/sh/zread.c
+++ b/lib/sh/zread.c
@@ -37,7 +37,10 @@ extern int errno;
# define SEEK_CUR 1
#endif
+extern int executing_builtin;
+
extern void check_signals_and_traps (void);
+extern void check_signals (void);
extern int signal_is_trapped (int);
/* Read LEN bytes from FD into BUF. Retry the read on EINTR. Any other
@@ -50,21 +53,13 @@ zread (fd, buf, len)
{
ssize_t r;
-#if 0
-#if defined (HAVE_SIGINTERRUPT)
- if (signal_is_trapped (SIGCHLD))
- siginterrupt (SIGCHLD, 1);
-#endif
-#endif
-
while ((r = read (fd, buf, len)) < 0 && errno == EINTR)
- check_signals_and_traps (); /* XXX - should it be check_signals()? */
-
-#if 0
-#if defined (HAVE_SIGINTERRUPT)
- siginterrupt (SIGCHLD, 0);
-#endif
-#endif
+ /* XXX - bash-5.0 */
+ /* We check executing_builtin and run traps here for backwards compatibility */
+ if (executing_builtin)
+ check_signals_and_traps (); /* XXX - should it be check_signals()? */
+ else
+ check_signals ();
return r;
}
diff --git a/patchlevel.h b/patchlevel.h
index 6e9ed3fc..9074f4dd 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 15
+#define PATCHLEVEL 16
#endif /* _PATCHLEVEL_H_ */
--
2.13.6
@@ -1,41 +0,0 @@
From b3a5ec8dd510a68dc850f3f516c0cf9afd87451f Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 29 Jan 2018 16:04:37 -0500
Subject: [PATCH] Bash-4.4 patch 17
---
builtins/read.def | 5 +++++
patchlevel.h | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/builtins/read.def b/builtins/read.def
index 33821f3f..803bea35 100644
--- a/builtins/read.def
+++ b/builtins/read.def
@@ -690,6 +690,11 @@ add_char:
input_string[i] = '\0';
CHECK_ALRM;
+#if defined (READLINE)
+ if (edit)
+ free (rlbuf);
+#endif
+
if (retval < 0)
{
t_errno = errno;
diff --git a/patchlevel.h b/patchlevel.h
index 9074f4dd..98e714da 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 16
+#define PATCHLEVEL 17
#endif /* _PATCHLEVEL_H_ */
--
2.13.6
@@ -1,38 +0,0 @@
From eb78197af36bb0fb95493ebf8fce104be6832ec9 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 29 Jan 2018 16:04:56 -0500
Subject: [PATCH] Bash-4.4 patch 18
---
builtins/read.def | 2 +-
patchlevel.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtins/read.def b/builtins/read.def
index 803bea35..b54b3af6 100644
--- a/builtins/read.def
+++ b/builtins/read.def
@@ -610,7 +610,7 @@ read_builtin (list)
}
CHECK_ALRM;
-
+ QUIT; /* in case we didn't call check_signals() */
#if defined (READLINE)
}
#endif
diff --git a/patchlevel.h b/patchlevel.h
index 98e714da..f0ee56e4 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 17
+#define PATCHLEVEL 18
#endif /* _PATCHLEVEL_H_ */
--
2.13.6
@@ -1,40 +0,0 @@
From b0776d8c49ab4310fa056ce1033985996c5b9807 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Tue, 6 Feb 2018 16:22:34 -0500
Subject: [PATCH] Bash-4.4 patch 19
---
lib/readline/display.c | 4 +++-
patchlevel.h | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/readline/display.c b/lib/readline/display.c
index 41fb0531..2d2e768a 100644
--- a/lib/readline/display.c
+++ b/lib/readline/display.c
@@ -771,7 +771,9 @@ rl_redisplay ()
appear in the first and last lines of the prompt */
wadjust = (newlines == 0)
? prompt_invis_chars_first_line
- : ((newlines == prompt_lines_estimate) ? wrap_offset : prompt_invis_chars_first_line);
+ : ((newlines == prompt_lines_estimate)
+ ? (wrap_offset - prompt_invis_chars_first_line)
+ : 0);
/* fix from Darin Johnson <darin@acuson.com> for prompt string with
invisible characters that is longer than the screen width. The
diff --git a/patchlevel.h b/patchlevel.h
index f0ee56e4..a711c495 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 18
+#define PATCHLEVEL 19
#endif /* _PATCHLEVEL_H_ */
--
2.13.6
@@ -1,59 +0,0 @@
From 280bd77d8d3e7f7c90c9fa07de3d1e8f8e18ac29 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 14 Nov 2016 14:27:06 -0500
Subject: [PATCH] Bash-4.4 patch 2
---
patchlevel.h | 2 +-
subst.c | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/patchlevel.h b/patchlevel.h
index 40db1a3..a988d85 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 1
+#define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */
diff --git a/subst.c b/subst.c
index f1a4df1..4d498ef 100644
--- a/subst.c
+++ b/subst.c
@@ -5931,6 +5931,7 @@ read_comsub (fd, quoted, rflag)
char *istring, buf[128], *bufp, *s;
int istring_index, istring_size, c, tflag, skip_ctlesc, skip_ctlnul;
ssize_t bufn;
+ int nullbyte;
istring = (char *)NULL;
istring_index = istring_size = bufn = tflag = 0;
@@ -5938,6 +5939,8 @@ read_comsub (fd, quoted, rflag)
for (skip_ctlesc = skip_ctlnul = 0, s = ifs_value; s && *s; s++)
skip_ctlesc |= *s == CTLESC, skip_ctlnul |= *s == CTLNUL;
+ nullbyte = 0;
+
/* Read the output of the command through the pipe. This may need to be
changed to understand multibyte characters in the future. */
while (1)
@@ -5956,7 +5959,11 @@ read_comsub (fd, quoted, rflag)
if (c == 0)
{
#if 1
- internal_warning ("%s", _("command substitution: ignored null byte in input"));
+ if (nullbyte == 0)
+ {
+ internal_warning ("%s", _("command substitution: ignored null byte in input"));
+ nullbyte = 1;
+ }
#endif
continue;
}
--
2.9.3
@@ -1,52 +0,0 @@
From 4f59a8babc53a9f975078c4a003bdc8831c5ee22 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 14 Nov 2016 14:27:23 -0500
Subject: [PATCH] Bash-4.4 patch 3
---
lib/glob/sm_loop.c | 9 +++++++++
patchlevel.h | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/glob/sm_loop.c b/lib/glob/sm_loop.c
index c3a2aa3..65179e2 100644
--- a/lib/glob/sm_loop.c
+++ b/lib/glob/sm_loop.c
@@ -330,6 +330,12 @@ PARSE_COLLSYM (p, vp)
for (pc = 0; p[pc]; pc++)
if (p[pc] == L('.') && p[pc+1] == L(']'))
break;
+ if (p[pc] == 0)
+ {
+ if (vp)
+ *vp = INVALID;
+ return (p + pc);
+ }
val = COLLSYM (p, pc);
if (vp)
*vp = val;
@@ -483,6 +489,9 @@ BRACKMATCH (p, test, flags)
c = *p++;
c = FOLD (c);
+ if (c == L('\0'))
+ return ((test == L('[')) ? savep : (CHAR *)0);
+
if ((flags & FNM_PATHNAME) && c == L('/'))
/* [/] can never match when matching a pathname. */
return (CHAR *)0;
diff --git a/patchlevel.h b/patchlevel.h
index a988d85..e7e960c 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 2
+#define PATCHLEVEL 3
#endif /* _PATCHLEVEL_H_ */
--
2.9.3
@@ -1,81 +0,0 @@
From 2965eca924466a48c5597ac5c6c86d470e718908 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 14 Nov 2016 14:27:35 -0500
Subject: [PATCH] Bash-4.4 patch 4
---
jobs.c | 15 +++++++++++++++
jobs.h | 1 +
patchlevel.h | 2 +-
subst.c | 5 +----
4 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/jobs.c b/jobs.c
index cef3c79..fc96603 100644
--- a/jobs.c
+++ b/jobs.c
@@ -453,6 +453,21 @@ cleanup_the_pipeline ()
discard_pipeline (disposer);
}
+void
+discard_last_procsub_child ()
+{
+ PROCESS *disposer;
+ sigset_t set, oset;
+
+ BLOCK_CHILD (set, oset);
+ disposer = last_procsub_child;
+ last_procsub_child = (PROCESS *)NULL;
+ UNBLOCK_CHILD (oset);
+
+ if (disposer)
+ discard_pipeline (disposer);
+}
+
struct pipeline_saver *
alloc_pipeline_saver ()
{
diff --git a/jobs.h b/jobs.h
index 4ba3513..6df0607 100644
--- a/jobs.h
+++ b/jobs.h
@@ -190,6 +190,7 @@ extern JOB **jobs;
extern void making_children __P((void));
extern void stop_making_children __P((void));
extern void cleanup_the_pipeline __P((void));
+extern void discard_last_procsub_child __P((void));
extern void save_pipeline __P((int));
extern PROCESS *restore_pipeline __P((int));
extern void start_pipeline __P((void));
diff --git a/patchlevel.h b/patchlevel.h
index e7e960c..c059f0b 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 3
+#define PATCHLEVEL 4
#endif /* _PATCHLEVEL_H_ */
diff --git a/subst.c b/subst.c
index 4d498ef..298187d 100644
--- a/subst.c
+++ b/subst.c
@@ -5808,10 +5808,7 @@ process_substitute (string, open_for_read_in_child)
{
#if defined (JOB_CONTROL)
if (last_procsub_child)
- {
- discard_pipeline (last_procsub_child);
- last_procsub_child = (PROCESS *)NULL;
- }
+ discard_last_procsub_child ();
last_procsub_child = restore_pipeline (0);
#endif
--
2.9.3
@@ -1,42 +0,0 @@
From f459cbd8be37b28be1dc90315e0ab51d7f211301 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 14 Nov 2016 14:27:55 -0500
Subject: [PATCH] Bash-4.4 patch 5
---
builtins/evalstring.c | 3 ---
patchlevel.h | 2 +-
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/builtins/evalstring.c b/builtins/evalstring.c
index e221591..6dc756c 100644
--- a/builtins/evalstring.c
+++ b/builtins/evalstring.c
@@ -104,12 +104,9 @@ should_suppress_fork (command)
running_trap == 0 &&
*bash_input.location.string == '\0' &&
command->type == cm_simple &&
-#if 0
signal_is_trapped (EXIT_TRAP) == 0 &&
signal_is_trapped (ERROR_TRAP) == 0 &&
-#else
any_signals_trapped () < 0 &&
-#endif
command->redirects == 0 && command->value.Simple->redirects == 0 &&
((command->flags & CMD_TIME_PIPELINE) == 0) &&
((command->flags & CMD_INVERT_RETURN) == 0));
diff --git a/patchlevel.h b/patchlevel.h
index c059f0b..1bc098b 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_ */
--
2.9.3
@@ -1,50 +0,0 @@
From 44bfefc553993613c0aff992bc4f3078d738ee1d Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Fri, 20 Jan 2017 11:47:31 -0500
Subject: [PATCH] Bash-4.4 patch 6
---
builtins/pushd.def | 7 ++++++-
patchlevel.h | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/builtins/pushd.def b/builtins/pushd.def
index 82653c4..6579e4c 100644
--- a/builtins/pushd.def
+++ b/builtins/pushd.def
@@ -365,7 +365,7 @@ popd_builtin (list)
break;
}
- if (which > directory_list_offset || (directory_list_offset == 0 && which == 0))
+ if (which > directory_list_offset || (which < -directory_list_offset) || (directory_list_offset == 0 && which == 0))
{
pushd_error (directory_list_offset, which_word ? which_word : "");
return (EXECUTION_FAILURE);
@@ -387,6 +387,11 @@ popd_builtin (list)
remove that directory from the list and shift the remainder
of the list into place. */
i = (direction == '+') ? directory_list_offset - which : which;
+ if (i < 0 || i > directory_list_offset)
+ {
+ pushd_error (directory_list_offset, which_word ? which_word : "");
+ return (EXECUTION_FAILURE);
+ }
free (pushd_directory_list[i]);
directory_list_offset--;
diff --git a/patchlevel.h b/patchlevel.h
index 1bc098b..14bff9f 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_ */
--
2.9.3
@@ -1,114 +0,0 @@
From 4f747edc625815f449048579f6e65869914dd715 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Fri, 20 Jan 2017 11:47:55 -0500
Subject: [PATCH] Bash-4.4 patch 7
---
bashline.c | 22 ++++++++++++----------
patchlevel.h | 2 +-
subst.c | 4 ++++
3 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/bashline.c b/bashline.c
index f4fe9f1..0275844 100644
--- a/bashline.c
+++ b/bashline.c
@@ -142,7 +142,7 @@ static int executable_completion __P((const char *, int));
static rl_icppfunc_t *save_directory_hook __P((void));
static void restore_directory_hook __P((rl_icppfunc_t));
-static int directory_exists __P((const char *));
+static int directory_exists __P((const char *, int));
static void cleanup_expansion_error __P((void));
static void maybe_make_readline_line __P((char *));
@@ -3102,18 +3102,20 @@ restore_directory_hook (hookf)
rl_directory_rewrite_hook = hookf;
}
-/* Check whether not the (dequoted) version of DIRNAME, with any trailing slash
- removed, exists. */
+/* Check whether not DIRNAME, with any trailing slash removed, exists. If
+ SHOULD_DEQUOTE is non-zero, we dequote the directory name first. */
static int
-directory_exists (dirname)
+directory_exists (dirname, should_dequote)
const char *dirname;
+ int should_dequote;
{
char *new_dirname;
int dirlen, r;
struct stat sb;
- /* First, dequote the directory name */
- new_dirname = bash_dequote_filename ((char *)dirname, rl_completion_quote_character);
+ /* We save the string and chop the trailing slash because stat/lstat behave
+ inconsistently if one is present. */
+ new_dirname = should_dequote ? bash_dequote_filename ((char *)dirname, rl_completion_quote_character) : savestring (dirname);
dirlen = STRLEN (new_dirname);
if (new_dirname[dirlen - 1] == '/')
new_dirname[dirlen - 1] = '\0';
@@ -3145,7 +3147,7 @@ bash_filename_stat_hook (dirname)
else if (t = mbschr (local_dirname, '`')) /* XXX */
should_expand_dirname = '`';
- if (should_expand_dirname && directory_exists (local_dirname))
+ if (should_expand_dirname && directory_exists (local_dirname, 0))
should_expand_dirname = 0;
if (should_expand_dirname)
@@ -3155,7 +3157,7 @@ bash_filename_stat_hook (dirname)
have to worry about restoring this setting. */
global_nounset = unbound_vars_is_error;
unbound_vars_is_error = 0;
- wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE); /* does the right thing */
+ wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE); /* does the right thing */
unbound_vars_is_error = global_nounset;
if (wl)
{
@@ -3244,13 +3246,13 @@ bash_directory_completion_hook (dirname)
should_expand_dirname = '`';
}
- if (should_expand_dirname && directory_exists (local_dirname))
+ if (should_expand_dirname && directory_exists (local_dirname, 1))
should_expand_dirname = 0;
if (should_expand_dirname)
{
new_dirname = savestring (local_dirname);
- wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_COMPLETE); /* does the right thing */
+ wl = expand_prompt_string (new_dirname, 0, W_NOCOMSUB|W_NOPROCSUB|W_COMPLETE); /* does the right thing */
if (wl)
{
*dirname = string_list (wl);
diff --git a/patchlevel.h b/patchlevel.h
index 14bff9f..deb9c5b 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_ */
diff --git a/subst.c b/subst.c
index 298187d..027a13e 100644
--- a/subst.c
+++ b/subst.c
@@ -9458,6 +9458,10 @@ add_twochars:
tword->flags |= word->flags & (W_ASSIGNARG|W_ASSIGNRHS); /* affects $@ */
if (word->flags & W_COMPLETE)
tword->flags |= W_COMPLETE; /* for command substitutions */
+ if (word->flags & W_NOCOMSUB)
+ tword->flags |= W_NOCOMSUB;
+ if (word->flags & W_NOPROCSUB)
+ tword->flags |= W_NOPROCSUB;
temp = (char *)NULL;
--
2.9.3
@@ -1,71 +0,0 @@
From b9f81c2977b82490cd4dc70b0bb292bfbf86bd2c Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Fri, 20 Jan 2017 15:38:10 -0500
Subject: [PATCH] Bash-4.4 patch 8
---
expr.c | 15 +++++++++------
patchlevel.h | 2 +-
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/expr.c b/expr.c
index 1ddb693..172964a 100644
--- a/expr.c
+++ b/expr.c
@@ -578,24 +578,23 @@ expcond ()
rval = cval = explor ();
if (curtok == QUES) /* found conditional expr */
{
- readtok ();
- if (curtok == 0 || curtok == COL)
- evalerror (_("expression expected"));
if (cval == 0)
{
set_noeval = 1;
noeval++;
}
+ readtok ();
+ if (curtok == 0 || curtok == COL)
+ evalerror (_("expression expected"));
+
val1 = EXP_HIGHEST ();
if (set_noeval)
noeval--;
if (curtok != COL)
evalerror (_("`:' expected for conditional expression"));
- readtok ();
- if (curtok == 0)
- evalerror (_("expression expected"));
+
set_noeval = 0;
if (cval)
{
@@ -603,7 +602,11 @@ expcond ()
noeval++;
}
+ readtok ();
+ if (curtok == 0)
+ evalerror (_("expression expected"));
val2 = expcond ();
+
if (set_noeval)
noeval--;
rval = cval ? val1 : val2;
diff --git a/patchlevel.h b/patchlevel.h
index deb9c5b..16c8740 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.9.3
@@ -1,80 +0,0 @@
From e59fb114e9c0436890d110cfdda4d794a63496e7 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Fri, 20 Jan 2017 15:38:29 -0500
Subject: [PATCH] Bash-4.4 patch 9
---
lib/readline/history.c | 16 +++++++---------
patchlevel.h | 2 +-
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/lib/readline/history.c b/lib/readline/history.c
index 9ff25a7..129c57a 100644
--- a/lib/readline/history.c
+++ b/lib/readline/history.c
@@ -279,6 +279,7 @@ add_history (string)
const char *string;
{
HIST_ENTRY *temp;
+ int new_length;
if (history_stifled && (history_length == history_max_entries))
{
@@ -295,13 +296,9 @@ add_history (string)
/* Copy the rest of the entries, moving down one slot. Copy includes
trailing NULL. */
-#if 0
- for (i = 0; i < history_length; i++)
- the_history[i] = the_history[i + 1];
-#else
memmove (the_history, the_history + 1, history_length * sizeof (HIST_ENTRY *));
-#endif
+ new_length = history_length;
history_base++;
}
else
@@ -315,7 +312,7 @@ add_history (string)
else
history_size = DEFAULT_HISTORY_INITIAL_SIZE;
the_history = (HIST_ENTRY **)xmalloc (history_size * sizeof (HIST_ENTRY *));
- history_length = 1;
+ new_length = 1;
}
else
{
@@ -325,14 +322,15 @@ add_history (string)
the_history = (HIST_ENTRY **)
xrealloc (the_history, history_size * sizeof (HIST_ENTRY *));
}
- history_length++;
+ new_length = history_length + 1;
}
}
temp = alloc_history_entry ((char *)string, hist_inittime ());
- the_history[history_length] = (HIST_ENTRY *)NULL;
- the_history[history_length - 1] = temp;
+ the_history[new_length] = (HIST_ENTRY *)NULL;
+ the_history[new_length - 1] = temp;
+ history_length = new_length;
}
/* Change the time stamp of the most recent history entry to STRING. */
diff --git a/patchlevel.h b/patchlevel.h
index 16c8740..02f1d60 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.9.3
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,166 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-001
Bug-Reported-by: axel@freakout.de
Bug-Reference-ID: <201901082050.x08KoShS006731@bongo.freakout.de>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-01/msg00079.html
Bug-Description:
Under certain circumstances, the glob expansion code did not remove
backslashes escaping characters in directory names (or portions of a
pattern preceding a slash).
Patch (apply with `patch -p0'):
*** ../bash-5.0/bashline.c 2018-11-27 13:20:16.000000000 -0500
--- bashline.c 2019-01-16 16:06:03.000000000 -0500
***************
*** 232,235 ****
--- 232,236 ----
static int bash_possible_command_completions __P((int, int));
+ static int completion_glob_pattern __P((char *));
static char *glob_complete_word __P((const char *, int));
static int bash_glob_completion_internal __P((int));
***************
*** 1742,1746 ****
/* This could be a globbing pattern, so try to expand it using pathname
expansion. */
! if (!matches && glob_pattern_p (text))
{
matches = rl_completion_matches (text, glob_complete_word);
--- 1743,1747 ----
/* This could be a globbing pattern, so try to expand it using pathname
expansion. */
! if (!matches && completion_glob_pattern ((char *)text))
{
matches = rl_completion_matches (text, glob_complete_word);
***************
*** 1851,1855 ****
}
! globpat = glob_pattern_p (hint_text);
/* If this is an absolute program name, do not check it against
--- 1852,1856 ----
}
! globpat = completion_glob_pattern ((char *)hint_text);
/* If this is an absolute program name, do not check it against
***************
*** 3714,3717 ****
--- 3715,3773 ----
}
+ static int
+ completion_glob_pattern (string)
+ char *string;
+ {
+ register int c;
+ char *send;
+ int open;
+
+ DECLARE_MBSTATE;
+
+ open = 0;
+ send = string + strlen (string);
+
+ while (c = *string++)
+ {
+ switch (c)
+ {
+ case '?':
+ case '*':
+ return (1);
+
+ case '[':
+ open++;
+ continue;
+
+ case ']':
+ if (open)
+ return (1);
+ continue;
+
+ case '+':
+ case '@':
+ case '!':
+ if (*string == '(') /*)*/
+ return (1);
+ continue;
+
+ case '\\':
+ if (*string == 0)
+ return (0);
+ }
+
+ /* Advance one fewer byte than an entire multibyte character to
+ account for the auto-increment in the loop above. */
+ #ifdef HANDLE_MULTIBYTE
+ string--;
+ ADVANCE_CHAR_P (string, send - string);
+ string++;
+ #else
+ ADVANCE_CHAR_P (string, send - string);
+ #endif
+ }
+ return (0);
+ }
+
static char *globtext;
static char *globorig;
***************
*** 3878,3882 ****
}
! if (t && glob_pattern_p (t) == 0)
rl_explicit_arg = 1; /* XXX - force glob_complete_word to append `*' */
FREE (t);
--- 3934,3938 ----
}
! if (t && completion_glob_pattern (t) == 0)
rl_explicit_arg = 1; /* XXX - force glob_complete_word to append `*' */
FREE (t);
*** ../bash-5.0/lib/glob/glob_loop.c 2018-12-31 13:35:15.000000000 -0500
--- lib/glob/glob_loop.c 2019-01-09 09:44:36.000000000 -0500
***************
*** 55,59 ****
case L('\\'):
- #if 0
/* Don't let the pattern end in a backslash (GMATCH returns no match
if the pattern ends in a backslash anyway), but otherwise return 1,
--- 55,58 ----
***************
*** 61,69 ****
and it can be removed. */
return (*p != L('\0'));
- #else
- /* The pattern may not end with a backslash. */
- if (*p++ == L('\0'))
- return 0;
- #endif
}
--- 60,63 ----
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 0
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 1
#endif /* _PATCHLEVEL_H_ */
@@ -1,113 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-002
Bug-Reported-by: Ante Peric <synthmeat@gmail.com>
Bug-Reference-ID: <B7E3B567-2467-4F7B-B6B9-CA4E75A9C93F@gmail.com>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-01/msg00095.html
Bug-Description:
When an alias value ends with an unquoted literal tab (not part of a quoted
string or comment), alias expansion cannot correctly detect the end of the
alias value after expanding it.
Patch (apply with `patch -p0'):
*** ../bash-5.0/parser.h 2018-12-28 19:11:18.000000000 -0500
--- parser.h 2019-01-11 15:13:03.000000000 -0500
***************
*** 48,51 ****
--- 48,52 ----
#define PST_REDIRLIST 0x080000 /* parsing a list of redirections preceding a simple command name */
#define PST_COMMENT 0x100000 /* parsing a shell comment; used by aliases */
+ #define PST_ENDALIAS 0x200000 /* just finished expanding and consuming an alias */
/* Definition of the delimiter stack. Needed by parse.y and bashhist.c. */
*** ../bash-5.0/parse.y 2019-01-02 13:57:34.000000000 -0500
--- parse.y 2019-01-14 08:23:31.000000000 -0500
***************
*** 2558,2567 ****
pushed_string_list->flags != PSH_DPAREN &&
(parser_state & PST_COMMENT) == 0 &&
shell_input_line_index > 0 &&
! shell_input_line[shell_input_line_index-1] != ' ' &&
shell_input_line[shell_input_line_index-1] != '\n' &&
shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
(current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
{
return ' '; /* END_ALIAS */
}
--- 2558,2569 ----
pushed_string_list->flags != PSH_DPAREN &&
(parser_state & PST_COMMENT) == 0 &&
+ (parser_state & PST_ENDALIAS) == 0 && /* only once */
shell_input_line_index > 0 &&
! shellblank (shell_input_line[shell_input_line_index-1]) == 0 &&
shell_input_line[shell_input_line_index-1] != '\n' &&
shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
(current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
{
+ parser_state |= PST_ENDALIAS;
return ' '; /* END_ALIAS */
}
***************
*** 2572,2575 ****
--- 2574,2578 ----
if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
{
+ parser_state &= ~PST_ENDALIAS;
pop_string ();
uc = shell_input_line[shell_input_line_index];
*** ../bash-5.0/y.tab.c 2019-01-02 13:57:43.000000000 -0500
--- y.tab.c 2019-01-14 08:39:23.000000000 -0500
***************
*** 4874,4883 ****
pushed_string_list->flags != PSH_DPAREN &&
(parser_state & PST_COMMENT) == 0 &&
shell_input_line_index > 0 &&
! shell_input_line[shell_input_line_index-1] != ' ' &&
shell_input_line[shell_input_line_index-1] != '\n' &&
shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
(current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
{
return ' '; /* END_ALIAS */
}
--- 4874,4885 ----
pushed_string_list->flags != PSH_DPAREN &&
(parser_state & PST_COMMENT) == 0 &&
+ (parser_state & PST_ENDALIAS) == 0 && /* only once */
shell_input_line_index > 0 &&
! shellblank (shell_input_line[shell_input_line_index-1]) == 0 &&
shell_input_line[shell_input_line_index-1] != '\n' &&
shellmeta (shell_input_line[shell_input_line_index-1]) == 0 &&
(current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"'))
{
+ parser_state |= PST_ENDALIAS;
return ' '; /* END_ALIAS */
}
***************
*** 4888,4891 ****
--- 4890,4894 ----
if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
{
+ parser_state &= ~PST_ENDALIAS;
pop_string ();
uc = shell_input_line[shell_input_line_index];
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 1
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */
@@ -1,239 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-003
Bug-Reported-by: Andrew Church <achurch+bash@achurch.org>
Bug-Reference-ID: <5c534aa2.04371@msgid.achurch.org>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-01/msg00276.html
Bug-Description:
There are several incompatibilities in how bash-5.0 processes pathname
expansion (globbing) of filename arguments that have backslashes in the
directory portion.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/lib/glob/glob_loop.c 2019-01-16 16:13:21.000000000 -0500
--- lib/glob/glob_loop.c 2019-02-01 09:45:11.000000000 -0500
***************
*** 27,34 ****
register const GCHAR *p;
register GCHAR c;
! int bopen;
p = pattern;
! bopen = 0;
while ((c = *p++) != L('\0'))
--- 27,34 ----
register const GCHAR *p;
register GCHAR c;
! int bopen, bsquote;
p = pattern;
! bopen = bsquote = 0;
while ((c = *p++) != L('\0'))
***************
*** 56,66 ****
case L('\\'):
/* Don't let the pattern end in a backslash (GMATCH returns no match
! if the pattern ends in a backslash anyway), but otherwise return 1,
! since the matching engine uses backslash as an escape character
! and it can be removed. */
! return (*p != L('\0'));
}
! return 0;
}
--- 56,75 ----
case L('\\'):
/* Don't let the pattern end in a backslash (GMATCH returns no match
! if the pattern ends in a backslash anyway), but otherwise note that
! we have seen this, since the matching engine uses backslash as an
! escape character and it can be removed. We return 2 later if we
! have seen only backslash-escaped characters, so interested callers
! know they can shortcut and just dequote the pathname. */
! if (*p != L('\0'))
! {
! p++;
! bsquote = 1;
! continue;
! }
! else /* (*p == L('\0')) */
! return 0;
}
! return bsquote ? 2 : 0;
}
*** ../bash-5.0-patched/lib/glob/glob.h 2013-10-28 14:46:12.000000000 -0400
--- lib/glob/glob.h 2019-03-07 11:06:47.000000000 -0500
***************
*** 31,34 ****
--- 31,35 ----
#define GX_ADDCURDIR 0x200 /* internal -- add passed directory name */
#define GX_GLOBSTAR 0x400 /* turn on special handling of ** */
+ #define GX_RECURSE 0x800 /* internal -- glob_filename called recursively */
extern int glob_pattern_p __P((const char *));
*** ../bash-5.0-patched/lib/glob/glob.c 2018-09-20 10:53:23.000000000 -0400
--- lib/glob/glob.c 2019-03-07 14:23:43.000000000 -0500
***************
*** 1062,1066 ****
unsigned int directory_len;
int free_dirname; /* flag */
! int dflags;
result = (char **) malloc (sizeof (char *));
--- 1078,1082 ----
unsigned int directory_len;
int free_dirname; /* flag */
! int dflags, hasglob;
result = (char **) malloc (sizeof (char *));
***************
*** 1111,1117 ****
}
/* If directory_name contains globbing characters, then we
! have to expand the previous levels. Just recurse. */
! if (directory_len > 0 && glob_pattern_p (directory_name))
{
char **directories, *d, *p;
--- 1127,1136 ----
}
+ hasglob = 0;
/* If directory_name contains globbing characters, then we
! have to expand the previous levels. Just recurse.
! If glob_pattern_p returns != [0,1] we have a pattern that has backslash
! quotes but no unquoted glob pattern characters. We dequote it below. */
! if (directory_len > 0 && (hasglob = glob_pattern_p (directory_name)) == 1)
{
char **directories, *d, *p;
***************
*** 1176,1180 ****
d[directory_len - 1] = '\0';
! directories = glob_filename (d, dflags);
if (free_dirname)
--- 1195,1199 ----
d[directory_len - 1] = '\0';
! directories = glob_filename (d, dflags|GX_RECURSE);
if (free_dirname)
***************
*** 1333,1336 ****
--- 1352,1369 ----
return (NULL);
}
+ /* If we have a directory name with quoted characters, and we are
+ being called recursively to glob the directory portion of a pathname,
+ we need to dequote the directory name before returning it so the
+ caller can read the directory */
+ if (directory_len > 0 && hasglob == 2 && (flags & GX_RECURSE) != 0)
+ {
+ dequote_pathname (directory_name);
+ directory_len = strlen (directory_name);
+ }
+
+ /* We could check whether or not the dequoted directory_name is a
+ directory and return it here, returning the original directory_name
+ if not, but we don't do that yet. I'm not sure it matters. */
+
/* Handle GX_MARKDIRS here. */
result[0] = (char *) malloc (directory_len + 1);
*** ../bash-5.0-patched/pathexp.c 2018-04-29 17:44:48.000000000 -0400
--- pathexp.c 2019-01-31 20:19:41.000000000 -0500
***************
*** 66,74 ****
register int c;
char *send;
! int open;
DECLARE_MBSTATE;
! open = 0;
send = string + strlen (string);
--- 66,74 ----
register int c;
char *send;
! int open, bsquote;
DECLARE_MBSTATE;
! open = bsquote = 0;
send = string + strlen (string);
***************
*** 101,105 ****
globbing. */
case '\\':
! return (*string != 0);
case CTLESC:
--- 101,112 ----
globbing. */
case '\\':
! if (*string != '\0' && *string != '/')
! {
! bsquote = 1;
! string++;
! continue;
! }
! else if (*string == 0)
! return (0);
case CTLESC:
***************
*** 118,122 ****
#endif
}
! return (0);
}
--- 125,130 ----
#endif
}
!
! return (bsquote ? 2 : 0);
}
*** ../bash-5.0-patched/bashline.c 2019-01-16 16:13:21.000000000 -0500
--- bashline.c 2019-02-22 09:29:08.000000000 -0500
***************
*** 3753,3757 ****
case '\\':
! if (*string == 0)
return (0);
}
--- 3766,3770 ----
case '\\':
! if (*string++ == 0)
return (0);
}
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 3
#endif /* _PATCHLEVEL_H_ */
@@ -1,53 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-004
Bug-Reported-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Bug-Reference-ID: <87lg0g8aiw.fsf@fifthhorseman.net>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-04/msg00076.html
Bug-Description:
In bash-5.0, the `wait' builtin without arguments waits for all children of the
shell. This includes children it `inherited' at shell invocation time. This
patch modifies the behavior to not wait for these inherited children, some
of which might be long-lived.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/jobs.c 2018-12-06 11:44:34.000000000 -0500
--- jobs.c 2019-04-12 15:15:10.000000000 -0400
***************
*** 2489,2496 ****
wait_procsubs ();
reap_procsubs ();
! #if 1
/* We don't want to wait indefinitely if we have stopped children. */
- /* XXX - should add a loop that goes through the list of process
- substitutions and waits for each proc in turn before this code. */
if (any_stopped == 0)
{
--- 2490,2495 ----
wait_procsubs ();
reap_procsubs ();
! #if 0
/* We don't want to wait indefinitely if we have stopped children. */
if (any_stopped == 0)
{
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 3
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 4
#endif /* _PATCHLEVEL_H_ */
@@ -1,110 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-005
Bug-Reported-by: Brad Spencer <bspencer@blackberry.com>
Bug-Reference-ID: <1b993ff2-ce4f-662a-6be4-393457362e47@blackberry.com>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-01/msg00250.html
Bug-Description:
In certain cases, bash optimizes out a fork() call too early and prevents
traps from running.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/command.h 2018-07-20 21:16:31.000000000 -0400
--- command.h 2019-02-20 11:09:36.000000000 -0500
***************
*** 187,190 ****
--- 188,192 ----
#define CMD_LASTPIPE 0x2000
#define CMD_STDPATH 0x4000 /* use standard path for command lookup */
+ #define CMD_TRY_OPTIMIZING 0x8000 /* try to optimize this simple command */
/* What a command looks like. */
*** ../bash-5.0-patched/builtins/evalstring.c 2018-12-26 11:19:21.000000000 -0500
--- builtins/evalstring.c 2019-01-29 14:15:19.000000000 -0500
***************
*** 101,104 ****
--- 101,113 ----
}
+ int
+ can_optimize_connection (command)
+ COMMAND *command;
+ {
+ return (*bash_input.location.string == '\0' &&
+ (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
+ command->value.Connection->second->type == cm_simple);
+ }
+
void
optimize_fork (command)
***************
*** 106,110 ****
{
if (command->type == cm_connection &&
! (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR) &&
should_suppress_fork (command->value.Connection->second))
{
--- 115,120 ----
{
if (command->type == cm_connection &&
! (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
! (command->value.Connection->second->flags & CMD_TRY_OPTIMIZING) &&
should_suppress_fork (command->value.Connection->second))
{
***************
*** 413,418 ****
command->value.Simple->flags |= CMD_NO_FORK;
}
! else if (command->type == cm_connection)
! optimize_fork (command);
#endif /* ONESHOT */
--- 423,438 ----
command->value.Simple->flags |= CMD_NO_FORK;
}
!
! /* Can't optimize forks out here execept for simple commands.
! This knows that the parser sets up commands as left-side heavy
! (&& and || are left-associative) and after the single parse,
! if we are at the end of the command string, the last in a
! series of connection commands is
! command->value.Connection->second. */
! else if (command->type == cm_connection && can_optimize_connection (command))
! {
! command->value.Connection->second->flags |= CMD_TRY_OPTIMIZING;
! command->value.Connection->second->value.Simple->flags |= CMD_TRY_OPTIMIZING;
! }
#endif /* ONESHOT */
*** ../bash-5.0-patched/execute_cmd.c 2018-12-05 09:05:14.000000000 -0500
--- execute_cmd.c 2019-01-25 15:59:00.000000000 -0500
***************
*** 2768,2771 ****
--- 2768,2773 ----
(exec_result != EXECUTION_SUCCESS)))
{
+ optimize_fork (command);
+
second = command->value.Connection->second;
if (ignore_return && second)
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 4
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 5
#endif /* _PATCHLEVEL_H_ */
@@ -1,47 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-006
Bug-Reported-by: Tomas Mozes <hydrapolic@gmail.com>
Bug-Reference-ID: <CAG6MAzQumLU2vhnmr1UrYAUQAFW5Yo8hfM_sEibX9RJQWJkRrA@mail.gmail.com>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-03/msg00037.html
Bug-Description:
Bash-5.0 did not build successfully if SYSLOG_HISTORY was defined without
also defining SYSLOG_SHOPT.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/builtins/shopt.def 2018-10-05 14:49:02.000000000 -0400
--- builtins/shopt.def 2019-01-23 09:55:22.000000000 -0500
***************
*** 123,127 ****
#endif
! #if defined (SYSLOG_HISTORY) && defined (SYSLOG_SHOPT)
extern int syslog_history;
#endif
--- 123,127 ----
#endif
! #if defined (SYSLOG_HISTORY)
extern int syslog_history;
#endif
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 5
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 6
#endif /* _PATCHLEVEL_H_ */
@@ -1,62 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-007
Bug-Reported-by: Grisha Levit <grishalevit@gmail.com>
Bug-Reference-ID: <CAMu=BroHapG1AS3xB5SQaCX2XKu=-E2Ob9uW6LNuHvd=YohrDw@mail.gmail.com>
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-02/msg00067.html
Bug-Description:
Running `exec' when job control was disabled, even temporarily, but after it
had been initialized, could leave the terminal in the wrong process group for
the executed process.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/jobs.c 2018-12-06 11:44:34.000000000 -0500
--- jobs.c 2019-04-12 15:15:10.000000000 -0400
***************
*** 4838,4850 ****
{
if (job_control)
! {
! terminate_stopped_jobs ();
! if (original_pgrp >= 0)
! give_terminal_to (original_pgrp, 1);
! }
! if (original_pgrp >= 0)
! setpgid (0, original_pgrp);
}
--- 4838,4848 ----
{
if (job_control)
! terminate_stopped_jobs ();
! if (original_pgrp >= 0 && terminal_pgrp != original_pgrp)
! give_terminal_to (original_pgrp, 1);
! if (original_pgrp >= 0 && setpgid (0, original_pgrp) == 0)
! shell_pgrp = original_pgrp;
}
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 6
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 7
#endif /* _PATCHLEVEL_H_ */
@@ -1,68 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-008
Bug-Reported-by: Michael Albinus <michael.albinus@gmx.de>
Bug-Reference-ID: <87bm36k3kz.fsf@gmx.de>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2019-02/msg00111.html
Bug-Description:
When HISTSIZE is set to 0, history expansion can leave the history length
set to an incorrect value, leading to subsequent attempts to access invalid
memory.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/bashhist.c 2018-07-05 22:41:14.000000000 -0400
--- bashhist.c 2019-02-20 16:20:04.000000000 -0500
***************
*** 561,573 ****
if (!history_expansion_inhibited && history_expansion && history_expansion_p (line))
{
/* If we are expanding the second or later line of a multi-line
command, decrease history_length so references to history expansions
in these lines refer to the previous history entry and not the
current command. */
if (history_length > 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
history_length--;
expanded = history_expand (line, &history_value);
if (history_length >= 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
! history_length++;
if (expanded)
--- 561,576 ----
if (!history_expansion_inhibited && history_expansion && history_expansion_p (line))
{
+ int old_len;
+
/* If we are expanding the second or later line of a multi-line
command, decrease history_length so references to history expansions
in these lines refer to the previous history entry and not the
current command. */
+ old_len = history_length;
if (history_length > 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
history_length--;
expanded = history_expand (line, &history_value);
if (history_length >= 0 && command_oriented_history && current_command_first_line_saved && current_command_line_count > 1)
! history_length = old_len;
if (expanded)
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 7
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 8
#endif /* _PATCHLEVEL_H_ */
@@ -1,42 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-009
Bug-Reported-by: chet.ramey@case.edu
Bug-Reference-ID:
Bug-Reference-URL:
Bug-Description:
The history file reading code doesn't close the file descriptor open to
the history file when it encounters a zero-length file.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/lib/readline/histfile.c 2018-06-11 09:14:52.000000000 -0400
--- lib/readline/histfile.c 2019-05-16 15:55:57.000000000 -0400
***************
*** 306,309 ****
--- 312,316 ----
{
free (input);
+ close (file);
return 0; /* don't waste time if we don't have to */
}
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 8
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 9
#endif /* _PATCHLEVEL_H_ */
@@ -1,172 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-010
Bug-Reported-by: Thorsten Glaser <tg@mirbsd.de>
Bug-Reference-ID: <156622962831.19438.16374961114836556294.reportbug@tglase.lan.tarent.de>
Bug-Reference-URL: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=935115
Bug-Description:
Bash-5.0 changed the way assignment statements preceding special builtins
and shell functions were handled in posix mode. They automatically created
or modified global variables instead of modifying existing local variables
as in bash-4.4.
The bash-4.4 posix-mode semantics were buggy, and resulted in creating
local variables where they were not intended and modifying global variables
and local variables simultaneously.
The bash-5.0 changes were intended to fix this issue, but did not preserve
enough backwards compatibility. The posix standard also changed what it
required in these cases, so bash-5.0 is not bound by the strict conformance
requirements that existed in previous issues of the standard.
This patch modifies the bash-5.0 posix mode behavior in an effort to restore
some backwards compatibility and rationalize the behavior in the presence of
local variables. It
1. Changes the assignment semantics to be more similar to standalone assignment
statements: assignments preceding a function call or special builtin while
executing in a shell function will modify the value of a local variable
with the same name for the duration of the function's execution;
2. Changes assignments preceding shell function calls or special builtins
from within a shell function to no longer create or modify global variables
in the presence of a local variable with the same name;
3. Assignment statements preceding a shell function call or special builtin
at the global scope continue to modify the (global) calling environment,
but are unaffected by assignments preceding function calls or special
builtins within a function, as described in item 2. This is also similar
to the behavior of a standalone assignment statement.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/variables.c 2018-12-18 11:07:21.000000000 -0500
--- variables.c 2019-08-22 10:53:44.000000000 -0400
***************
*** 4461,4467 ****
/* Take a variable from an assignment statement preceding a posix special
! builtin (including `return') and create a global variable from it. This
! is called from merge_temporary_env, which is only called when in posix
! mode. */
static void
push_posix_temp_var (data)
--- 4461,4467 ----
/* Take a variable from an assignment statement preceding a posix special
! builtin (including `return') and create a variable from it as if a
! standalone assignment statement had been performed. This is called from
! merge_temporary_env, which is only called when in posix mode. */
static void
push_posix_temp_var (data)
***************
*** 4473,4486 ****
var = (SHELL_VAR *)data;
! binding_table = global_variables->table;
! if (binding_table == 0)
! binding_table = global_variables->table = hash_create (VARIABLES_HASH_BUCKETS);
!
! v = bind_variable_internal (var->name, value_cell (var), binding_table, 0, ASS_FORCE|ASS_NOLONGJMP);
/* global variables are no longer temporary and don't need propagating. */
! var->attributes &= ~(att_tempvar|att_propagate);
if (v)
! v->attributes |= var->attributes;
if (find_special_var (var->name) >= 0)
--- 4473,4497 ----
var = (SHELL_VAR *)data;
! /* Just like do_assignment_internal(). This makes assignments preceding
! special builtins act like standalone assignment statements when in
! posix mode, satisfying the posix requirement that this affect the
! "current execution environment." */
! v = bind_variable (var->name, value_cell (var), ASS_FORCE|ASS_NOLONGJMP);
!
! /* If this modifies an existing local variable, v->context will be non-zero.
! If it comes back with v->context == 0, we bound at the global context.
! Set binding_table appropriately. It doesn't matter whether it's correct
! if the variable is local, only that it's not global_variables->table */
! binding_table = v->context ? shell_variables->table : global_variables->table;
/* global variables are no longer temporary and don't need propagating. */
! if (binding_table == global_variables->table)
! var->attributes &= ~(att_tempvar|att_propagate);
!
if (v)
! {
! v->attributes |= var->attributes;
! v->attributes &= ~att_tempvar; /* not a temp var now */
! }
if (find_special_var (var->name) >= 0)
***************
*** 4576,4587 ****
{
int i;
tempvar_list = strvec_create (HASH_ENTRIES (temporary_env) + 1);
tempvar_list[tvlist_ind = 0] = 0;
!
! hash_flush (temporary_env, pushf);
! hash_dispose (temporary_env);
temporary_env = (HASH_TABLE *)NULL;
tempvar_list[tvlist_ind] = 0;
--- 4587,4601 ----
{
int i;
+ HASH_TABLE *disposer;
tempvar_list = strvec_create (HASH_ENTRIES (temporary_env) + 1);
tempvar_list[tvlist_ind = 0] = 0;
!
! disposer = temporary_env;
temporary_env = (HASH_TABLE *)NULL;
+ hash_flush (disposer, pushf);
+ hash_dispose (disposer);
+
tempvar_list[tvlist_ind] = 0;
*** ../bash-5.0-patched/tests/varenv.right 2018-12-17 15:39:48.000000000 -0500
--- tests/varenv.right 2019-08-22 16:05:25.000000000 -0400
***************
*** 147,153 ****
outside: declare -- var="one"
inside: declare -x var="value"
! outside: declare -x var="value"
! inside: declare -- var="local"
! outside: declare -x var="global"
foo=<unset> environment foo=
foo=foo environment foo=foo
--- 147,153 ----
outside: declare -- var="one"
inside: declare -x var="value"
! outside: declare -- var="outside"
! inside: declare -x var="global"
! outside: declare -- var="outside"
foo=<unset> environment foo=
foo=foo environment foo=foo
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 9
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 10
#endif /* _PATCHLEVEL_H_ */
@@ -1,59 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-011
Bug-Reported-by: Matt Whitlock
Bug-Reference-ID:
Bug-Reference-URL: https://savannah.gnu.org/support/?109671
Bug-Description:
The conditional command did not perform appropriate quoted null character
removal on its arguments, causing syntax errors and attempts to stat
invalid pathnames.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/subst.c 2018-12-22 17:43:37.000000000 -0500
--- subst.c 2019-04-14 13:25:41.000000000 -0400
***************
*** 3626,3630 ****
SPECIAL is 2, this is an rhs argument for the =~ operator, and should
be quoted appropriately for regcomp/regexec. The caller is responsible
! for removing the backslashes if the unquoted word is needed later. */
char *
cond_expand_word (w, special)
--- 3642,3648 ----
SPECIAL is 2, this is an rhs argument for the =~ operator, and should
be quoted appropriately for regcomp/regexec. The caller is responsible
! for removing the backslashes if the unquoted word is needed later. In
! any case, since we don't perform word splitting, we need to do quoted
! null character removal. */
char *
cond_expand_word (w, special)
***************
*** 3647,3650 ****
--- 3665,3670 ----
if (special == 0) /* LHS */
{
+ if (l->word)
+ word_list_remove_quoted_nulls (l);
dequote_list (l);
r = string_list (l);
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 10
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 11
#endif /* _PATCHLEVEL_H_ */
@@ -1,64 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-012
Bug-Reported-by: lessbug@qq.com
Bug-Reference-ID: <tencent_6AA531D9A5CC4121D86BD5CDA2E0DA98C605@qq.com>
Bug-Reference-URL:
Bug-Description:
When using previous-history to go back beyond the beginning of the history list,
it's possible to move to an incorrect partial line.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/lib/readline/misc.c 2017-07-07 17:30:12.000000000 -0400
--- lib/readline/misc.c 2019-05-16 11:43:46.000000000 -0400
***************
*** 577,580 ****
--- 590,594 ----
{
HIST_ENTRY *old_temp, *temp;
+ int had_saved_line;
if (count < 0)
***************
*** 589,592 ****
--- 603,607 ----
/* If we don't have a line saved, then save this one. */
+ had_saved_line = _rl_saved_line_for_history != 0;
rl_maybe_save_line ();
***************
*** 612,616 ****
if (temp == 0)
{
! rl_maybe_unsave_line ();
rl_ding ();
}
--- 627,632 ----
if (temp == 0)
{
! if (had_saved_line == 0)
! _rl_free_saved_history_line ();
rl_ding ();
}
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 11
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 12
#endif /* _PATCHLEVEL_H_ */
@@ -1,73 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-013
Bug-Reported-by: HIROSE Masaaki <hirose31@gmail.com>
Bug-Reference-ID: <CAGSOfA-RqiTe=+GsXsDKyZrrMWH4bDbXgMVVegMa6OjqC5xbnQ@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2019-05/msg00038.html
Bug-Description:
Reading history entries with timestamps can result in history entries joined
by linefeeds.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/lib/readline/histfile.c 2018-06-11 09:14:52.000000000 -0400
--- lib/readline/histfile.c 2019-05-16 15:55:57.000000000 -0400
***************
*** 370,376 ****
has_timestamps = HIST_TIMESTAMP_START (buffer);
! history_multiline_entries += has_timestamps && history_write_timestamps;
/* Skip lines until we are at FROM. */
for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++)
if (*line_end == '\n')
--- 370,378 ----
has_timestamps = HIST_TIMESTAMP_START (buffer);
! history_multiline_entries += has_timestamps && history_write_timestamps;
/* Skip lines until we are at FROM. */
+ if (has_timestamps)
+ last_ts = buffer;
for (line_start = line_end = buffer; line_end < bufend && current_line < from; line_end++)
if (*line_end == '\n')
***************
*** 381,385 ****
--- 383,398 ----
if (HIST_TIMESTAMP_START(p) == 0)
current_line++;
+ else
+ last_ts = p;
line_start = p;
+ /* If we are at the last line (current_line == from) but we have
+ timestamps (has_timestamps), then line_start points to the
+ text of the last command, and we need to skip to its end. */
+ if (current_line >= from && has_timestamps)
+ {
+ for (line_end = p; line_end < bufend && *line_end != '\n'; line_end++)
+ ;
+ line_start = (*line_end == '\n') ? line_end + 1 : line_end;
+ }
}
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 12
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 13
#endif /* _PATCHLEVEL_H_ */
@@ -1,52 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-014
Bug-Reported-by: Johannes Hielscher <jhielscher@posteo.de>
Bug-Reference-ID: <20190208205048.77c25a83@hordevm>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2019-02/msg00032.html
Bug-Description:
If the current line is empty, using the emacs C-xC-e binding to enter the
editor will edit the previous command instead of the current (empty) one.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/bashline.c 2019-01-16 16:13:21.000000000 -0500
--- bashline.c 2019-02-11 11:18:57.000000000 -0500
***************
*** 962,970 ****
finished with the command, so we should not ignore the last command */
using_history ();
! if (rl_line_buffer[0])
! {
! current_command_line_count++; /* for rl_newline above */
! bash_add_history (rl_line_buffer);
! }
current_command_line_count = 0; /* for dummy history entry */
bash_add_history ("");
--- 965,970 ----
finished with the command, so we should not ignore the last command */
using_history ();
! current_command_line_count++; /* for rl_newline above */
! bash_add_history (rl_line_buffer);
current_command_line_count = 0; /* for dummy history entry */
bash_add_history ("");
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 13
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 14
#endif /* _PATCHLEVEL_H_ */
@@ -1,78 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-015
Bug-Reported-by: Yu Kou <ckyoog@gmail.com>
Bug-Reference-ID: <CAAqoF9Ko3nAShJXGzucafs-ByUagzZ4nbQonwEkwC7s9UqfWKw@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2019-05/msg00032.html
Bug-Description:
If alias expansion is enabled when processing the command argument to the
`-c' option, an alias is defined in that command, and the command ends with
the invocation of that alias, the shell's command parser can prematurely
terminate before the entire command is executed.
Patch (apply with `patch -p0'):
*** ../bash-20190426/builtins/evalstring.c 2019-01-29 14:15:19.000000000 -0500
--- builtins/evalstring.c 2019-05-15 14:19:36.000000000 -0400
***************
*** 92,95 ****
--- 92,96 ----
running_trap == 0 &&
*bash_input.location.string == '\0' &&
+ parser_expanding_alias () == 0 &&
command->type == cm_simple &&
signal_is_trapped (EXIT_TRAP) == 0 &&
***************
*** 106,109 ****
--- 107,111 ----
{
return (*bash_input.location.string == '\0' &&
+ parser_expanding_alias () == 0 &&
(command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
command->value.Connection->second->type == cm_simple);
***************
*** 291,295 ****
with_input_from_string (string, from_file);
clear_shell_input_line ();
! while (*(bash_input.location.string))
{
command = (COMMAND *)NULL;
--- 293,297 ----
with_input_from_string (string, from_file);
clear_shell_input_line ();
! while (*(bash_input.location.string) || parser_expanding_alias ())
{
command = (COMMAND *)NULL;
***************
*** 546,550 ****
with_input_from_string (string, from_file);
! while (*(bash_input.location.string))
{
command = (COMMAND *)NULL;
--- 548,552 ----
with_input_from_string (string, from_file);
! while (*(bash_input.location.string)) /* XXX - parser_expanding_alias () ? */
{
command = (COMMAND *)NULL;
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 14
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 15
#endif /* _PATCHLEVEL_H_ */
@@ -1,58 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-016
Bug-Reported-by: sunnycemetery@gmail.com
Bug-Reference-ID: <20190316041534.GB22884@midnight>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2019-03/msg00070.html
Bug-Description:
Bash waits too long to reap /dev/fd process substitutions used as redirections
with loops and group commands, which can lead to file descriptor exhaustion.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/execute_cmd.c 2019-04-19 15:46:36.000000000 -0400
--- execute_cmd.c 2019-07-01 16:45:49.000000000 -0400
***************
*** 1104,1107 ****
--- 1085,1104 ----
discard_unwind_frame ("internal_fifos");
}
+ # if defined (HAVE_DEV_FD)
+ /* Reap process substitutions at the end of loops */
+ switch (command->type)
+ {
+ case cm_while:
+ case cm_until:
+ case cm_for:
+ case cm_group:
+ # if defined (ARITH_FOR_COMMAND)
+ case cm_arith_for:
+ # endif
+ reap_procsubs ();
+ default:
+ break;
+ }
+ # endif /* HAVE_DEV_FD */
#endif
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 15
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 16
#endif /* _PATCHLEVEL_H_ */
@@ -1,289 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-017
Bug-Reported-by: Valentin Lab <valentin.lab@kalysto.org>
Bug-Reference-ID: <ab981b9c-60a5-46d0-b7e6-a6d88b80df50@kalysto.org>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2020-03/msg00062.html
Bug-Description:
There were cases where patch 16 reaped process substitution file descriptors
(or FIFOs) and processes to early. This is a better fix for the problem that
bash50-016 attempted to solve.
Patch (apply with `patch -p0'):
*** ../bash-5.0-patched/subst.c 2019-08-29 11:16:49.000000000 -0400
--- subst.c 2020-04-02 16:24:19.000000000 -0400
***************
*** 5337,5341 ****
}
! char *
copy_fifo_list (sizep)
int *sizep;
--- 5337,5341 ----
}
! void *
copy_fifo_list (sizep)
int *sizep;
***************
*** 5343,5347 ****
if (sizep)
*sizep = 0;
! return (char *)NULL;
}
--- 5343,5347 ----
if (sizep)
*sizep = 0;
! return (void *)NULL;
}
***************
*** 5409,5414 ****
if (fifo_list[i].file)
{
! fifo_list[j].file = fifo_list[i].file;
! fifo_list[j].proc = fifo_list[i].proc;
j++;
}
--- 5409,5419 ----
if (fifo_list[i].file)
{
! if (i != j)
! {
! fifo_list[j].file = fifo_list[i].file;
! fifo_list[j].proc = fifo_list[i].proc;
! fifo_list[i].file = (char *)NULL;
! fifo_list[i].proc = 0;
! }
j++;
}
***************
*** 5426,5433 ****
void
close_new_fifos (list, lsize)
! char *list;
int lsize;
{
int i;
if (list == 0)
--- 5431,5439 ----
void
close_new_fifos (list, lsize)
! void *list;
int lsize;
{
int i;
+ char *plist;
if (list == 0)
***************
*** 5437,5442 ****
}
! for (i = 0; i < lsize; i++)
! if (list[i] == 0 && i < fifo_list_size && fifo_list[i].proc != -1)
unlink_fifo (i);
--- 5443,5448 ----
}
! for (plist = (char *)list, i = 0; i < lsize; i++)
! if (plist[i] == 0 && i < fifo_list_size && fifo_list[i].proc != -1)
unlink_fifo (i);
***************
*** 5560,5568 ****
}
! char *
copy_fifo_list (sizep)
int *sizep;
{
! char *ret;
if (nfds == 0 || totfds == 0)
--- 5566,5574 ----
}
! void *
copy_fifo_list (sizep)
int *sizep;
{
! void *ret;
if (nfds == 0 || totfds == 0)
***************
*** 5570,5579 ****
if (sizep)
*sizep = 0;
! return (char *)NULL;
}
if (sizep)
*sizep = totfds;
! ret = (char *)xmalloc (totfds * sizeof (pid_t));
return (memcpy (ret, dev_fd_list, totfds * sizeof (pid_t)));
}
--- 5576,5585 ----
if (sizep)
*sizep = 0;
! return (void *)NULL;
}
if (sizep)
*sizep = totfds;
! ret = xmalloc (totfds * sizeof (pid_t));
return (memcpy (ret, dev_fd_list, totfds * sizeof (pid_t)));
}
***************
*** 5648,5655 ****
void
close_new_fifos (list, lsize)
! char *list;
int lsize;
{
int i;
if (list == 0)
--- 5654,5662 ----
void
close_new_fifos (list, lsize)
! void *list;
int lsize;
{
int i;
+ pid_t *plist;
if (list == 0)
***************
*** 5659,5664 ****
}
! for (i = 0; i < lsize; i++)
! if (list[i] == 0 && i < totfds && dev_fd_list[i])
unlink_fifo (i);
--- 5666,5671 ----
}
! for (plist = (pid_t *)list, i = 0; i < lsize; i++)
! if (plist[i] == 0 && i < totfds && dev_fd_list[i])
unlink_fifo (i);
*** ../bash-5.0-patched/subst.h 2018-10-21 18:46:09.000000000 -0400
--- subst.h 2020-04-02 16:29:28.000000000 -0400
***************
*** 274,280 ****
extern void unlink_fifo __P((int));
! extern char *copy_fifo_list __P((int *));
! extern void unlink_new_fifos __P((char *, int));
! extern void close_new_fifos __P((char *, int));
extern void clear_fifo_list __P((void));
--- 274,279 ----
extern void unlink_fifo __P((int));
! extern void *copy_fifo_list __P((int *));
! extern void close_new_fifos __P((void *, int));
extern void clear_fifo_list __P((void));
*** ../bash-5.0-patched/execute_cmd.c 2020-02-06 20:16:48.000000000 -0500
--- execute_cmd.c 2020-04-02 17:00:10.000000000 -0400
***************
*** 565,569 ****
#if defined (PROCESS_SUBSTITUTION)
volatile int ofifo, nfifo, osize, saved_fifo;
! volatile char *ofifo_list;
#endif
--- 565,569 ----
#if defined (PROCESS_SUBSTITUTION)
volatile int ofifo, nfifo, osize, saved_fifo;
! volatile void *ofifo_list;
#endif
***************
*** 751,760 ****
# endif
! if (variable_context != 0) /* XXX - also if sourcelevel != 0? */
{
ofifo = num_fifos ();
ofifo_list = copy_fifo_list ((int *)&osize);
begin_unwind_frame ("internal_fifos");
! add_unwind_protect (xfree, ofifo_list);
saved_fifo = 1;
}
--- 751,762 ----
# endif
! /* XXX - also if sourcelevel != 0? */
! if (variable_context != 0)
{
ofifo = num_fifos ();
ofifo_list = copy_fifo_list ((int *)&osize);
begin_unwind_frame ("internal_fifos");
! if (ofifo_list)
! add_unwind_protect (xfree, ofifo_list);
saved_fifo = 1;
}
***************
*** 1100,1123 ****
nfifo = num_fifos ();
if (nfifo > ofifo)
! close_new_fifos ((char *)ofifo_list, osize);
free ((void *)ofifo_list);
discard_unwind_frame ("internal_fifos");
}
- # if defined (HAVE_DEV_FD)
- /* Reap process substitutions at the end of loops */
- switch (command->type)
- {
- case cm_while:
- case cm_until:
- case cm_for:
- case cm_group:
- # if defined (ARITH_FOR_COMMAND)
- case cm_arith_for:
- # endif
- reap_procsubs ();
- default:
- break;
- }
- # endif /* HAVE_DEV_FD */
#endif
--- 1102,1109 ----
nfifo = num_fifos ();
if (nfifo > ofifo)
! close_new_fifos ((void *)ofifo_list, osize);
free ((void *)ofifo_list);
discard_unwind_frame ("internal_fifos");
}
#endif
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 16
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 17
#endif /* _PATCHLEVEL_H_ */
@@ -1,45 +0,0 @@
BASH PATCH REPORT
=================
Bash-Release: 5.0
Patch-ID: bash50-018
Bug-Reported-by: oguzismailuysal@gmail.com
Bug-Reference-ID:
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2019-10/msg00098.html
Bug-Description:
In certain cases, bash does not perform quoted null removal on patterns
that are used as part of word expansions such as ${parameter##pattern}, so
empty patterns are treated as non-empty.
Patch (apply with `patch -p0'):
*** ../bash-5.0.17/subst.c 2020-04-02 17:14:58.000000000 -0400
--- subst.c 2020-07-09 15:28:19.000000000 -0400
***************
*** 5113,5116 ****
--- 5113,5118 ----
(int *)NULL, (int *)NULL)
: (WORD_LIST *)0;
+ if (l)
+ word_list_remove_quoted_nulls (l);
pat = string_list (l);
dispose_words (l);
*** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2016-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 17
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 18
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,80 @@
BASH PATCH REPORT
=================
Bash-Release: 5.1
Patch-ID: bash51-001
Bug-Reported-by: Fazal Majid <fazal@majid.org>
Bug-Reference-ID: <DEAB7D2C-C626-450C-B2E5-281AFF2D26D4@majid.org>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2020-12/msg00000.html
Bug-Description:
There is a missing dependency on a constructed file, which can cause highly
parellel builds to fail.
Patch (apply with `patch -p0'):
*** ../bash-5.1-patched/Makefile.in 2020-12-04 09:51:19.000000000 -0500
--- Makefile.in 2020-12-16 11:28:36.000000000 -0500
***************
*** 1316,1319 ****
--- 1316,1320 ----
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
***************
*** 1436,1439 ****
--- 1437,1441 ----
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
*** ../bash-5.1-patched/builtins/Makefile.in 2019-07-25 08:03:45.000000000 -0400
--- builtins/Makefile.in 2020-12-16 11:29:29.000000000 -0500
***************
*** 362,366 ****
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)/y.tab.h
getopt.o: ../config.h $(BASHINCDIR)/memalloc.h
--- 362,366 ----
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 ./builtext.h
#evalstring.o: $(topdir)/y.tab.h
getopt.o: ../config.h $(BASHINCDIR)/memalloc.h
*** ../bash-5.1/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 1,5 ****
/* patchlevel.h -- current bash patch level */
! /* Copyright (C) 2001-2016 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
--- 1,5 ----
/* patchlevel.h -- current bash patch level */
! /* Copyright (C) 2001-2020 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 0
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 1
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,57 @@
BASH PATCH REPORT
=================
Bash-Release: 5.1
Patch-ID: bash51-002
Bug-Reported-by: oguzismailuysal@gmail.com
Bug-Reference-ID: <CAH7i3LoHFUa4aSF5-AD2r80HG-p-YzD_9ZxomarZkhP8NMq63g@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2020-12/msg00037.html
Bug-Description:
If there are no jobs, and the `-n' and `-p' options are both supplied to
`wait', bash can assign a value to the variable name specified with `-p'
instead of leaving it unset.
Patch (apply with `patch -p0'):
*** ../bash-5.1-patched/builtins/wait.def 2020-04-09 15:13:57.000000000 -0400
--- builtins/wait.def 2020-12-11 09:46:49.000000000 -0500
***************
*** 214,222 ****
status = wait_for_any_job (wflags, &pstat);
- if (status < 0)
- status = 127;
-
if (vname && status >= 0)
bind_var_to_int (vname, pstat.pid);
if (list)
unset_waitlist ();
--- 214,222 ----
status = wait_for_any_job (wflags, &pstat);
if (vname && status >= 0)
bind_var_to_int (vname, pstat.pid);
+
+ if (status < 0)
+ status = 127;
if (list)
unset_waitlist ();
*** ../bash-5.1/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 1
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,53 @@
BASH PATCH REPORT
=================
Bash-Release: 5.1
Patch-ID: bash51-003
Bug-Reported-by: oguzismailuysal@gmail.com
Bug-Reference-ID: <CAH7i3LpG91BnNcDtaTUm2Ph7a+PnJkuh6nAc87cVL7_38tOaMQ@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2020-12/msg00050.html
Bug-Description:
Bash does not put a command substitution process that is started to perform an
expansion in a child process into the right process group where it can receive
keyboard-generated signals.
Patch (apply with `patch -p0'):
*** ../bash-5.1-patched/subst.c 2020-11-16 10:33:15.000000000 -0500
--- subst.c 2020-12-12 13:50:11.000000000 -0500
***************
*** 6357,6362 ****
#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)
pipeline_pgrp = shell_pgrp;
cleanup_the_pipeline ();
--- 6357,6364 ----
#if defined (JOB_CONTROL)
old_pipeline_pgrp = pipeline_pgrp;
! /* 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 ();
*** ../bash-5.1/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 2
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 3
#endif /* _PATCHLEVEL_H_ */
@@ -0,0 +1,126 @@
BASH PATCH REPORT
=================
Bash-Release: 5.1
Patch-ID: bash51-004
Bug-Reported-by: oguzismailuysal@gmail.com
Bug-Reference-ID: <CAH7i3LoHGmwaghDpCWRUfcY04gQmeDTH3RiG=bf2b=KbU=gyhw@mail.gmail.com>
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2020-12/msg00039.html
Bug-Description:
If a key-value compound array assignment to an associative array is supplied
as an assignment statement argument to the `declare' command that declares the
array, the assignment doesn't perform the correct word expansions.
This patch makes key-value assignment and subscript assignment perform the
same expansions when they're supplied as an argument to `declare'.
Patch (apply with `patch -p0'):
*** ../bash-5.1-patched/arrayfunc.c 2020-10-09 11:38:58.000000000 -0400
--- arrayfunc.c 2020-12-11 15:12:22.000000000 -0500
***************
*** 598,601 ****
--- 598,622 ----
}
}
+
+ /* 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
***************
*** 641,645 ****
#if ASSOC_KVPAIR_ASSIGNMENT
! if (assoc_p (var) && nlist && (nlist->word->flags & W_ASSIGNMENT) == 0 && nlist->word->word[0] != '[') /*]*/
{
iflags = flags & ~ASS_APPEND;
--- 662,666 ----
#if ASSOC_KVPAIR_ASSIGNMENT
! if (assoc_p (var) && kvpair_assignment_p (nlist))
{
iflags = flags & ~ASS_APPEND;
*** ../bash-5.1-patched/arrayfunc.h 2020-04-29 17:24:15.000000000 -0400
--- arrayfunc.h 2020-12-11 14:23:50.000000000 -0500
***************
*** 68,71 ****
--- 68,74 ----
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));
*** ../bash-5.1-patched/subst.c 2020-11-16 10:33:15.000000000 -0500
--- subst.c 2020-12-11 15:11:10.000000000 -0500
***************
*** 11605,11608 ****
--- 11605,11609 ----
WORD_LIST *l, *nl;
char *t;
+ int kvpair;
if (flags == 0)
***************
*** 11619,11622 ****
--- 11620,11627 ----
/* 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
***************
*** 11624,11627 ****
--- 11629,11638 ----
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 : "");
*** ../bash-5.1/patchlevel.h 2020-06-22 14:51:03.000000000 -0400
--- patchlevel.h 2020-10-01 11:01:28.000000000 -0400
***************
*** 26,30 ****
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 3
#endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
looks for to find the patch level (for the sccs version string). */
! #define PATCHLEVEL 4
#endif /* _PATCHLEVEL_H_ */
+13 -20
View File
@@ -12,31 +12,17 @@
<IsA>app:console</IsA>
<Summary>The standard GNU Bourne again shell</Summary>
<Description>Bash is the GNU Project's Bourne Again SHell, a complete implementation of the IEEE POSIX and Open Group shell specification with interactive command line editing, csh-like features such as history substitution.</Description>
<Archive sha1sum="d116b469b9e6ea5264a74661d3a4c797da7f997b" type="targz">mirrors://gnu/bash/bash-5.0.tar.gz</Archive>
<Archive sha1sum="063019501ef1f30fad99d2b735a7ae2ce1d11423" type="targz">mirrors://gnu/bash/bash-5.1.tar.gz</Archive>
<BuildDependencies>
<Dependency>ncurses-devel</Dependency>
</BuildDependencies>
<Patches>
<!-- Official Patches -->
<Patch level="0">official/bash50-001.patch</Patch>
<Patch level="0">official/bash50-002.patch</Patch>
<Patch level="0">official/bash50-003.patch</Patch>
<Patch level="0">official/bash50-004.patch</Patch>
<Patch level="0">official/bash50-005.patch</Patch>
<Patch level="0">official/bash50-006.patch</Patch>
<Patch level="0">official/bash50-007.patch</Patch>
<Patch level="0">official/bash50-008.patch</Patch>
<Patch level="0">official/bash50-009.patch</Patch>
<Patch level="0">official/bash50-010.patch</Patch>
<Patch level="0">official/bash50-011.patch</Patch>
<Patch level="0">official/bash50-012.patch</Patch>
<Patch level="0">official/bash50-013.patch</Patch>
<Patch level="0">official/bash50-014.patch</Patch>
<Patch level="0">official/bash50-015.patch</Patch>
<Patch level="0">official/bash50-016.patch</Patch>
<Patch level="0">official/bash50-017.patch</Patch>
<Patch level="0">official/bash50-018.patch</Patch>
<Patch>official/bash51-001.patch</Patch>
<Patch>official/bash51-002.patch</Patch>
<Patch>official/bash51-003.patch</Patch>
<Patch>official/bash51-004.patch</Patch>
<!-- Fedora patches -->
<Patch level="1">fedora/bash-2.02-security.patch</Patch>
@@ -64,7 +50,7 @@
<Patch level="1">fedora/bash-4.2-size_type.patch</Patch>
<Patch level="1">fedora/bash-4.3-man-ulimit.patch</Patch>
<!-- <Patch level="1">fedora/bash-4.3-noecho.patch</Patch> -->
<Patch level="1">fedora/bash-4.3-memleak-lc_all.patch</Patch>
<!-- <Patch level="1">fedora/bash-4.3-memleak-lc_all.patch</Patch> -->
<Patch level="1">fedora/bash-4.4-no-loadable-builtins.patch</Patch>
</Patches>
@@ -91,6 +77,13 @@
</Package>
<History>
<Update release="10">
<Date>2021-03-01</Date>
<Version>5.1.4</Version>
<Comment>Version bump.</Comment>
<Name>Idris Kalp</Name>
<Email>idriskalp@gmail.com</Email>
</Update>
<Update release="9">
<Date>2020-12-09</Date>
<Version>5.0.18</Version>