File bash-4.3-newline-in-arithmetics.patch of Package bash43

Part of  2a39157723ffb7dfc597dfa46b5b6fbd93cc9ea2 Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Mon, 1 May 2017 15:46:46 -0400
Subject: commit bash-20170428 snapshot

---
 parse.y            |   12 ++++++++++++
 tests/comsub.tests |    6 ++++++
 2 files changed, 18 insertions(+)

--- parse.y
+++ parse.y	2017-05-05 09:00:29.517870856 +0000
@@ -324,6 +324,9 @@ static WORD_DESC *word_desc_to_read;
 
 static REDIRECTEE source;
 static REDIRECTEE redir;
+
+static FILE *yyoutstream;
+static FILE *yyerrstream;
 %}
 
 %union {
@@ -1308,6 +1311,8 @@ debug_parser (i)
 {
 #if YYDEBUG != 0
   yydebug = i;
+  yyoutstream = stdout;
+  yyerrstream = stderr;
 #endif
 }
 #endif
@@ -4037,8 +4042,15 @@ xparse_dolparen (base, string, indp, fla
   /*(*/
   parser_state |= PST_CMDSUBST|PST_EOFTOKEN;	/* allow instant ')' */ /*(*/
   shell_eof_token = ')';
+
+  /* Should we save and restore the bison/yacc lookahead token (yychar) here?
+     Or only if it's not YYEMPTY? */
+
   parse_string (string, "command substitution", sflags, &ep);
 
+  if (current_token == shell_eof_token)
+    yyclearin;		/* might want to clear lookahead token unconditionally */
+
   shell_eof_token = orig_eof_token;
   restore_parser_state (&ps);
   reset_parser ();
--- tests/comsub.tests
+++ tests/comsub.tests	2017-05-05 08:59:20.287174379 +0000
@@ -41,4 +41,10 @@ bar'`
 echo $(recho 'foo\
 bar')
 
+# parsing problem based on recursively calling bison parser through bash-4.4
+for (( INDEX=0; INDEX<$((10-$(expr length $V_NAME))); INDEX++ ))
+do
+	:
+done
+
 ${THIS_SH} ./comsub1.sub
openSUSE Build Service is sponsored by