Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Feb 2005 14:51:22 +0200
From:      Jara <hugle@vkt.lt>
To:        freebsd-bugs@freebsd.org
Subject:   expr bug
Message-ID:  <22186342.20050210145122@vkt.lt>

next in thread | raw e-mail | index | archive | help
Hello guys.
Recently I had set up the trafic monitoring usign ipfw.
But ofter hour or two it stopped working..

So after some testing I have found a bug, I think
Since all this works only with  Under FreeBSD 4.10 and udner debian.
udner FreeBSD 5.2 and 5.3 I get errors, look :

------------ beggining ----------
#!/bin/bash
test="240 \
0 \
240 \
24535109 \
448241787 \
13385750 \
30655883 \
2428572717 \
30495271 \
29813961 \
4850059 \
240 \
11804353 \
58339445 \
240 \
240 \
2280965"

size=0
for i in $test; do
size=`expr $size + $i`
done
echo "value 1"
echo "$size"

echo " "
size=0
for i in $test; do
size=$(( $size + $i ))
done
echo "value 2"
echo $size

---------- end of script ----------


I get these results under different machines :


Under FreeBSD 4.10-STABLE
./test
value 1
3082976500

value 2
3082976500


Under FreeBSD 5.3 STABLE:
./test
expr: illegal option -- 1
usage: expr [-e] expression
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
value 1


value 2
3082976500



FreeBSD 5.2.1-RELEASE:
./test
expr: illegal option -- 1
usage: expr [-e] expression
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
value 1


value 2
3082976500


Debian with Kernel 2.4
value 1
3082976500

value 2
3082976500


I'm not C++ programmer so I can't look into .c files ...

Hope this helps 

Bye !!!




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?22186342.20050210145122>