rcolebaugh / rpms / bash

Forked from rpms/bash a year ago
Clone

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

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