Fwd: [shellcheck] Bash arithmetic expansion diagnostics (#255)

2015-04-01 Thread Dan Douglas
Hi, This was noticed in a comment to a github issue. Just forwarding it along.

$ for ((; 1(1) ;)); do break; done
 -bash: syntax error near unexpected token `newline'

$ echo $BASH_VERSION
4.3.33(1)-release

https://github.com/koalaman/shellcheck/issues/255#issuecomment-88452555

-- Forwarded message --
From: Dan Douglas orm...@gmail.com
Date: Wed, Apr 1, 2015 at 12:15 PM
Subject: Re: [shellcheck] Bash arithmetic expansion diagnostics (#255)
To: koalaman/shellcheck
reply+0003e7c2a607770e1564420080ff167a99c7ac0c55c501de92cf00011133a16592a169ce02dfd...@reply.github.com


On Wed, Apr 1, 2015 at 7:07 AM, brother notificati...@github.com wrote:

 I walked straight into one of these. It looks like something might have 
 changed in bash on top of everything else because it was not new code that 
 exploded in my face, but I have indeed a new bash version on this machine 
 since last time I tried it.

 brother ~$ cat /tmp/test.sh
 #!/bin/bash

 slots=14

 unset slotaddr
 for ((i=0x82 ; i((0x82+(slots*2))) ; i=i+2 )); do
 slotaddr+=($i)
 done

 echo ${slotaddr[@]}
 brother ~$ shellcheck /tmp/test.sh
 brother ~$ /tmp/test.sh
 /tmp/test.sh: command substitution: line 9: syntax error near unexpected 
 token `slots*2'
 /tmp/test.sh: command substitution: line 9: `(0x82+(slots*2))) ; i=i+2 '
 /tmp/test.sh: line 6: syntax error: arithmetic expression required
 /tmp/test.sh: line 6: syntax error: `((i=0x82 ; i((0x82+(slots*2))) ; i=i+2 
 ))'

 on bash 4.3.30(1)-release


That's a bug. There were some changes to the way C-for was parsed
during 4.2. Or it's possibly related to when process substitution was
removed from certain arithmetic contexts during that time.



Re: Fwd: [shellcheck] Bash arithmetic expansion diagnostics (#255)

2015-04-01 Thread Eduardo A . Bustamante López
Already fixed:

dualbus@yaqui:~/local/src/gnu/bash$ for ((; 1(1) ;)); do break; done
dualbus@yaqui:~/local/src/gnu/bash$ 
GNU bash, version 4.4.0(1)-devel (x86_64-unknown-linux-gnu)

On Wed, Apr 01, 2015 at 12:53:16PM -0500, Dan Douglas wrote:
 Hi, This was noticed in a comment to a github issue. Just forwarding it along.
 
 $ for ((; 1(1) ;)); do break; done
  -bash: syntax error near unexpected token `newline'
 
 $ echo $BASH_VERSION
 4.3.33(1)-release
 
 https://github.com/koalaman/shellcheck/issues/255#issuecomment-88452555



Re: Fwd: [shellcheck] Bash arithmetic expansion diagnostics (#255)

2015-04-01 Thread Dan Douglas
On Wed, Apr 1, 2015 at 1:01 PM, Eduardo A. Bustamante López
dual...@gmail.com wrote:
 Already fixed:

 dualbus@yaqui:~/local/src/gnu/bash$ for ((; 1(1) ;)); do break; done
 dualbus@yaqui:~/local/src/gnu/bash$
 GNU bash, version 4.4.0(1)-devel (x86_64-unknown-linux-gnu)

 On Wed, Apr 01, 2015 at 12:53:16PM -0500, Dan Douglas wrote:
 Hi, This was noticed in a comment to a github issue. Just forwarding it 
 along.

 $ for ((; 1(1) ;)); do break; done
  -bash: syntax error near unexpected token `newline'

 $ echo $BASH_VERSION
 4.3.33(1)-release

 https://github.com/koalaman/shellcheck/issues/255#issuecomment-88452555

Oh awesome, nevermind then! :)