Re: Inconsistent arithmetic evaluation of parameters

2015-09-03 Thread Dennis Williamson
On Thu, Sep 3, 2015 at 8:45 AM, Stephane Chazelas < stephane.chaze...@gmail.com> wrote: > 2015-09-01 16:23:08 -0400, Greg Wooledge: > > On Tue, Sep 01, 2015 at 03:13:57PM -0500, Dennis Williamson wrote: > > > The version of dash I have handy (0.5.7) has math support which IMHO is > > > broken: > >

Re: Inconsistent arithmetic evaluation of parameters

2015-09-03 Thread Stephane Chazelas
2015-09-01 16:23:08 -0400, Greg Wooledge: > On Tue, Sep 01, 2015 at 03:13:57PM -0500, Dennis Williamson wrote: > > The version of dash I have handy (0.5.7) has math support which IMHO is > > broken: > > > > $ foo=bar > > $ bar=5 > > $ echo $foo > > bar > > $ echo $((foo)) > > dash: 4: Illegal numb

Re: Inconsistent arithmetic evaluation of parameters

2015-09-03 Thread Chet Ramey
On 9/2/15 11:48 AM, Greg Wooledge wrote: > On Wed, Sep 02, 2015 at 11:24:42AM -0400, Chet Ramey wrote: >> On 9/2/15 11:19 AM, Greg Wooledge wrote: >>> On Wed, Sep 02, 2015 at 10:16:14AM -0500, Dennis Williamson wrote: The $ is implied. >>> >>> That is completely absurd. (And wrong.) >> >> Not

Re: Inconsistent arithmetic evaluation of parameters

2015-09-02 Thread Greg Wooledge
On Wed, Sep 02, 2015 at 11:24:42AM -0400, Chet Ramey wrote: > On 9/2/15 11:19 AM, Greg Wooledge wrote: > > On Wed, Sep 02, 2015 at 10:16:14AM -0500, Dennis Williamson wrote: > >> The $ is implied. > > > > That is completely absurd. (And wrong.) > > Not exactly. When the arithmetic evaluator enc

Re: Inconsistent arithmetic evaluation of parameters

2015-09-02 Thread Chet Ramey
On 9/2/15 11:19 AM, Greg Wooledge wrote: > On Wed, Sep 02, 2015 at 10:16:14AM -0500, Dennis Williamson wrote: >> The $ is implied. > > That is completely absurd. (And wrong.) Not exactly. When the arithmetic evaluator encounters a token that is of the form of a shell identifier (`bar'), in a co

Re: Inconsistent arithmetic evaluation of parameters

2015-09-02 Thread Greg Wooledge
On Wed, Sep 02, 2015 at 10:16:14AM -0500, Dennis Williamson wrote: > The $ is implied. That is completely absurd. (And wrong.)

Re: Inconsistent arithmetic evaluation of parameters

2015-09-02 Thread Dennis Williamson
On Wed, Sep 2, 2015 at 2:16 AM, Andreas Schwab wrote: > Dennis Williamson writes: > > > I disagree. The _expansion_ produced "bar" > > That's not an expansion. Only $ introduces an expansion. > > Andreas. > > The $ is implied. -- Visit serverfault.com to get your system administration questio

Re: Inconsistent arithmetic evaluation of parameters

2015-09-02 Thread Chet Ramey
On 9/1/15 5:05 PM, Dennis Williamson wrote: > It's the line above those two where I demonstrate the failure in the > indirection and equivalency. > > $ echo $((foo)) # expansion succeeds, indirection fails > dash: 4: Illegal number: bar Because `foo' is expanded, but the value is not treated as

Re: Inconsistent arithmetic evaluation of parameters

2015-09-02 Thread Chet Ramey
On 9/1/15 12:50 AM, Clint Hepner wrote: > Bash Version: 4.3 > Patch Level: 42 > Release Status: release > > Description: > > Parameter names are recursively evaluated in an arithmetic expression, but > this > is not done consistently. Parameter names are expanded and treated as expressions whe

Re: Inconsistent arithmetic evaluation of parameters

2015-09-02 Thread Chet Ramey
On 9/1/15 4:13 PM, Dennis Williamson wrote: > The version of dash I have handy (0.5.7) has math support which IMHO is > broken: > > $ foo=bar > $ bar=5 > $ echo $foo > bar > $ echo $((foo)) > dash: 4: Illegal number: bar > $ echo $(($foo)) > 5 > $ echo $((bar)) > 5 > $ echo $(($bar)) > 5 Dash

Re: Inconsistent arithmetic evaluation of parameters

2015-09-02 Thread Andreas Schwab
Dennis Williamson writes: > On Tue, Sep 1, 2015 at 4:24 PM, Andreas Schwab > wrote: > >> Dennis Williamson writes: >> >> > $ echo $((foo)) # expansion succeeds, indirection fails >> > dash: 4: Illegal number: bar >> >> The indirection didn't fail, it just didn't produce a number, so the >> exp

Re: Inconsistent arithmetic evaluation of parameters

2015-09-01 Thread Dennis Williamson
On Tue, Sep 1, 2015 at 4:24 PM, Andreas Schwab wrote: > Dennis Williamson writes: > > > $ echo $((foo)) # expansion succeeds, indirection fails > > dash: 4: Illegal number: bar > > The indirection didn't fail, it just didn't produce a number, so the > expression is malformed. > > Andreas. > > -

Re: Inconsistent arithmetic evaluation of parameters

2015-09-01 Thread Andreas Schwab
Dennis Williamson writes: > $ echo $((foo)) # expansion succeeds, indirection fails > dash: 4: Illegal number: bar The indirection didn't fail, it just didn't produce a number, so the expression is malformed. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6

Re: Inconsistent arithmetic evaluation of parameters

2015-09-01 Thread Dennis Williamson
On Tue, Sep 1, 2015 at 3:23 PM, Greg Wooledge wrote: > On Tue, Sep 01, 2015 at 03:13:57PM -0500, Dennis Williamson wrote: > > The version of dash I have handy (0.5.7) has math support which IMHO is > > broken: > > > > $ foo=bar > > $ bar=5 > > $ echo $foo > > bar > > $ echo $((foo)) > > dash: 4:

Re: Inconsistent arithmetic evaluation of parameters

2015-09-01 Thread Greg Wooledge
On Tue, Sep 01, 2015 at 03:13:57PM -0500, Dennis Williamson wrote: > The version of dash I have handy (0.5.7) has math support which IMHO is > broken: > > $ foo=bar > $ bar=5 > $ echo $foo > bar > $ echo $((foo)) > dash: 4: Illegal number: bar > $ echo $(($foo)) > 5 > $ echo $((bar)) > 5 > $ echo

Re: Inconsistent arithmetic evaluation of parameters

2015-09-01 Thread Dennis Williamson
On Tue, Sep 1, 2015 at 12:50 PM, Greg Wooledge wrote: > On Tue, Sep 01, 2015 at 12:50:23AM -0400, Clint Hepner wrote: > > Repeat-By: > > > > foo=bar > > bar=5 > > echo $(( foo ))# produces 5 > > echo $(( foo++ )) # produces 5 > > echo $foo # produces 6, not bar >

Re: Inconsistent arithmetic evaluation of parameters

2015-09-01 Thread Greg Wooledge
On Tue, Sep 01, 2015 at 12:50:23AM -0400, Clint Hepner wrote: > Repeat-By: > > foo=bar > bar=5 > echo $(( foo ))# produces 5 > echo $(( foo++ )) # produces 5 > echo $foo # produces 6, not bar > echo $bar # produces 5, not 6 bar was never changed from

Inconsistent arithmetic evaluation of parameters

2015-09-01 Thread Clint Hepner
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: darwin14.5.0 Compiler: clang Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='darwin14.5.0' -DCONF_MACHTYPE='x86_64-apple-darwin14.5.0' -DCONF_VENDOR='apple' -DLOCALEDIR='/usr/loca