bug-bash
[Top][All Lists]
Advanced

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

Re: crash when using associative array and integer variable


From: Chet Ramey
Subject: Re: crash when using associative array and integer variable
Date: Mon, 08 Nov 2010 09:29:23 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4

On 11/8/10 9:18 AM, Roman Rakus wrote:
>  On 07/28/2010 08:46 AM, Roman Rakus wrote:
>> Repeated in the bash-4.0.38 and bash-4.1.7 by the script;
>> #!/bin/bash
>>
>> typeset -Ai s
>> y='*'
>> z='['
>> s[$y]=1
>> s[$z]=2
>> (( s[$z] = s[$z] + ${s[$y]} ))
>> (( s[$y] = s[$y] + ${s[$z]} ))
>> [[ ${s[$y]} = 4  ]] && echo "ok"
>>
>> ----
>> FIX: added check;
>> diff -up bash-4.1/variables.c.Ai bash-4.1/variables.c
>> --- bash-4.1/variables.c.Ai     2010-07-28 08:42:54.000000000 +0200
>> +++ bash-4.1/variables.c        2010-07-28 08:43:17.000000000 +0200
>> @@ -2371,7 +2371,7 @@ bind_int_variable (lhs, rhs)
>>  #endif
>>      v = bind_variable (lhs, rhs, 0);
>>
>> -  if (isint)
>> +  if (isint && v)
>>      VSETATTR (v, att_integer);
>>
>>    return (v);
>>
>> RR
>>
> Any comments?

It's a fair cop.

The bug is real, and the patch is correct.  The fix will be in bash-4.2.

Chet

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



reply via email to

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