sg3_utils
sg3_utils copied to clipboard
Numerical result out of range issue in rescan-scsi-bus.sh
In some situation,the lun of scsi device become a long numeric string(big than integer) and we hit "Numerical result out of range" warning while running rescan-scsi-bus.sh: ... /usr/bin/rescan-scsi-bus.sh: line 576: test: 13370438325000993144: integer expression expected Scanning for device 13 0 0 12644192649239960158 ... OLD: /usr/bin/rescan-scsi-bus.sh: line 132: printf: warning: 12644192649239960158: Numerical result out of range ...
Not sure why we got such a long numeric lun,still investigating. But anyway,I think it is better to handle the lun as String rather than Int in rescan-scsi-bus.sh ,i.e.: --- a/scripts/rescan-scsi-bus.sh +++ b/scripts/rescan-scsi-bus.sh @@ -128,7 +128,7 @@ print02i() if [ "$1" = "*" ] ; then echo "00" else
-
printf "%02i" "$1"
-
fi }printf "%02s" "$1"
@@ -622,7 +622,7 @@ doreportlun() inlist= # OK, is existing $lun (still) in reported list for tmplun in $targetluns; do
-
if test $tmplun -eq $lun ; then
-
if test "$tmplun" = "$lun" ; then inlist=1 dolunscan $lun0added else
This looks reasonable. Do you have a proper patch for us? I believe there are many more instances of luns being checked / compared / printed.