From e054386f3f75c84f7d8739c93aebfc584d51bd8c Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Mon, 12 Dec 2011 22:02:52 -0500 Subject: [PATCH] commit bash-20100715 snapshot --- CWRU/CWRU.chlog | 12 ++++++++++++ MANIFEST | 1 + MANIFEST~ | 4 ++++ parse.y | 2 +- pcomplete.h | 1 + pcomplib.c | 3 +++ subst.c | 4 ++++ tests/RUN-ONE-TEST | 2 +- tests/comsub-posix.tests | 2 ++ tests/comsub-posix.tests~ | 2 ++ tests/comsub-posix3.sub | 22 ++++++++++++++++++++++ tests/comsub-posix3.sub~ | 23 +++++++++++++++++++++++ 12 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 tests/comsub-posix3.sub create mode 100644 tests/comsub-posix3.sub~ diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 99bc6e9df..a89609996 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -10207,3 +10207,15 @@ subst.c - when performing pattern substitution word expansions, a `&' in the replacement string is replaced by the text matched by the pattern. The `&' can be quoted with a backslash to inhibit the expansion + + 7/13 + ---- +pcomplib.[ch] + - new member for struct compspec: lcommand. for future use + + 7/15 + ---- +parse.y + - fix problem in parse_comsub where extra space was added to here-doc + delimiter if the first word in the comsub contained a `/'. Fixes + bug reported by Alex Khesin diff --git a/MANIFEST b/MANIFEST index 3b2b747aa..2e9dfb77b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -804,6 +804,7 @@ tests/comsub-posix.tests f tests/comsub-posix.right f tests/comsub-posix1.sub f tests/comsub-posix2.sub f +tests/comsub-posix3.sub f tests/cond.tests f tests/cond.right f tests/cond-regexp.sub f diff --git a/MANIFEST~ b/MANIFEST~ index d8c2d99f0..3b2b747aa 100644 --- a/MANIFEST~ +++ b/MANIFEST~ @@ -908,6 +908,9 @@ tests/jobs2.sub f tests/jobs3.sub f tests/jobs4.sub f tests/jobs.right f +tests/lastpipe.right f +tests/lastpipe.tests f +tests/lastpipe1.sub f tests/mapfile.data f tests/mapfile.right f tests/mapfile.tests f @@ -1023,6 +1026,7 @@ tests/run-intl f tests/run-iquote f tests/run-invert f tests/run-jobs f +tests/run-lastpipe f tests/run-mapfile f tests/run-more-exp f tests/run-new-exp f diff --git a/parse.y b/parse.y index af47fc78f..1b7f14abc 100644 --- a/parse.y +++ b/parse.y @@ -3555,7 +3555,7 @@ eof_error: } /* Skip whitespace */ - if MBTEST(shellblank (ch) && lex_rwlen == 0) + if MBTEST(shellblank (ch) && (tflags & LEX_HEREDELIM) == 0 && lex_rwlen == 0) { /* Add this character. */ RESIZE_MALLOCED_BUFFER (ret, retind, 1, retsize, 64); diff --git a/pcomplete.h b/pcomplete.h index dacbcefac..6c1a664cf 100644 --- a/pcomplete.h +++ b/pcomplete.h @@ -35,6 +35,7 @@ typedef struct compspec { char *suffix; char *funcname; char *command; + char *lcommand; char *filterpat; } COMPSPEC; diff --git a/pcomplib.c b/pcomplib.c index fc4fbe4db..fe337e4ae 100644 --- a/pcomplib.c +++ b/pcomplib.c @@ -62,6 +62,7 @@ compspec_create () ret->suffix = (char *)NULL; ret->funcname = (char *)NULL; ret->command = (char *)NULL; + ret->lcommand = (char *)NULL; ret->filterpat = (char *)NULL; return ret; @@ -80,6 +81,7 @@ compspec_dispose (cs) FREE (cs->suffix); FREE (cs->funcname); FREE (cs->command); + FREE (cs->lcommand); FREE (cs->filterpat); free (cs); @@ -104,6 +106,7 @@ compspec_copy (cs) new->suffix = STRDUP (cs->suffix); new->funcname = STRDUP (cs->funcname); new->command = STRDUP (cs->command); + new->lcommand = STRDUP (cs->lcommand); new->filterpat = STRDUP (cs->filterpat); return new; diff --git a/subst.c b/subst.c index d20b055e6..f1f0d6639 100644 --- a/subst.c +++ b/subst.c @@ -6355,7 +6355,11 @@ pat_subst (string, pat, rep, mflags) mtype = mflags & MATCH_TYPEMASK; +#if 0 /* bash-4.2 ? */ rxpand = (rep && *rep) ? shouldexp_replacement (rep) : 0; +#else + rxpand = 0; +#endif /* Special cases: * 1. A null pattern with mtype == MATCH_BEG means to prefix STRING diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index 3efcf32d6..72ec06a2c 100755 --- a/tests/RUN-ONE-TEST +++ b/tests/RUN-ONE-TEST @@ -1,4 +1,4 @@ -BUILD_DIR=/usr/local/build/chet/bash/bash-current +BUILD_DIR=/usr/local/build/bash/bash-current THIS_SH=$BUILD_DIR/bash PATH=$PATH:$BUILD_DIR diff --git a/tests/comsub-posix.tests b/tests/comsub-posix.tests index a2f6b3c28..3f04e6a53 100644 --- a/tests/comsub-posix.tests +++ b/tests/comsub-posix.tests @@ -200,6 +200,8 @@ ${THIS_SH} ./comsub-posix1.sub ${THIS_SH} ./comsub-posix2.sub +${THIS_SH} ./comsub-posix3.sub + # produced a parse error through bash-4.0-beta2 : $(echo foo)" " diff --git a/tests/comsub-posix.tests~ b/tests/comsub-posix.tests~ index d45cbf216..a2f6b3c28 100644 --- a/tests/comsub-posix.tests~ +++ b/tests/comsub-posix.tests~ @@ -198,6 +198,8 @@ eof ${THIS_SH} ./comsub-posix1.sub +${THIS_SH} ./comsub-posix2.sub + # produced a parse error through bash-4.0-beta2 : $(echo foo)" " diff --git a/tests/comsub-posix3.sub b/tests/comsub-posix3.sub new file mode 100644 index 000000000..3a0e39a8b --- /dev/null +++ b/tests/comsub-posix3.sub @@ -0,0 +1,22 @@ +# parsing errors before bash-4.2 + +a=$(/bin/cat << EOF | wc -l +a +b +c +EOF +) + +a=$(cat << EOF | wc -l +a +b +c +EOF +) + +a=$(/bin/cat << EOF +a +b +c +EOF +) diff --git a/tests/comsub-posix3.sub~ b/tests/comsub-posix3.sub~ new file mode 100644 index 000000000..6bf2d42a9 --- /dev/null +++ b/tests/comsub-posix3.sub~ @@ -0,0 +1,23 @@ +# parsing errors before bash-4.2 + +a=$(/bin/cat << EOF | wc -l +a +b +c +EOF +) + +a=$(cat << EOF | wc -l +a +b +c +EOF +) + +a=$(/bin/cat << EOF +a +b +c +EOF +| wc -l) + -- 2.47.3