summaryrefslogtreecommitdiffstats
path: root/testing/source/bash
diff options
context:
space:
mode:
Diffstat (limited to 'testing/source/bash')
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-001162
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-00243
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-00370
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-00447
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-00563
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-00643
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-007263
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-00849
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-00961
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-01063
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-01149
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-01247
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-013153
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-014113
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-01584
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-016104
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-01747
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-01878
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-019125
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-02083
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-02148
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-02248
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-02362
-rw-r--r--testing/source/bash/bash-4.0-patches/bash40-024112
-rwxr-xr-xtesting/source/bash/bash.SlackBuild80
-rw-r--r--testing/source/bash/doinst.sh18
-rw-r--r--testing/source/bash/slack-desc19
27 files changed, 2134 insertions, 0 deletions
diff --git a/testing/source/bash/bash-4.0-patches/bash40-001 b/testing/source/bash/bash-4.0-patches/bash40-001
new file mode 100644
index 000000000..5c6bb34b2
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-001
@@ -0,0 +1,162 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-001
+
+Bug-Reported-by: Mike Frysinger <vapier@gentoo.org>
+Bug-Reference-ID: <200902211821.42188.vapier@gentoo.org>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00147.html
+
+Bug-Description:
+
+Bash has problems parsing certain constructs inside Posix-style $(...)
+command substitutions, mostly with backslash-quoting and reserved word
+recognition. This is an issue because the contents are parsed at the
+time the word containing the command substitution is read.
+
+Patch:
+
+*** ../bash-4.0/parse.y 2009-01-08 08:29:12.000000000 -0500
+--- parse.y 2009-03-06 20:32:35.000000000 -0500
+***************
+*** 2928,2931 ****
+--- 2932,2936 ----
+ #define LEX_HEREDELIM 0x100 /* reading here-doc delimiter */
+ #define LEX_STRIPDOC 0x200 /* <<- strip tabs from here doc delim */
++ #define LEX_INWORD 0x400
+
+ #define COMSUB_META(ch) ((ch) == ';' || (ch) == '&' || (ch) == '|')
+***************
+*** 3180,3184 ****
+ int *lenp, flags;
+ {
+! int count, ch, peekc, tflags, lex_rwlen, lex_firstind;
+ int nestlen, ttranslen, start_lineno;
+ char *ret, *nestret, *ttrans, *heredelim;
+--- 3188,3192 ----
+ int *lenp, flags;
+ {
+! int count, ch, peekc, tflags, lex_rwlen, lex_wlen, lex_firstind;
+ int nestlen, ttranslen, start_lineno;
+ char *ret, *nestret, *ttrans, *heredelim;
+***************
+*** 3201,3205 ****
+
+ start_lineno = line_number;
+! lex_rwlen = 0;
+
+ heredelim = 0;
+--- 3209,3213 ----
+
+ start_lineno = line_number;
+! lex_rwlen = lex_wlen = 0;
+
+ heredelim = 0;
+***************
+*** 3268,3271 ****
+--- 3276,3319 ----
+ }
+
++ if (tflags & LEX_PASSNEXT) /* last char was backslash */
++ {
++ /*itrace("parse_comsub:%d: lex_passnext -> 0 ch = `%c' (%d)", line_number, ch, __LINE__);*/
++ tflags &= ~LEX_PASSNEXT;
++ if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
++ {
++ if (retind > 0)
++ retind--; /* swallow previously-added backslash */
++ continue;
++ }
++
++ RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
++ if MBTEST(ch == CTLESC || ch == CTLNUL)
++ ret[retind++] = CTLESC;
++ ret[retind++] = ch;
++ continue;
++ }
++
++ /* If this is a shell break character, we are not in a word. If not,
++ we either start or continue a word. */
++ if MBTEST(shellbreak (ch))
++ {
++ tflags &= ~LEX_INWORD;
++ /*itrace("parse_comsub:%d: lex_inword -> 0 ch = `%c' (%d)", line_number, ch, __LINE__);*/
++ }
++ else
++ {
++ if (tflags & LEX_INWORD)
++ {
++ lex_wlen++;
++ /*itrace("parse_comsub:%d: lex_inword == 1 ch = `%c' lex_wlen = %d (%d)", line_number, ch, lex_wlen, __LINE__);*/
++ }
++ else
++ {
++ /*itrace("parse_comsub:%d: lex_inword -> 1 ch = `%c' (%d)", line_number, ch, __LINE__);*/
++ tflags |= LEX_INWORD;
++ lex_wlen = 0;
++ }
++ }
++
+ /* Skip whitespace */
+ if MBTEST(shellblank (ch) && lex_rwlen == 0)
+***************
+*** 3400,3428 ****
+ }
+ else
+! ch = peekc; /* fall through and continue XXX - this skips comments if peekc == '#' */
+ }
+! /* Not exactly right yet, should handle shell metacharacters, too. If
+! any changes are made to this test, make analogous changes to subst.c:
+! extract_delimited_string(). */
+! else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || shellblank (ret[retind - 1])))
+ tflags |= LEX_INCOMMENT;
+
+! if (tflags & LEX_PASSNEXT) /* last char was backslash */
+! {
+! tflags &= ~LEX_PASSNEXT;
+! if (qc != '\'' && ch == '\n') /* double-quoted \<newline> disappears. */
+! {
+! if (retind > 0)
+! retind--; /* swallow previously-added backslash */
+! continue;
+! }
+!
+! RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
+! if MBTEST(ch == CTLESC || ch == CTLNUL)
+! ret[retind++] = CTLESC;
+! ret[retind++] = ch;
+! continue;
+! }
+! else if MBTEST(ch == CTLESC || ch == CTLNUL) /* special shell escapes */
+ {
+ RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
+--- 3442,3454 ----
+ }
+ else
+! ch = peekc; /* fall through and continue XXX */
+ }
+! else if MBTEST((tflags & LEX_CKCOMMENT) && (tflags & LEX_INCOMMENT) == 0 && ch == '#' && (((tflags & LEX_RESWDOK) && lex_rwlen == 0) || ((tflags & LEX_INWORD) && lex_wlen == 0)))
+! {
+! /*itrace("parse_comsub:%d: lex_incomment -> 1 (%d)", line_number, __LINE__);*/
+ tflags |= LEX_INCOMMENT;
++ }
+
+! if MBTEST(ch == CTLESC || ch == CTLNUL) /* special shell escapes */
+ {
+ RESIZE_MALLOCED_BUFFER (ret, retind, 2, retsize, 64);
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-002 b/testing/source/bash/bash-4.0-patches/bash40-002
new file mode 100644
index 000000000..18bd25e7b
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-002
@@ -0,0 +1,43 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-002
+
+Bug-Reported-by: phil@Arcturus.universe
+Bug-Reference-ID: <20090221143709.13878.qmail@Arcturus.universe>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00142.html
+
+Bug-Description:
+
+A line inadvertenly omitted from a submitted patch results in core dumps
+when attempting filename completion while using the bash-completion
+package.
+
+Patch:
+
+*** ../bash-4.0/pcomplete.c 2009-02-01 17:12:31.000000000 -0500
+--- pcomplete.c 2009-02-22 17:08:25.000000000 -0500
+***************
+*** 1033,1036 ****
+--- 1033,1037 ----
+
+ pps = &ps;
++ save_parser_state (pps);
+ begin_unwind_frame ("gen-shell-function-matches");
+ add_unwind_protect (restore_parser_state, (char *)pps);
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-003 b/testing/source/bash/bash-4.0-patches/bash40-003
new file mode 100644
index 000000000..cc941d5e9
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-003
@@ -0,0 +1,70 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-003
+
+Bug-Reported-by: Bernd Eggink <monoped@sudrala.de>
+Bug-Reference-ID: <49A323F5.60503@sudrala.de>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00177.html
+
+Bug-Description:
+
+Under certain circumstances, constructs containing command substitutions
+prevent PS1 from being re-evaluated and updated before being displayed.
+
+Patch:
+
+*** ../bash-4.0/parse.y 2009-01-08 08:29:12.000000000 -0500
+--- parse.y 2009-02-25 15:58:25.000000000 -0500
+***************
+*** 1616,1623 ****
+ int *ret;
+
+! ret = (int *)xmalloc (3 * sizeof (int));
+ ret[0] = last_read_token;
+ ret[1] = token_before_that;
+ ret[2] = two_tokens_ago;
+ return ret;
+ }
+--- 1616,1624 ----
+ int *ret;
+
+! ret = (int *)xmalloc (4 * sizeof (int));
+ ret[0] = last_read_token;
+ ret[1] = token_before_that;
+ ret[2] = two_tokens_ago;
++ ret[3] = current_token;
+ return ret;
+ }
+***************
+*** 1632,1635 ****
+--- 1633,1637 ----
+ token_before_that = ts[1];
+ two_tokens_ago = ts[2];
++ current_token = ts[3];
+ }
+
+***************
+*** 2669,2672 ****
+--- 2671,2675 ----
+ word_desc_to_read = (WORD_DESC *)NULL;
+
++ current_token = '\n'; /* XXX */
+ last_read_token = '\n';
+ token_to_read = '\n';
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-004 b/testing/source/bash/bash-4.0-patches/bash40-004
new file mode 100644
index 000000000..6ab6c4ee6
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-004
@@ -0,0 +1,47 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-004
+
+Bug-Reported-by: Mike Frysinger <vapier@gentoo.org>
+Bug-Reference-ID: <200902231720.30519.vapier@gentoo.org>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00176.html
+
+Bug-Description:
+
+In some cases, enabling the `checkjobs' shell option will cause the shell
+to core dump when executing the `exit' builtin.
+
+Patch:
+
+*** ../bash-4.0/builtins/exit.def 2009-01-04 14:32:22.000000000 -0500
+--- builtins/exit.def 2009-02-23 22:56:58.000000000 -0500
+***************
+*** 114,118 ****
+ if (jobs[i] && STOPPED (i))
+ stopmsg = JSTOPPED;
+! else if (check_jobs_at_exit && stopmsg == 0 && RUNNING (i))
+ stopmsg = JRUNNING;
+
+--- 114,118 ----
+ if (jobs[i] && STOPPED (i))
+ stopmsg = JSTOPPED;
+! else if (check_jobs_at_exit && stopmsg == 0 && jobs[i] && RUNNING (i))
+ stopmsg = JRUNNING;
+
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-005 b/testing/source/bash/bash-4.0-patches/bash40-005
new file mode 100644
index 000000000..ccfde66da
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-005
@@ -0,0 +1,63 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-005
+
+Bug-Reported-by: Pierre Gaston <pierre.gaston@gmail.com>
+Bug-Reference-ID: <c440c9800902242338n69f594a4nd66b8748def9cf18@mail.gmail.com>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00206.html
+
+Bug-Description:
+
+The `declare' builtin dumped core when attempting to assign associative
+array indices containing some special characters, even when they were
+quoted before being expanded.
+
+Patch:
+
+*** ../bash-4.0/builtins/declare.def 2009-01-04 14:32:22.000000000 -0500
+--- builtins/declare.def 2009-02-26 11:40:16.000000000 -0500
+***************
+*** 296,299 ****
+--- 296,306 ----
+ if (t = strchr (name, '[')) /* ] */
+ {
++ /* If offset != 0 we have already validated any array reference */
++ if (offset == 0 && valid_array_reference (name) == 0)
++ {
++ sh_invalidid (name);
++ assign_error++;
++ NEXT_VARIABLE ();
++ }
+ subscript_start = t;
+ *t = '\0';
+***************
+*** 485,489 ****
+ /* declare -a name[[n]] or declare name[n] makes name an indexed
+ array variable. */
+! else if ((making_array_special || (flags_on & att_array)) && array_p (var) == 0)
+ var = convert_var_to_array (var);
+ #endif /* ARRAY_VARS */
+--- 492,496 ----
+ /* declare -a name[[n]] or declare name[n] makes name an indexed
+ array variable. */
+! else if ((making_array_special || (flags_on & att_array)) && array_p (var) == 0 && assoc_p (var) == 0)
+ var = convert_var_to_array (var);
+ #endif /* ARRAY_VARS */
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
+
diff --git a/testing/source/bash/bash-4.0-patches/bash40-006 b/testing/source/bash/bash-4.0-patches/bash40-006
new file mode 100644
index 000000000..3d044c72e
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-006
@@ -0,0 +1,43 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-006
+
+Bug-Reported-by: Evgeniy Zhemchugov <jini.zh@gmail.com>
+Bug-Reference-ID: <e7bc8dd30902241016m8bd543ej775717d007df975b@mail.gmail.com>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00202.html
+
+Bug-Description:
+
+Bash did not parse pipelines using the |& construct correctly if the
+pipeline elements were not simple commands.
+
+Patch:
+
+*** ../bash-4.0/parse.y 2009-01-08 08:29:12.000000000 -0500
+--- parse.y 2009-02-25 17:25:56.000000000 -0500
+***************
+*** 4478,4481 ****
+--- 4478,4482 ----
+ case AND_AND:
+ case BANG:
++ case BAR_AND:
+ case DO:
+ case DONE:
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
+
diff --git a/testing/source/bash/bash-4.0-patches/bash40-007 b/testing/source/bash/bash-4.0-patches/bash40-007
new file mode 100644
index 000000000..29071e129
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-007
@@ -0,0 +1,263 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-007
+
+Bug-Reported-by: AnMaster <anmaster@tele2.se>
+Bug-Reference-ID: <49A41C18.80807@tele2.se>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00188.html
+
+Bug-Description:
+
+Bash had a number of problems parsing associative array subscripts containing
+special characters. The subscripts are supposed to be read as if they are
+enclosed between double quotes.
+
+Patch:
+
+*** ../bash-4.0/parse.y 2009-01-08 08:29:12.000000000 -0500
+--- parse.y 2009-02-25 17:25:56.000000000 -0500
+***************
+*** 2919,2922 ****
+--- 2919,2923 ----
+ #define P_COMMAND 0x08 /* parsing a command, so look for comments */
+ #define P_BACKQUOTE 0x10 /* parsing a backquoted command substitution */
++ #define P_ARRAYSUB 0x20 /* parsing a [...] array subscript for assignment */
+
+ /* Lexical state while parsing a grouping construct or $(...). */
+***************
+*** 3134,3137 ****
+--- 3134,3139 ----
+ FREE (nestret);
+ }
++ else if ((flags & P_ARRAYSUB) && (tflags & LEX_WASDOL) && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
++ goto parse_dollar_word;
+ }
+ /* Parse an old-style command substitution within double quotes as a
+***************
+*** 3150,3153 ****
+--- 3150,3154 ----
+ /* check for $(), $[], or ${} inside quoted string. */
+ {
++ parse_dollar_word:
+ if (open == ch) /* undo previous increment */
+ count--;
+***************
+*** 4277,4281 ****
+ (token_index == 0 && (parser_state&PST_COMPASSIGN))))
+ {
+! ttok = parse_matched_pair (cd, '[', ']', &ttoklen, 0);
+ if (ttok == &matched_pair_error)
+ return -1; /* Bail immediately. */
+--- 4277,4281 ----
+ (token_index == 0 && (parser_state&PST_COMPASSIGN))))
+ {
+! ttok = parse_matched_pair (cd, '[', ']', &ttoklen, P_ARRAYSUB);
+ if (ttok == &matched_pair_error)
+ return -1; /* Bail immediately. */
+*** ../bash-4.0/arrayfunc.c 2009-01-04 14:32:21.000000000 -0500
+--- arrayfunc.c 2009-02-25 07:58:54.000000000 -0500
+***************
+*** 605,666 ****
+ }
+
+! /* This function assumes s[i] == '['; returns with s[ret] == ']' if
+! an array subscript is correctly parsed. */
+! int
+! skipsubscript (s, i)
+! const char *s;
+! int i;
+! {
+! int count, c;
+! #if defined (HANDLE_MULTIBYTE)
+! mbstate_t state, state_bak;
+! size_t slength, mblength;
+! #endif
+!
+! #if defined (HANDLE_MULTIBYTE)
+! memset (&state, '\0', sizeof (mbstate_t));
+! slength = strlen (s + i);
+! #endif
+!
+! count = 1;
+! while (count)
+! {
+! /* Advance one (possibly multibyte) character in S starting at I. */
+! #if defined (HANDLE_MULTIBYTE)
+! if (MB_CUR_MAX > 1)
+! {
+! state_bak = state;
+! mblength = mbrlen (s + i, slength, &state);
+!
+! if (MB_INVALIDCH (mblength))
+! {
+! state = state_bak;
+! i++;
+! slength--;
+! }
+! else if (MB_NULLWCH (mblength))
+! return i;
+! else
+! {
+! i += mblength;
+! slength -= mblength;
+! }
+! }
+! else
+! #endif
+! ++i;
+!
+! c = s[i];
+!
+! if (c == 0)
+! break;
+! else if (c == '[')
+! count++;
+! else if (c == ']')
+! count--;
+! }
+!
+! return i;
+! }
+
+ /* This function is called with SUB pointing to just after the beginning
+--- 605,609 ----
+ }
+
+! /* skipsubscript moved to subst.c to use private functions. 2009/02/24. */
+
+ /* This function is called with SUB pointing to just after the beginning
+*** ../bash-4.0/subst.c 2009-01-28 14:34:12.000000000 -0500
+--- subst.c 2009-02-25 09:18:33.000000000 -0500
+***************
+*** 223,226 ****
+--- 223,227 ----
+ static char *extract_delimited_string __P((char *, int *, char *, char *, char *, int));
+ static char *extract_dollar_brace_string __P((char *, int *, int, int));
++ static int skip_matched_pair __P((const char *, int, int, int, int));
+
+ static char *pos_params __P((char *, int, int, int));
+***************
+*** 1375,1378 ****
+--- 1376,1480 ----
+ #define CQ_RETURN(x) do { no_longjmp_on_fatal_error = 0; return (x); } while (0)
+
++ /* This function assumes s[i] == open; returns with s[ret] == close; used to
++ parse array subscripts. FLAGS currently unused. */
++ static int
++ skip_matched_pair (string, start, open, close, flags)
++ const char *string;
++ int start, open, close, flags;
++ {
++ int i, pass_next, backq, si, c, count;
++ size_t slen;
++ char *temp, *ss;
++ DECLARE_MBSTATE;
++
++ slen = strlen (string + start) + start;
++ no_longjmp_on_fatal_error = 1;
++
++ i = start + 1; /* skip over leading bracket */
++ count = 1;
++ pass_next = backq = 0;
++ ss = (char *)string;
++ while (c = string[i])
++ {
++ if (pass_next)
++ {
++ pass_next = 0;
++ if (c == 0)
++ CQ_RETURN(i);
++ ADVANCE_CHAR (string, slen, i);
++ continue;
++ }
++ else if (c == '\\')
++ {
++ pass_next = 1;
++ i++;
++ continue;
++ }
++ else if (backq)
++ {
++ if (c == '`')
++ backq = 0;
++ ADVANCE_CHAR (string, slen, i);
++ continue;
++ }
++ else if (c == '`')
++ {
++ backq = 1;
++ i++;
++ continue;
++ }
++ else if (c == open)
++ {
++ count++;
++ i++;
++ continue;
++ }
++ else if (c == close)
++ {
++ count--;
++ if (count == 0)
++ break;
++ i++;
++ continue;
++ }
++ else if (c == '\'' || c == '"')
++ {
++ i = (c == '\'') ? skip_single_quoted (ss, slen, ++i)
++ : skip_double_quoted (ss, slen, ++i);
++ /* no increment, the skip functions increment past the closing quote. */
++ }
++ else if (c == '$' && (string[i+1] == LPAREN || string[i+1] == LBRACE))
++ {
++ si = i + 2;
++ if (string[si] == '\0')
++ CQ_RETURN(si);
++
++ if (string[i+1] == LPAREN)
++ temp = extract_delimited_string (ss, &si, "$(", "(", ")", SX_NOALLOC|SX_COMMAND); /* ) */
++ else
++ temp = extract_dollar_brace_string (ss, &si, 0, SX_NOALLOC);
++ i = si;
++ if (string[i] == '\0') /* don't increment i past EOS in loop */
++ break;
++ i++;
++ continue;
++ }
++ else
++ ADVANCE_CHAR (string, slen, i);
++ }
++
++ CQ_RETURN(i);
++ }
++
++ #if defined (ARRAY_VARS)
++ int
++ skipsubscript (string, start)
++ const char *string;
++ int start;
++ {
++ return (skip_matched_pair (string, start, '[', ']', 0));
++ }
++ #endif
++
+ /* Skip characters in STRING until we find a character in DELIMS, and return
+ the index of that character. START is the index into string at which we
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-008 b/testing/source/bash/bash-4.0-patches/bash40-008
new file mode 100644
index 000000000..7a2576aa6
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-008
@@ -0,0 +1,49 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-008
+
+Bug-Reported-by: Mike Frysinger <vapier@gentoo.org>
+Bug-Reference-ID: <200902261030.54062.vapier@gentoo.org>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00230.html
+
+Bug-Description:
+
+Patch:
+
+*** ../bash-4.0/parse.y 2009-01-08 08:29:12.000000000 -0500
+--- parse.y 2009-02-26 17:22:15.000000000 -0500
+***************
+*** 3443,3448 ****
+ else
+ shell_ungetc (peekc);
+! tflags |= LEX_HEREDELIM;
+! lex_firstind = -1;
+ continue;
+ }
+--- 3443,3451 ----
+ else
+ shell_ungetc (peekc);
+! if (peekc != '<')
+! {
+! tflags |= LEX_HEREDELIM;
+! lex_firstind = -1;
+! }
+ continue;
+ }
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-009 b/testing/source/bash/bash-4.0-patches/bash40-009
new file mode 100644
index 000000000..f58391929
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-009
@@ -0,0 +1,61 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-009
+
+Bug-Reported-by: "Chris F.A. Johnson" <cfajohnson@gmail.com>
+Bug-Reference-ID: <4d6b7$49a88cec$cef88ba3$16813@TEKSAVVY.COM>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00255.html
+
+Bug-Description:
+
+When the read builtin returned due to a timeout supplied with the -t option,
+it did not restore any modified terminal attribtues.
+
+Patch:
+
+*** ../bash-4.0/builtins/read.def 2009-01-15 23:11:21.000000000 -0500
+--- builtins/read.def 2009-03-02 10:15:39.000000000 -0500
+***************
+*** 370,381 ****
+ if (code)
+ {
+! #if 0
+ run_unwind_frame ("read_builtin");
+- return (EXECUTION_FAILURE);
+- #else
+ input_string[i] = '\0'; /* make sure it's terminated */
+! retval = 128+SIGALRM;;
+ goto assign_vars;
+- #endif
+ }
+ old_alrm = set_signal_handler (SIGALRM, sigalrm);
+--- 370,381 ----
+ if (code)
+ {
+! /* Tricky. The top of the unwind-protect stack is the free of
+! input_string. We want to run all the rest and use input_string,
+! so we have to remove it from the stack. */
+! remove_unwind_protect ();
+ run_unwind_frame ("read_builtin");
+ input_string[i] = '\0'; /* make sure it's terminated */
+! retval = 128+SIGALRM;
+ goto assign_vars;
+ }
+ old_alrm = set_signal_handler (SIGALRM, sigalrm);
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-010 b/testing/source/bash/bash-4.0-patches/bash40-010
new file mode 100644
index 000000000..3229c5736
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-010
@@ -0,0 +1,63 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-010
+
+Bug-Reported-by: Mike Frysinger <vapier@gentoo.org>
+Bug-Reference-ID: <200903030122.56206.vapier@gentoo.org>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00023.html
+
+Bug-Description:
+
+Bash has problems parsing comments in case statements when they appear in
+$(...) subshells.
+
+Patch:
+
+*** ../bash-4.0/parse.y 2009-03-07 15:18:35.000000000 -0500
+--- parse.y 2009-03-07 14:16:32.000000000 -0500
+***************
+*** 3413,3419 ****
+ tflags &= ~LEX_RESWDOK;
+ }
+! else if (shellbreak (ch) == 0)
+ {
+! tflags &= ~LEX_RESWDOK;
+ /*itrace("parse_comsub:%d: found `%c', lex_reswordok -> 0", line_number, ch);*/
+ }
+--- 3415,3433 ----
+ tflags &= ~LEX_RESWDOK;
+ }
+! else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))
+! ; /* don't modify LEX_RESWDOK if we're starting a comment */
+! else if MBTEST((tflags & LEX_INCASE) && ch != '\n')
+! /* If we can read a reserved word and we're in case, we're at the
+! point where we can read a new pattern list or an esac. We
+! handle the esac case above. If we read a newline, we want to
+! leave LEX_RESWDOK alone. If we read anything else, we want to
+! turn off LEX_RESWDOK, since we're going to read a pattern list. */
+ {
+! tflags &= ~LEX_RESWDOK;
+! /*itrace("parse_comsub:%d: lex_incase == 1 found `%c', lex_reswordok -> 0", line_number, ch);*/
+! }
+! else if MBTEST(shellbreak (ch) == 0)
+! {
+! tflags &= ~LEX_RESWDOK;
+ /*itrace("parse_comsub:%d: found `%c', lex_reswordok -> 0", line_number, ch);*/
+ }
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-011 b/testing/source/bash/bash-4.0-patches/bash40-011
new file mode 100644
index 000000000..61d1d3a8a
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-011
@@ -0,0 +1,49 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-011
+
+Bug-Reported-by: Matt Zyzik <Matt@ice.filescope.com>n
+Bug-Reference-ID: <20090312015018.C00741383ED@ice.filescope.com>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00092.html
+
+Bug-Description:
+
+When using the new |& operator following a simple command with a redirection,
+the redirection of stderr through the pipe was not performed under certain
+circumstances.
+
+Patch:
+
+*** ../bash-4.0-patched/parse.y 2009-03-08 21:24:47.000000000 -0400
+--- parse.y 2009-03-12 21:36:23.000000000 -0400
+***************
+*** 1123,1127 ****
+ REDIRECT *r;
+
+! tc = $1;
+ rd.dest = 1;
+ r = make_redirection (2, r_duplicating_output, rd);
+--- 1123,1127 ----
+ REDIRECT *r;
+
+! tc = $1->type == cm_simple ? (COMMAND *)$1->value.Simple : $1;
+ rd.dest = 1;
+ r = make_redirection (2, r_duplicating_output, rd);
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
+
diff --git a/testing/source/bash/bash-4.0-patches/bash40-012 b/testing/source/bash/bash-4.0-patches/bash40-012
new file mode 100644
index 000000000..014eae69a
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-012
@@ -0,0 +1,47 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-012
+
+Bug-Reported-by: "Clark J. Wang" <dearvoid@gmail.com>
+Bug-Reference-ID: <a96f63770903132300v7816dfb7hb7f48d46048bf3cb@mail.gmail.com>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00129.html
+
+Bug-Description:
+
+A case statement using the ;& pattern terminator followed immediately by
+"esac" caused a core dump due to a null pointer dereference.
+
+Patch:
+
+*** ../bash-4.0-patched/execute_cmd.c 2009-02-13 16:41:41.000000000 -0500
+--- execute_cmd.c 2009-03-14 13:23:00.000000000 -0400
+***************
+*** 2931,2935 ****
+ }
+ while ((clauses->flags & CASEPAT_FALLTHROUGH) && (clauses = clauses->next));
+! if ((clauses->flags & CASEPAT_TESTNEXT) == 0)
+ EXIT_CASE ();
+ else
+--- 2931,2935 ----
+ }
+ while ((clauses->flags & CASEPAT_FALLTHROUGH) && (clauses = clauses->next));
+! if (clauses == 0 || (clauses->flags & CASEPAT_TESTNEXT) == 0)
+ EXIT_CASE ();
+ else
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-013 b/testing/source/bash/bash-4.0-patches/bash40-013
new file mode 100644
index 000000000..df1fc493b
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-013
@@ -0,0 +1,153 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-013
+
+Bug-Reported-by: jidanni@jidanni.org
+Bug-Reference-ID:
+Bug-Reference-URL: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=519165
+
+Bug-Description:
+
+Though references to $@ when there are no positional parameters will now
+cause the shell to exit if the `errexit' option has been enabled, constructs
+such as ${@:-foo} should not cause an exit.
+
+Patch:
+
+*** ../bash-4.0-patched/subst.c 2009-03-08 21:24:39.000000000 -0400
+--- subst.c 2009-03-14 19:04:10.000000000 -0400
+***************
+*** 86,89 ****
+--- 86,90 ----
+ /* Flags for the `pflags' argument to param_expand() */
+ #define PF_NOCOMSUB 0x01 /* Do not perform command substitution */
++ #define PF_IGNUNBOUND 0x02 /* ignore unbound vars even if -u set */
+
+ /* These defs make it easier to use the editor. */
+***************
+*** 264,268 ****
+ static int chk_arithsub __P((const char *, int));
+
+! static WORD_DESC *parameter_brace_expand_word __P((char *, int, int));
+ static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *));
+ static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *));
+--- 265,269 ----
+ static int chk_arithsub __P((const char *, int));
+
+! static WORD_DESC *parameter_brace_expand_word __P((char *, int, int, int));
+ static WORD_DESC *parameter_brace_expand_indir __P((char *, int, int, int *, int *));
+ static WORD_DESC *parameter_brace_expand_rhs __P((char *, char *, int, int, int *, int *));
+***************
+*** 5196,5202 ****
+ NAME was found inside of a double-quoted expression. */
+ static WORD_DESC *
+! parameter_brace_expand_word (name, var_is_special, quoted)
+ char *name;
+! int var_is_special, quoted;
+ {
+ WORD_DESC *ret;
+--- 5197,5203 ----
+ NAME was found inside of a double-quoted expression. */
+ static WORD_DESC *
+! parameter_brace_expand_word (name, var_is_special, quoted, pflags)
+ char *name;
+! int var_is_special, quoted, pflags;
+ {
+ WORD_DESC *ret;
+***************
+*** 5230,5234 ****
+
+ ret = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL,
+! (int *)NULL, (int *)NULL, 0);
+ free (tt);
+ }
+--- 5231,5235 ----
+
+ ret = param_expand (tt, &sindex, quoted, (int *)NULL, (int *)NULL,
+! (int *)NULL, (int *)NULL, pflags);
+ free (tt);
+ }
+***************
+*** 5291,5295 ****
+ WORD_DESC *w;
+
+! w = parameter_brace_expand_word (name, var_is_special, quoted);
+ t = w->word;
+ /* Have to dequote here if necessary */
+--- 5292,5296 ----
+ WORD_DESC *w;
+
+! w = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND);
+ t = w->word;
+ /* Have to dequote here if necessary */
+***************
+*** 5308,5312 ****
+ return (WORD_DESC *)NULL;
+
+! w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted);
+ free (t);
+
+--- 5309,5313 ----
+ return (WORD_DESC *)NULL;
+
+! w = parameter_brace_expand_word (t, SPECIAL_VAR(t, 0), quoted, 0);
+ free (t);
+
+***************
+*** 6659,6663 ****
+ tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at);
+ else
+! tdesc = parameter_brace_expand_word (name, var_is_special, quoted);
+
+ if (tdesc)
+--- 6660,6664 ----
+ tdesc = parameter_brace_expand_indir (name + 1, var_is_special, quoted, quoted_dollar_atp, contains_dollar_at);
+ else
+! tdesc = parameter_brace_expand_word (name, var_is_special, quoted, PF_IGNUNBOUND);
+
+ if (tdesc)
+***************
+*** 6990,6994 ****
+ list = list_rest_of_args ();
+
+! if (list == 0 && unbound_vars_is_error)
+ {
+ uerror[0] = '$';
+--- 6991,6995 ----
+ list = list_rest_of_args ();
+
+! if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0)
+ {
+ uerror[0] = '$';
+***************
+*** 7052,7056 ****
+ list = list_rest_of_args ();
+
+! if (list == 0 && unbound_vars_is_error)
+ {
+ uerror[0] = '$';
+--- 7053,7057 ----
+ list = list_rest_of_args ();
+
+! if (list == 0 && unbound_vars_is_error && (pflags & PF_IGNUNBOUND) == 0)
+ {
+ uerror[0] = '$';
+
+
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-014 b/testing/source/bash/bash-4.0-patches/bash40-014
new file mode 100644
index 000000000..eeba336cd
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-014
@@ -0,0 +1,113 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-014
+
+Bug-Reported-by: smallnow@gmail.com
+Bug-Reference-ID: <49C460FE.40307@gmail.com>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00166.html
+
+Bug-Description:
+
+When the fc builtin is run in a command substitution from a shell with history
+enabled, it does not correctly calculate the command on which to operate.
+
+Patch:
+
+*** ../bash-4.0-patched/builtins/fc.def 2009-01-04 14:32:22.000000000 -0500
+--- builtins/fc.def 2009-03-21 14:03:43.000000000 -0400
+***************
+*** 89,92 ****
+--- 89,93 ----
+ extern int literal_history;
+ extern int posixly_correct;
++ extern int subshell_environment, interactive_shell;
+
+ extern int unlink __P((const char *));
+***************
+*** 173,177 ****
+ register char *sep;
+ int numbering, reverse, listing, execute;
+! int histbeg, histend, last_hist, retval, opt;
+ FILE *stream;
+ REPL *rlist, *rl;
+--- 174,178 ----
+ register char *sep;
+ int numbering, reverse, listing, execute;
+! int histbeg, histend, last_hist, retval, opt, rh;
+ FILE *stream;
+ REPL *rlist, *rl;
+***************
+*** 276,279 ****
+--- 277,282 ----
+ fprintf (stderr, "%s\n", command);
+ fc_replhist (command); /* replace `fc -s' with command */
++ /* Posix says that the re-executed commands should be entered into the
++ history. */
+ return (parse_and_execute (command, "fc", SEVAL_NOHIST));
+ }
+***************
+*** 294,298 ****
+ so we check hist_last_line_added. */
+
+! last_hist = i - remember_on_history - hist_last_line_added;
+
+ if (list)
+--- 297,306 ----
+ so we check hist_last_line_added. */
+
+! /* Even though command substitution through parse_and_execute turns off
+! remember_on_history, command substitution in a shell when set -o history
+! has been enabled (interactive or not) should use it in the last_hist
+! calculation as if it were on. */
+! rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
+! last_hist = i - rh - hist_last_line_added;
+
+ if (list)
+***************
+*** 457,461 ****
+ HIST_ENTRY **hlist;
+ {
+! int sign, n, clen;
+ register int i, j;
+ register char *s;
+--- 465,469 ----
+ HIST_ENTRY **hlist;
+ {
+! int sign, n, clen, rh;
+ register int i, j;
+ register char *s;
+***************
+*** 473,477 ****
+ so we check hist_last_line_added. This needs to agree with the
+ calculation of last_hist in fc_builtin above. */
+! i -= remember_on_history + hist_last_line_added;
+
+ /* No specification defaults to most recent command. */
+--- 481,490 ----
+ so we check hist_last_line_added. This needs to agree with the
+ calculation of last_hist in fc_builtin above. */
+! /* Even though command substitution through parse_and_execute turns off
+! remember_on_history, command substitution in a shell when set -o history
+! has been enabled (interactive or not) should use it in the last_hist
+! calculation as if it were on. */
+! rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
+! i -= rh + hist_last_line_added;
+
+ /* No specification defaults to most recent command. */
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-015 b/testing/source/bash/bash-4.0-patches/bash40-015
new file mode 100644
index 000000000..c3e8d3346
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-015
@@ -0,0 +1,84 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-015
+
+Bug-Reported-by: Lubomir Rintel <lkundrak@v3.sk>
+Bug-Reference-ID: <1237654931.32737.13.camel@localhost.localdomain>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00174.html
+
+Bug-Description:
+
+Deferring handling of signals which should cause the shell to terminate until
+it is "safe" to run the handler functions does not work for some terminating
+signals.
+
+Patch:
+
+*** ../bash-4.0-patched/sig.c 2009-01-04 14:32:41.000000000 -0500
+--- sig.c 2009-03-22 14:47:56.000000000 -0400
+***************
+*** 449,452 ****
+--- 449,494 ----
+ int sig;
+ {
++ /* If we get called twice with the same signal before handling it,
++ terminate right away. */
++ if (
++ #ifdef SIGHUP
++ sig != SIGHUP &&
++ #endif
++ #ifdef SIGINT
++ sig != SIGINT &&
++ #endif
++ #ifdef SIGDANGER
++ sig != SIGDANGER &&
++ #endif
++ #ifdef SIGPIPE
++ sig != SIGPIPE &&
++ #endif
++ #ifdef SIGALRM
++ sig != SIGALRM &&
++ #endif
++ #ifdef SIGTERM
++ sig != SIGTERM &&
++ #endif
++ #ifdef SIGXCPU
++ sig != SIGXCPU &&
++ #endif
++ #ifdef SIGXFSZ
++ sig != SIGXFSZ &&
++ #endif
++ #ifdef SIGVTALRM
++ sig != SIGVTALRM &&
++ #endif
++ #ifdef SIGLOST
++ sig != SIGLOST &&
++ #endif
++ #ifdef SIGUSR1
++ sig != SIGUSR1 &&
++ #endif
++ #ifdef SIGUSR2
++ sig != SIGUSR2 &&
++ #endif
++ sig == terminating_signal)
++ terminate_immediately = 1;
++
+ terminating_signal = sig;
+
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-016 b/testing/source/bash/bash-4.0-patches/bash40-016
new file mode 100644
index 000000000..ace2e1e5f
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-016
@@ -0,0 +1,104 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-016
+
+Bug-Reported-by: Brian J. Murrell" <brian@interlinx.bc.ca>
+Bug-Reference-ID: <1237564627.7666.12.camel@pc.interlinx.bc.ca>
+Bug-Reference-URL:http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00160.html
+
+Bug-Description:
+
+There are several problems with the handling of $LINENO in an ERR trap.
+
+Patch:
+
+*** ../bash-4.0-patched/trap.c 2009-01-16 17:07:53.000000000 -0500
+--- trap.c 2009-03-20 21:37:00.000000000 -0400
+***************
+*** 756,760 ****
+
+ flags = SEVAL_NONINT|SEVAL_NOHIST;
+! if (sig != DEBUG_TRAP && sig != RETURN_TRAP)
+ flags |= SEVAL_RESETLINE;
+ if (function_code == 0)
+--- 756,760 ----
+
+ flags = SEVAL_NONINT|SEVAL_NOHIST;
+! if (sig != DEBUG_TRAP && sig != RETURN_TRAP && sig != ERROR_TRAP)
+ flags |= SEVAL_RESETLINE;
+ if (function_code == 0)
+*** ../bash-4.0-patched/execute_cmd.c 2009-02-13 16:41:41.000000000 -0500
+--- execute_cmd.c 2009-03-21 14:16:11.000000000 -0400
+***************
+*** 569,572 ****
+--- 569,573 ----
+ /* Fork a subshell, turn off the subshell bit, turn off job
+ control and call execute_command () on the command again. */
++ line_number_for_err_trap = line_number;
+ paren_pid = make_child (savestring (make_command_string (command)),
+ asynchronous);
+***************
+*** 611,615 ****
+--- 612,619 ----
+ {
+ last_command_exit_value = exec_result;
++ save_line_number = line_number;
++ line_number = line_number_for_err_trap;
+ run_error_trap ();
++ line_number = save_line_number;
+ }
+
+***************
+*** 767,771 ****
+--- 771,777 ----
+ {
+ last_command_exit_value = exec_result;
++ line_number = line_number_for_err_trap;
+ run_error_trap ();
++ line_number = save_line_number;
+ }
+
+***************
+*** 2106,2109 ****
+--- 2112,2116 ----
+ COMMAND *tc, *second;
+ int ignore_return, exec_result, was_error_trap, invert;
++ volatile int save_line_number;
+
+ ignore_return = (command->flags & CMD_IGNORE_RETURN) != 0;
+***************
+*** 2175,2178 ****
+--- 2182,2186 ----
+ ignore_return = (command->flags & CMD_IGNORE_RETURN) != 0;
+
++ line_number_for_err_trap = line_number;
+ exec_result = execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close);
+
+***************
+*** 2180,2184 ****
+--- 2188,2195 ----
+ {
+ last_command_exit_value = exec_result;
++ save_line_number = line_number;
++ line_number = line_number_for_err_trap;
+ run_error_trap ();
++ line_number = save_line_number;
+ }
+
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-017 b/testing/source/bash/bash-4.0-patches/bash40-017
new file mode 100644
index 000000000..ff42d7781
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-017
@@ -0,0 +1,47 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-017
+
+Bug-Reported-by: Lubomir Rintel <lkundrak@v3.sk>
+Bug-Reference-ID: <1237654931.32737.13.camel@localhost.localdomain>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00174.html
+
+Bug-Description:
+
+Adding a null line to a here-document (e.g., by hitting EOF) causes the
+shell to dump core attempting to dereference the NULL pointer.
+
+Patch:
+
+*** ../bash-4.0-patched/parse.y 2009-03-08 21:24:47.000000000 -0400
+--- parse.y 2009-03-21 14:38:42.000000000 -0400
+***************
+*** 1880,1884 ****
+ ret = read_a_line (remove_quoted_newline);
+ #if defined (HISTORY)
+! if (remember_on_history && (parser_state & PST_HEREDOC))
+ {
+ /* To make adding the the here-document body right, we need to rely
+--- 1880,1884 ----
+ ret = read_a_line (remove_quoted_newline);
+ #if defined (HISTORY)
+! if (ret && remember_on_history && (parser_state & PST_HEREDOC))
+ {
+ /* To make adding the the here-document body right, we need to rely
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-018 b/testing/source/bash/bash-4.0-patches/bash40-018
new file mode 100644
index 000000000..35f33e5fe
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-018
@@ -0,0 +1,78 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-018
+
+Bug-Reported-by: Dan Price <dp@eng.sun.com>
+Bug-Reference-ID: <20090324171502.GA20582@eng.sun.com>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00184.html
+
+Bug-Description:
+
+A missing include file results in an empty function definition and a no-op
+when checking whether or not the window size has changed.
+
+Patch:
+
+*** ../bash-4.0-patched/lib/sh/winsize.c 2008-08-12 13:53:51.000000000 -0400
+--- lib/sh/winsize.c 2009-04-06 10:44:20.000000000 -0400
+***************
+*** 31,44 ****
+ #include <sys/ioctl.h>
+
+! #if !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
+! /* For struct winsize on SCO */
+! /* sys/ptem.h has winsize but needs mblk_t from sys/stream.h */
+! # if defined (HAVE_SYS_PTEM_H) && defined (TIOCGWINSZ) && defined (SIGWINCH)
+! # if defined (HAVE_SYS_STREAM_H)
+! # include <sys/stream.h>
+! # endif
+ # include <sys/ptem.h>
+! # endif /* HAVE_SYS_PTEM_H && TIOCGWINSZ && SIGWINCH */
+! #endif /* !STRUCT_WINSIZE_IN_SYS_IOCTL */
+
+ #include <stdio.h>
+--- 31,57 ----
+ #include <sys/ioctl.h>
+
+! /* Try to find the definitions of `struct winsize' and TIOGCWINSZ */
+!
+! #if defined (GWINSZ_IN_SYS_IOCTL) && !defined (TIOCGWINSZ)
+! # include <sys/ioctl.h>
+! #endif /* GWINSZ_IN_SYS_IOCTL && !TIOCGWINSZ */
+!
+! #if defined (STRUCT_WINSIZE_IN_TERMIOS) && !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
+! # include <termios.h>
+! #endif /* STRUCT_WINSIZE_IN_TERMIOS && !STRUCT_WINSIZE_IN_SYS_IOCTL */
+!
+! /* Not in either of the standard places, look around. */
+! #if !defined (STRUCT_WINSIZE_IN_TERMIOS) && !defined (STRUCT_WINSIZE_IN_SYS_IOCTL)
+! # if defined (HAVE_SYS_STREAM_H)
+! # include <sys/stream.h>
+! # endif /* HAVE_SYS_STREAM_H */
+! # if defined (HAVE_SYS_PTEM_H) /* SVR4.2, at least, has it here */
+ # include <sys/ptem.h>
+! # define _IO_PTEM_H /* work around SVR4.2 1.1.4 bug */
+! # endif /* HAVE_SYS_PTEM_H */
+! # if defined (HAVE_SYS_PTE_H) /* ??? */
+! # include <sys/pte.h>
+! # endif /* HAVE_SYS_PTE_H */
+! #endif /* !STRUCT_WINSIZE_IN_TERMIOS && !STRUCT_WINSIZE_IN_SYS_IOCTL */
+
+ #include <stdio.h>
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 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_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-019 b/testing/source/bash/bash-4.0-patches/bash40-019
new file mode 100644
index 000000000..30efd6806
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-019
@@ -0,0 +1,125 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-019
+
+Bug-Reported-by: Oleksiy Melnyk <lex@upc.ua>
+Bug-Reference-ID: <20090224142233.D2FEFC004@floyd.upc.ua>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00200.html
+
+Bug-Description:
+
+Using an external command as part of the DEBUG trap when job control is
+enabled causes pipelines to misbehave. The problem has to do with process
+groups assigned to the pipeline and terminal.
+
+Patch:
+
+*** ../bash-4.0-patched/jobs.c 2009-01-29 17:09:49.000000000 -0500
+--- jobs.c 2009-04-17 21:08:20.000000000 -0400
+***************
+*** 443,447 ****
+ the_pipeline = saved_pipeline;
+ already_making_children = saved_already_making_children;
+! if (discard)
+ discard_pipeline (old_pipeline);
+ }
+--- 443,447 ----
+ the_pipeline = saved_pipeline;
+ already_making_children = saved_already_making_children;
+! if (discard && old_pipeline)
+ discard_pipeline (old_pipeline);
+ }
+***************
+*** 4203,4205 ****
+--- 4204,4225 ----
+ }
+
++ void
++ save_pgrp_pipe (p, clear)
++ int *p;
++ int clear;
++ {
++ p[0] = pgrp_pipe[0];
++ p[1] = pgrp_pipe[1];
++ if (clear)
++ pgrp_pipe[0] = pgrp_pipe[1] = -1;
++ }
++
++ void
++ restore_pgrp_pipe (p)
++ int *p;
++ {
++ pgrp_pipe[0] = p[0];
++ pgrp_pipe[1] = p[1];
++ }
++
+ #endif /* PGRP_PIPE */
+*** ../bash-4.0-patched/jobs.h 2009-01-04 14:32:29.000000000 -0500
+--- jobs.h 2009-04-17 15:07:51.000000000 -0400
+***************
+*** 236,239 ****
+--- 236,241 ----
+
+ extern void close_pgrp_pipe __P((void));
++ extern void save_pgrp_pipe __P((int *, int));
++ extern void restore_pgrp_pipe __P((int *));
+
+ #if defined (JOB_CONTROL)
+*** ../bash-4.0-patched/trap.c 2009-01-16 17:07:53.000000000 -0500
+--- trap.c 2009-04-17 22:22:36.000000000 -0400
+***************
+*** 799,802 ****
+--- 799,804 ----
+ {
+ int trap_exit_value;
++ pid_t save_pgrp;
++ int save_pipe[2];
+
+ /* XXX - question: should the DEBUG trap inherit the RETURN trap? */
+***************
+*** 804,808 ****
+--- 806,832 ----
+ if ((sigmodes[DEBUG_TRAP] & SIG_TRAPPED) && ((sigmodes[DEBUG_TRAP] & SIG_IGNORED) == 0) && ((sigmodes[DEBUG_TRAP] & SIG_INPROGRESS) == 0))
+ {
++ #if defined (JOB_CONTROL)
++ save_pgrp = pipeline_pgrp;
++ pipeline_pgrp = 0;
++ save_pipeline (1);
++ # if defined (PGRP_PIPE)
++ save_pgrp_pipe (save_pipe, 1);
++ # endif
++ stop_making_children ();
++ #endif
++
+ trap_exit_value = _run_trap_internal (DEBUG_TRAP, "debug trap");
++
++ #if defined (JOB_CONTROL)
++ pipeline_pgrp = save_pgrp;
++ restore_pipeline (1);
++ # if defined (PGRP_PIPE)
++ close_pgrp_pipe ();
++ restore_pgrp_pipe (save_pipe);
++ # endif
++ if (pipeline_pgrp > 0)
++ give_terminal_to (pipeline_pgrp, 1);
++ notify_and_cleanup ();
++ #endif
+
+ #if defined (DEBUGGER)
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 18
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 19
+
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-020 b/testing/source/bash/bash-4.0-patches/bash40-020
new file mode 100644
index 000000000..885f15efe
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-020
@@ -0,0 +1,83 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-020
+
+Bug-Reported-by: Nicolai Lissner <nlissne@linux01.org>
+Bug-Reference-ID: <20090412020510.GA29658@lilith>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-04/msg00104.html
+
+Bug-Description:
+
+If a SIGWINCH arrives while bash is performing redisplay, multi-line prompts
+are displayed incorrectly due to the display code being called recursively.
+
+Patch:
+
+*** ../bash-4.0-patched/lib/readline/readline.h 2009-01-04 14:32:33.000000000 -0500
+--- lib/readline/readline.h 2009-04-13 08:47:00.000000000 -0400
+***************
+*** 815,820 ****
+ #define RL_STATE_MULTIKEY 0x200000 /* reading multiple-key command */
+ #define RL_STATE_VICMDONCE 0x400000 /* entered vi command mode at least once */
+
+! #define RL_STATE_DONE 0x800000 /* done; accepted line */
+
+ #define RL_SETSTATE(x) (rl_readline_state |= (x))
+--- 815,821 ----
+ #define RL_STATE_MULTIKEY 0x200000 /* reading multiple-key command */
+ #define RL_STATE_VICMDONCE 0x400000 /* entered vi command mode at least once */
++ #define RL_STATE_REDISPLAYING 0x800000 /* updating terminal display */
+
+! #define RL_STATE_DONE 0x1000000 /* done; accepted line */
+
+ #define RL_SETSTATE(x) (rl_readline_state |= (x))
+*** ../bash-4.0-patched/lib/readline/display.c 2009-01-04 14:32:32.000000000 -0500
+--- lib/readline/display.c 2009-04-13 08:29:54.000000000 -0400
+***************
+*** 513,516 ****
+--- 513,517 ----
+ data structures. */
+ _rl_block_sigint ();
++ RL_SETSTATE (RL_STATE_REDISPLAYING);
+
+ if (!rl_display_prompt)
+***************
+*** 1237,1240 ****
+--- 1238,1242 ----
+ }
+
++ RL_UNSETSTATE (RL_STATE_REDISPLAYING);
+ _rl_release_sigint ();
+ }
+*** ../bash-4.0-patched/lib/readline/terminal.c 2009-01-04 14:32:34.000000000 -0500
+--- lib/readline/terminal.c 2009-04-13 08:43:00.000000000 -0400
+***************
+*** 356,360 ****
+ if (CUSTOM_REDISPLAY_FUNC ())
+ rl_forced_update_display ();
+! else
+ _rl_redisplay_after_sigwinch ();
+ }
+--- 356,360 ----
+ if (CUSTOM_REDISPLAY_FUNC ())
+ rl_forced_update_display ();
+! else if (RL_ISSTATE(RL_STATE_REDISPLAYING) == 0)
+ _rl_redisplay_after_sigwinch ();
+ }
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 19
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 20
+
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-021 b/testing/source/bash/bash-4.0-patches/bash40-021
new file mode 100644
index 000000000..cf6ee1f5a
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-021
@@ -0,0 +1,48 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-021
+
+Bug-Reported-by: Matt Zyzik <matt.zyzik@nyu.edu>
+Bug-Reference-ID: <20090319015542.696F62B8E8@ice.filescope.com>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00149.html
+
+Bug-Description:
+
+When not in a locale supporting multibyte characters, readline will occasionally
+not erase characters between the cursor position and the end of the line
+when killing text backwards.
+
+Patch:
+
+*** ../bash-4.0-patched/lib/readline/display.c 2009-01-04 14:32:32.000000000 -0500
+--- lib/readline/display.c 2009-04-14 14:00:18.000000000 -0400
+***************
+*** 1775,1779 ****
+ adjust col_lendiff based on the difference between _rl_last_c_pos
+ and _rl_screenwidth */
+! if (col_lendiff && (_rl_last_c_pos < _rl_screenwidth))
+ #endif
+ {
+--- 1775,1779 ----
+ adjust col_lendiff based on the difference between _rl_last_c_pos
+ and _rl_screenwidth */
+! if (col_lendiff && ((MB_CUR_MAX == 1 || rl_byte_oriented) || (_rl_last_c_pos < _rl_screenwidth)))
+ #endif
+ {
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 20
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 21
+
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-022 b/testing/source/bash/bash-4.0-patches/bash40-022
new file mode 100644
index 000000000..5b6853805
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-022
@@ -0,0 +1,48 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-022
+
+Bug-Reported-by: Bernd Eggink <monoped@sudrala.de>
+Bug-Reference-ID: <49E65407.5010206@sudrala.de>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-04/msg00118.html
+
+Bug-Description:
+
+When parsing case statements in command substitutions, the shell did not
+note that a newline is a shell metacharacter and can legally be followed
+by a reserved word (e.g., `esac').
+
+Patch:
+
+*** ../bash-4.0-patched/parse.y 2009-03-08 21:24:47.000000000 -0400
+--- parse.y 2009-04-15 22:27:56.000000000 -0400
+***************
+*** 3355,3359 ****
+
+ /* Meta-characters that can introduce a reserved word. Not perfect yet. */
+! if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && shellmeta(ch))
+ {
+ /* Add this character. */
+--- 3375,3379 ----
+
+ /* Meta-characters that can introduce a reserved word. Not perfect yet. */
+! if MBTEST((tflags & LEX_RESWDOK) == 0 && (tflags & LEX_CKCASE) && (tflags & LEX_INCOMMENT) == 0 && (shellmeta(ch) || ch == '\n'))
+ {
+ /* Add this character. */
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 21
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 22
+
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-023 b/testing/source/bash/bash-4.0-patches/bash40-023
new file mode 100644
index 000000000..d2376c7da
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-023
@@ -0,0 +1,62 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-023
+
+Bug-Reported-by: Andreas Schwab <schwab@linux-m68k.org>
+Bug-Reference-ID: <m21vrhhx08.fsf@igel.home>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-04/msg00160.html
+
+Bug-Description:
+
+If the prompt length exactly matches the screen width, and the prompt ends
+with invisible characters, readline positions the cursor incorrectly.
+
+Patch:
+
+*** ../bash-4.0-patched/lib/readline/display.c 2009-01-04 14:32:32.000000000 -0500
+--- lib/readline/display.c 2009-04-25 21:42:18.000000000 -0400
+***************
+*** 1895,1898 ****
+--- 1897,1904 ----
+ woff = WRAP_OFFSET (_rl_last_v_pos, wrap_offset);
+ cpos = _rl_last_c_pos;
++
++ if (cpos == 0 && cpos == new)
++ return;
++
+ #if defined (HANDLE_MULTIBYTE)
+ /* If we have multibyte characters, NEW is indexed by the buffer point in
+***************
+*** 1908,1914 ****
+ desired display position. */
+ if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
+! (prompt_physical_chars > _rl_screenwidth &&
+ _rl_last_v_pos == prompt_last_screen_line &&
+! wrap_offset >= woff &&
+ new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
+ /* XXX last comparison might need to be >= */
+--- 1914,1920 ----
+ desired display position. */
+ if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
+! (prompt_physical_chars >= _rl_screenwidth &&
+ _rl_last_v_pos == prompt_last_screen_line &&
+! wrap_offset >= woff && dpos >= woff &&
+ new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
+ /* XXX last comparison might need to be >= */
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 22
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 23
+
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/testing/source/bash/bash-4.0-patches/bash40-024 b/testing/source/bash/bash-4.0-patches/bash40-024
new file mode 100644
index 000000000..ac2058ae3
--- /dev/null
+++ b/testing/source/bash/bash-4.0-patches/bash40-024
@@ -0,0 +1,112 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.0
+Patch-ID: bash40-024
+
+Bug-Reported-by: Matt Zyzik <matt.zyzik@nyu.edu>
+Bug-Reference-ID: <20090405205428.4FDEA1C7175@ice.filescope.com>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-04/msg00021.html
+
+Bug-Description:
+
+When using the ** globbing operator, bash will incorrectly add an extra
+directory name when the preceding directory name ends with `*' or an empty
+string when there is no preceding directory name.
+
+Patch:
+
+*** ../bash-4.0-patched/lib/glob/glob.c 2009-01-04 14:32:30.000000000 -0500
+--- lib/glob/glob.c 2009-04-28 10:22:29.000000000 -0400
+***************
+*** 357,361 ****
+ if (ep)
+ *ep = 0;
+! if (r)
+ free (r);
+ return (struct globval *)0;
+--- 357,361 ----
+ if (ep)
+ *ep = 0;
+! if (r && r != &glob_error_return)
+ free (r);
+ return (struct globval *)0;
+***************
+*** 666,671 ****
+ }
+
+! /* compat: if GX_ALLDIRS, add the passed directory also */
+! if (add_current)
+ {
+ sdlen = strlen (dir);
+--- 666,672 ----
+ }
+
+! /* compat: if GX_ALLDIRS, add the passed directory also, but don't add an
+! empty directory name. */
+! if (add_current && (flags & GX_NULLDIR) == 0)
+ {
+ sdlen = strlen (dir);
+***************
+*** 679,686 ****
+ nextlink->next = lastlink;
+ lastlink = nextlink;
+! if (flags & GX_NULLDIR)
+! nextname[0] = '\0';
+! else
+! bcopy (dir, nextname, sdlen + 1);
+ ++count;
+ }
+--- 680,684 ----
+ nextlink->next = lastlink;
+ lastlink = nextlink;
+! bcopy (dir, nextname, sdlen + 1);
+ ++count;
+ }
+***************
+*** 943,947 ****
+ register unsigned int l;
+
+! array = glob_dir_to_array (directories[i], temp_results, flags);
+ l = 0;
+ while (array[l] != NULL)
+--- 941,950 ----
+ register unsigned int l;
+
+! /* If we're expanding **, we don't need to glue the directory
+! name to the results; we've already done it in glob_vector */
+! if ((dflags & GX_ALLDIRS) && filename[0] == '*' && filename[1] == '*' && filename[2] == '\0')
+! array = temp_results;
+! else
+! array = glob_dir_to_array (directories[i], temp_results, flags);
+ l = 0;
+ while (array[l] != NULL)
+***************
+*** 960,964 ****
+
+ /* Note that the elements of ARRAY are not freed. */
+! free ((char *) array);
+ }
+ }
+--- 963,968 ----
+
+ /* Note that the elements of ARRAY are not freed. */
+! if (array != temp_results)
+! free ((char *) array);
+ }
+ }
+*** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
+--- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 23
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 24
+
+ #endif /* _PATCHLEVEL_H_ */
diff --git a/testing/source/bash/bash.SlackBuild b/testing/source/bash/bash.SlackBuild
new file mode 100755
index 000000000..fba2b632f
--- /dev/null
+++ b/testing/source/bash/bash.SlackBuild
@@ -0,0 +1,80 @@
+#!/bin/sh
+# Set initial variables:
+CWD=`pwd`
+if [ "$TMP" = "" ]; then
+ TMP=/tmp
+fi
+PKG=$TMP/package-bash
+
+VERSION=4.0
+ARCH=${ARCH:-x86_64}
+BUILD=${BUILD:-1}
+
+if [ "$ARCH" = "i386" ]; then
+ SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
+elif [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+fi
+
+if [ ! -d $TMP ]; then
+ mkdir -p $TMP # location to build the source
+fi
+rm -rf $PKG
+mkdir -p $PKG
+
+# Determine bash patchlevel:
+PATCHLEVEL="$( cd $CWD/bash-${VERSION}-patches ; /bin/ls bash40-??? | tail -1 | cut -f 2 -d - 2> /dev/null )"
+if [ "$PATCHLEVEL" = "" ]; then
+ PATCHLEVEL=0
+fi
+
+cd $TMP
+rm -rf bash-$VERSION
+tar xjvf $CWD/bash-$VERSION.tar.bz2 || exit 1
+cd bash-$VERSION || exit 1
+chown -R root:root .
+find . -perm 664 | xargs chmod 644
+find . -perm 775 | xargs chmod 755
+
+if [ -d $CWD/bash-${VERSION}-patches ]; then
+ ( cd $CWD/bash-${VERSION}-patches ; cat bash40-??? ) | patch -p0 --verbose || exit 1
+fi
+
+CFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --mandir=/usr/man \
+ --infodir=/usr/info \
+ --build=$ARCH-slackware-linux
+make -j4 || make || exit 1
+make install DESTDIR=$PKG
+mv $PKG/usr/share/doc $PKG/usr
+mkdir -p $PKG/bin
+mv $PKG/usr/bin/bash $PKG/bin/bash4.new
+strip --strip-unneeded $PKG/bin/bash4.new
+# We don't include the "bashbug" script.
+rm -rf $PKG/usr/bin $PKG/usr/man/man1/bashbug.1
+gzip -9 $PKG/usr/man/man1/*
+mkdir -p $PKG/usr/doc/bash-$VERSION
+cp -a AUTHORS CHANGES COMPAT COPYING INSTALL MANIFEST NEWS NOTES \
+ README Y2K doc/FAQ doc/INTRO $PKG/usr/doc/bash-$VERSION
+cd doc
+groff -ms -Tascii article.ms > $PKG/usr/doc/bash-$VERSION/article.txt
+# bash.1 is already installed by "make install"
+for page in builtins.1 rbash.1 ; do
+ cat $page | gzip -9c > $PKG/usr/man/man1/$page.gz
+done
+rm -f $PKG/usr/info/dir
+gzip -9 $PKG/usr/info/*
+mkdir -p $PKG/install
+zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+# Build the package:
+cd $PKG
+makepkg -l y -c n $TMP/bash-$VERSION.$PATCHLEVEL-$ARCH-$BUILD.txz
+
diff --git a/testing/source/bash/doinst.sh b/testing/source/bash/doinst.sh
new file mode 100644
index 000000000..867958fb8
--- /dev/null
+++ b/testing/source/bash/doinst.sh
@@ -0,0 +1,18 @@
+if [ -r bin/bash ]; then
+ mv bin/bash bin/bash.old
+fi
+mv bin/bash4.new bin/bash
+if [ -f bin/bash.old ]; then
+ rm -f bin/bash.old
+fi
+if [ ! -r etc/shells ]; then
+ touch etc/shells
+ chmod 644 etc/shells
+fi
+if grep -wq /bin/bash etc/shells ; then
+ true
+else
+ echo /bin/bash >> etc/shells
+fi
+( cd usr/bin ; rm -rf bash )
+( cd usr/bin ; ln -sf /bin/bash bash )
diff --git a/testing/source/bash/slack-desc b/testing/source/bash/slack-desc
new file mode 100644
index 000000000..f2fdb9292
--- /dev/null
+++ b/testing/source/bash/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+bash: bash (sh-compatible shell)
+bash:
+bash: The GNU Bourne-Again SHell. Bash is a sh-compatible command
+bash: interpreter that executes commands read from the standard input or
+bash: from a file. Bash also incorporates useful features from the Korn
+bash: and C shells (ksh and csh). Bash is ultimately intended to be a
+bash: conformant implementation of the IEEE Posix Shell and Tools
+bash: specification (IEEE Working Group 1003.2).
+bash:
+bash: Bash must be present for the system to boot properly.
+bash: