sg3_utils icon indicating copy to clipboard operation
sg3_utils copied to clipboard

Numerical result out of range issue in rescan-scsi-bus.sh

Open ioriqqe opened this issue 6 years ago • 1 comments
trafficstars

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"
    
  •    printf "%02s" "$1"
    
    fi }

@@ -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
    

ioriqqe avatar Jan 25 '19 15:01 ioriqqe

This looks reasonable. Do you have a proper patch for us? I believe there are many more instances of luns being checked / compared / printed.

mwilck avatar Sep 12 '19 08:09 mwilck