svashisht / rpms / bash

Forked from rpms/bash 4 years ago
Clone

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

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