bash update to 4.4.18
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
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
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user