bug-bash
[Top][All Lists]
Advanced

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

Re: Comma expression in arithmetic evaluation referring to arrays make b


From: Greg Wooledge
Subject: Re: Comma expression in arithmetic evaluation referring to arrays make bash crash.
Date: Mon, 15 Feb 2016 09:47:54 -0500
User-agent: Mutt/1.4.2.3i

On Mon, Feb 15, 2016 at 09:31:57AM -0500, Chet Ramey wrote:
> On 2/15/16 8:57 AM, Pontus Stenström wrote:
> 
> > Bash Version: 4.2
> > Patch Level: 24
> > Release Status: release
> > 
> > Description:
> >     Comma expression in arithmetic evaluation referring to arrays make bash
> > crash.
> > 
> > Repeat-By:
> >     This works fine:
> >     ((c=3, d=4))
> >     This crashes my bash:
> >     a=(2 3 4 5)        # OK
> >     ((c=a[3], d=a[2])) # Crash
> 
> It runs fine on bash-4.3.42 on RHEL 5 and Mac OS X.

On HP-UX, it doesn't crash, but doesn't work quite right either:

imadev:~$ bash-4.2 -c 'echo "$BASH_VERSION"; a=(2 3 4 5); ((c=a[3], d=a[2])); 
declare -p a c d'
4.2.46(1)-release
declare -a a='([0]="2" [1]="3" [2]="4" [3]="5")'
declare -- c="5"
bash-4.2: line 0: declare: d: not found

4.2 is the second-newest release, but 4.2.24 is 29 patches behind.
The current patch level for 4.2 is 4.2.53.  I'm apparently a bit behind
the current patch level as well.

It works in 4.3, as Chet said.



reply via email to

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