Re: Wrong 'declare -A' causes segfault

2009-11-26 Thread Bernd Eggink

Am 26.11.2009 01:47, schrieb Chet Ramey:

Bernd Eggink wrote:

GNU bash, version 4.0.35(1)-release (i686-pc-linux-gnu)

The following syntactically wrong declaration causes a segmentation fault:

 declare -A x=y

It should issue an error message instead.


It's not actually a syntax error.


Hm, but the man page says, Indexed  array  assignments  do not require 
the bracket and subscript. This sounds like the syntax above is valid 
for indexed arrays, but not for associative arrays. Maybe the 
documentation should be corrected then.


Bernd

--
Bernd Eggink
http://sudrala.de




Re: Wrong 'declare -A' causes segfault

2009-11-25 Thread Chet Ramey
Bernd Eggink wrote:
 GNU bash, version 4.0.35(1)-release (i686-pc-linux-gnu)
 
 The following syntactically wrong declaration causes a segmentation fault:
 
 declare -A x=y
 
 It should issue an error message instead.

It's not actually a syntax error.  It should assign an element with key
0, like an indexed array assigns an element with index 0.  This will
be fixed in bash-4.1.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/