bug-bash
[Top][All Lists]
Advanced

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

Re: Error message garbage when parameter expansion used inside (()) and


From: Chet Ramey
Subject: Re: Error message garbage when parameter expansion used inside (()) and variable unset
Date: Tue, 3 Apr 2018 14:15:37 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 4/3/18 1:15 PM, PRussell wrote:
> Chet, is the output on opensuse running bash 4.4.19, correct?
> 
> The specific output:
> 
> ./t.sh: line 9: ���#V: var1 ==  : syntax error: operand expected (error
> token is "==  ")
> 
> archlinux has the same version of bash and I got the same results as on
> opensuse.
> 
> Below are the details of running ./t.sh &>t.log on multiple versions of bash.

I don't see the same type of memory corruption.  I get:

chet-mail(1)$ lsb_release -d
Description:    Red Hat Enterprise Linux Server release 6.9 (Santiago)
chet-mail(1)$ cat ./x18
( set -x;var=0;var1=var; (( var1 == $var2 )) && echo yes || echo no )
chet-mail(1)$ ./bash -c 'echo $BASH_VERSION'
4.4.19(4)-release
chet-mail(1)$ ./bash ./x18
+ var=0
+ var1=var
+ ((  var1 ==   ))
./x18: line 1: ((: var1 ==  : syntax error: operand expected (error token
is "==  ")
+ echo no
no

But otherwise the results are correct.

If you'd like, take a look at running your version under valgrind or a
similar tool to see if bash is touching freed memory. (I don't happen to
see that running on RHEL, but your results may vary with a distribution-
compiled version.)

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



reply via email to

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