|
From: | Anthra Norell |
Subject: | A bug report: misperforming equality test |
Date: | Wed, 25 Jun 2003 16:38:35 +0200 |
Configuration Information [Automatically
generated, do not change]:
Machine: i686 OS: cygwin Compiler: i686-pc-cygwin-gcc Compilation CFLAGS: -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE=\ 'cygwin' -DCONF_MACHTYPE='i686-pc-cygwin' -DCONF_VENDOR='pc' -DSHELL -DHAVE_CON\ FIG_H -DRECYCLES_PIDS -I. -I../bash-2.05b -I../bash-2.05b/include -I../bash-2\ .05b/lib -g -O2 uname output: CYGWIN_ME-4.90 mcuf7 1.3.22(0.78/3/2) 2003-03-18 09:20 i686 unkno\ wn unknown Cygwin Machine Type: i686-pc-cygwin Bash Version: 2.05b
Patch Level: 0 Release Status: release Description:
An arithmetic equality test
misperforms in a script. (It works okay on the command line.)
Repeat-By:
See below
--------------------------------------------------------------------------------------------------------------- All bug reports should include:
1) The version number of
Bash.
2) The hardware and operating system 3) The compiler used to compile Bash 4) A description of the bug behaviour 5) A short script or `recipe' which exercises the bug and may be used to reproduce it. 6) bashbug inserts the first three items automatically into the template it provides for filing a bug report. 1) The version number of Bash
$ set | awk /VER/
BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="9" [4]="release" [5]="i686-pc-cygwin") BASH_VERSION='2.05b.0(9)-release' 2) The hardware and operating system Hardware: Dell Inspiron
8000
OS: Windows ME 3) The compiler used to compile Bash Downloaded from Cygnis. Compiler unknown.
See above..
4) A description of the bug behaviour An arithmetic equality test misperforms in
a script. (It works okay on the command line.)
5) A short script or `recipe' which exercises the bug and may be used to reproduce it. 01
symbols=$(active_us_symbols.sh)
02 max_symbols_per_line=50 03 string='http://www.quicken.com/investments/quotes/?symbol=' 04 symbol_counter=0 05 for symbol in $symbols 06 do 07 echo $symbol 08 echo $symbol_counter 09 echo $max_symbols_per_line 10 if ((symbol_counter==max_symbols_per_line)) <<< EQUALITY TEST MALFUNCTIONS !!! 11 then echo == 12 string=$string'&B1=Go ' 13 echo $string 14 string='http://www.quicken.com/investments/quotes/?symbol=' 15 symbol_counter=0 16 else 17 string=$string$symbol+ 18 ((++symbol_counter)) 19 echo $symbol_counter 20 fi 21 done 22 echo $string The echoes:
05
06 07 AAON 08 0 09 50 10 <<< EQUALITY TEST MALFUNCTIONS !!! 11 == 12 13 http://www.quicken.com/investments/quotes/?symbol=&B1=Go 14 15 20 21 05 06 07 AAPL 08 0 09 50 11 == 12 13 http://www.quicken.com/investments/quotes/?symbol=&B1=Go 05 06 07 ABB 08 0 09 50 11 == 12 13 http://www.quicken.com/investments/quotes/?symbol=&B1=Go 14 15 20 21 05 06 07 ABC 08 0 09 50 11 == 12 13 http://www.quicken.com/investments/quotes/?symbol=&B1=Go 05 06 07 ABLZF 08 0 09 50 11 == 14 15 20 21 etc. The same test works perfectly well on the command line with indentations and all: $ echo $symbol_counter
$max_symbols_per_line
0 50 $ if ((symbol_counter==max_symbols_per_line)); then echo equal; echo really equal; else echo not equal; echo really not equal; fi not equal really not equal |
[Prev in Thread] | Current Thread | [Next in Thread] |