nalika / rpms / bash

Forked from rpms/bash 2 years ago
Clone

Blame SOURCES/bash-4.2-case-in-command-subst.patch

07a490
diff -up bash-4.2/parse.y.old bash-4.2/parse.y
07a490
--- bash-4.2/parse.y.old	2015-05-18 13:04:30.341494305 +0200
07a490
+++ bash-4.2/parse.y	2015-05-18 13:05:18.245509202 +0200
07a490
@@ -3693,6 +3693,17 @@ eof_error:
07a490
 	    }
07a490
 	  else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))
07a490
 	    ;	/* don't modify LEX_RESWDOK if we're starting a comment */
07a490
+	  /* Allow `do' followed by space, tab, or newline to preserve the
07a490
+	     RESWDOK flag, but reset the reserved word length counter so we
07a490
+	     can read another one. */
07a490
+	  else if MBTEST(((tflags & LEX_INCASE) == 0) &&
07a490
+			  (isblank(ch) || ch == '\n') &&
07a490
+			  lex_rwlen == 2 &&
07a490
+			  STREQN (ret + retind - 2, "do", 2))
07a490
+{
07a490
+/*itrace("parse_comsub:%d: lex_incase == 1 found `%c', found \"do\"", line_number, ch);*/
07a490
+	    lex_rwlen = 0;
07a490
+}
07a490
 	  else if MBTEST((tflags & LEX_INCASE) && ch != '\n')
07a490
 	    /* If we can read a reserved word and we're in case, we're at the
07a490
 	       point where we can read a new pattern list or an esac.  We