[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Comparison failure
From: |
Frans de Boer |
Subject: |
Comparison failure |
Date: |
Thu, 10 Jan 2008 14:13:07 +0100 |
To: bug-bash@gnu.org
Subject: Comparison failure
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -g -O2
uname output: Linux ws1 2.6.22.13-0.3-default #1 SMP 2007/11/19 15:02:58
UTC x86
_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu
Bash Version: 3.2
Patch Level: 33
Release Status: release
Description:
Following is a function which fails constantly. The function is being
called by other functions but the result is nowadays always this failure
on the compare function. Sometimes it went wrong when the number was
three (2) in this example it is 6. This has worked before with another
version of bash.
The version output for bash is: GNU bash, version 3.2.25(1)-release
(x86_64-suse-linux-gnu)
from the SuSE10.3 distribution. A personaly compiled bash GNU bash,
version 3.2.33(1)-release (x86_64-unknown-linux-gnu). Both behave the
same.
------ Used function ->
#
function rec_next () {
local -ir i=$1
if [[ $i != -1 && $i < $((iPriTblCnt-1)) ]]; then
echo $((i+1));
else
echo -1
fi
}
#
------ Example trace 1 ->
+ i=5
+ (( 5 != -1 ))
+ printf 'PhysRec=5 Date=20071101 File=Archive-Chm-0.05.tar.gz CS= AP=0
\n'
PhysRec=5 Date=20071101 File=Archive-Chm-0.05.tar.gz CS= AP=0
++ rec_next 5
++ local -ir i=5
++ [[ 5 != -1 ]]
++ [[ 5 < 54 ]]
++ echo 6
+ i=6
+ (( 6 != -1 ))
+ printf 'PhysRec=6 Date=20071101 File=Archive-Cpio-0.02.tar.gz CS= AP=0
\n'
PhysRec=6 Date=20071101 File=Archive-Cpio-0.02.tar.gz CS= AP=0
++ rec_next 6
++ local -ir i=6
++ [[ 6 != -1 ]]
++ [[ 6 < 54 ]]
++ echo -1
+ i=-1
------------- Example trace 2 ->
+ i=1
+ (( 1 != -1 ))
+ printf 'PhysRec=1 Date=20071101 File=Archive-Any-0.091.tar.gz CS= AP=0
\n'
PhysRec=1 Date=20071101 File=Archive-Any-0.091.tar.gz CS= AP=0
++ rec_next 1
++ local -i i=1
++ [[ 1 != -1 ]]
++ [[ 1 < 109 ]]
++ echo 2
+ i=2
+ (( 2 != -1 ))
+ printf 'PhysRec=2 Date=20071101 File=Archive-Any-0.092.tar.gz CS= AP=0
\n'
PhysRec=2 Date=20071101 File=Archive-Any-0.092.tar.gz CS= AP=0
++ rec_next 2
++ local -i i=2
++ [[ 2 != -1 ]]
++ [[ 2 < 109 ]]
++ echo -1
+ i=-1
+ (( -1 != -1 ))
I use a variable to set the level of debugging
--debug=|--debug|-d) declare -i fDEBUG=1
declare -i fVerbose=1
unset fQuiet
if [[ $3 == [1-9] ]]; then
fDEBUG=$3
shift 1
fi
;;
If the fDEBUG variable is set to 3, less or not declared at all, example
two applies, otherwise example 1 applies.
It has worked with previous version of bash, so I suspect that it's a
bash error.
Can you help?
Kind regards
Frans de Boer.
- Comparison failure,
Frans de Boer <=
Re: Comparison failure, Pierre Gaston, 2008/01/10