bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntax error near unexpected token `newline' within loops


From: Eduardo Bustamante
Subject: Re: Syntax error near unexpected token `newline' within loops
Date: Mon, 1 May 2017 23:41:46 -0500

On Mon, Apr 24, 2017 at 3:48 PM, Chet Ramey <address@hidden> wrote:
[...]
> That works on Linux, but not on the BSDs, since Posix says it doesn't
> have to.

I see that a test for this has been added to comsub.tests:

address@hidden:~/src/gnu/bash$ git log -1 -p -- tests/comsub.tests
commit 2a39157723ffb7dfc597dfa46b5b6fbd93cc9ea2
Author: Chet Ramey <address@hidden>
Date:   Mon May 1 15:46:46 2017 -0400

    commit bash-20170428 snapshot

diff --git a/tests/comsub.tests b/tests/comsub.tests
index e8fab711..fceea00f 100644
--- a/tests/comsub.tests
+++ b/tests/comsub.tests
@@ -44,6 +44,12 @@ bar')
 # long-standing parse error in all versions up through bash-4.3
 echo ${foo:-$(echo a{b,c})} >/dev/null

+# 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
 ${THIS_SH} ./comsub2.sub
 ${THIS_SH} ./comsub3.sub


But in my system (Debian 9, expr from GNU coreutils 8.26-3):

address@hidden:~/src/gnu/bash$ expr length
expr: syntax error

Which comes up as a false positive during the tests run. Could this
test be changed to something that does not require an external tool?,
like:

  for (( ; $(($(:))); )); do :; done

This is what I see when I run make tests on the latest commit:

run-comsub
22,23d21
< expr: syntax error
< ./comsub.tests: line 48: 10-: syntax error: operand expected (error
token is "-")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]