From 64aa40b175af965e626d9ec4c39004623aae408f Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Tue, 28 Jul 2009 21:39:02 +0000 Subject: [PATCH] found the bug, gawk creates an array item if you test for its presence using array[1] != "" even when it didn't exist, bad gawk, bad --- inxi | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/inxi b/inxi index 8ec894b..93bb22f 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.0.105-b1 +#### version: 1.0.106-b1 #### Date: 28 July 2009 ######################################################################## #### SPECIAL THANKS @@ -3013,7 +3013,6 @@ get_sensors_data() eval $LOGFS local sample=" - " # echo "$sample"| gawk -v userCpuNo="$SENSORS_CPU_NO" ' @@ -3182,13 +3181,14 @@ local sample=" else { moboTempReal=temp2 } - # then set the cpu fan speed if ( aFanReal[1] == "" ) { - if ( tempFanType == 1 && aFanWorking[1] != "" ) { + # note, you cannot test for aFanWorking[1] or [2] != "" + # because that creates an array item in gawk just by the test itself + if ( tempFanType == 1 && 1 in aFanWorking ) { aFanReal[1]=aFanWorking[1] } - else if ( tempFanType == 2 && aFanWorking[2] != "" ) { + else if ( tempFanType == 2 && 2 in aFanWorking ) { aFanReal[1]=aFanWorking[2] } } @@ -3201,7 +3201,7 @@ local sample=" if ( ! 3 in aFanReal ) { aFanReal[3] = "" } - + # then we need to get the actual numeric max array count for both fan arrays for (i = 0; i <= 14; i++) { if ( i in aFanReal && i > indexCountaFanReal ) { @@ -3213,8 +3213,6 @@ local sample=" indexCountaFanWorking=i } } - print "icafw: " indexCountaFanWorking - print "icafr: " indexCountaFanReal # clear out any duplicates. Primary fan real trumps fan working always if same speed for (i = 1; i <= indexCountaFanReal; i++) {