On Thu, 2016-01-21 at 15:33 +0530, Ritesh Raj Sarraf wrote:
> 
> I think the best would be that we patch sg3-utils to use sleep
> instead.
> 
> sleep is part of coreutils which is very standardized on Linux. I'll
> also check on my BSD VMs.
> 
> sleep also supports arguments in decimal format. So a 20000 microsecs
> equals to 0.02 secs, which sleep takes happily on Linux.

So I verified it on Debian GNU/Linux and GNU/kFreeBSD. On both
platforms, sleep is provided by coreutils.


I think the attached patch is simple enough and shouldn't break
anywhere.


Doug,

Does this change look okay to you? Will you apply it on your tree ?
You can access the full bug report here:
http://bugs.debian.org/812184

-- 
Ritesh Raj Sarraf
RESEARCHUT - http://www.researchut.com
"Necessity is the mother of invention."

Debian Bug: 812184

usleep is not part of any standard tool.
sleep, which can do the same functions, is part of coreutils on Linux. Something which every distribution will have.

I also verified it on Debian kFreeBSD. And coreutils was available.
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -247,7 +247,7 @@
   fi
   while test $RC = 2 -o $RC = 6 && test $ctr -le 8; do
     if test $RC = 2 -a "$RMB" != "1"; then echo -n "."; let LN+=1; sleep 1
-    else usleep 20000; fi
+    else sleep 0.02; fi
     let ctr+=1
     sg_turs /dev/$SGDEV >/dev/null 2>&1
     RC=$?
@@ -411,7 +411,7 @@
     /sbin/udevsettle
     white_out
   else
-    usleep 20000
+    sleep 0.02
   fi
 }
 
@@ -473,7 +473,7 @@
           incrrmvd "$host:$channel:$id:$lun"
         fi
         echo 1 > /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/delete
-        usleep 20000
+        sleep 0.02
       else
         echo "scsi remove-single-device $devnr" > /proc/scsi/scsi
         if test $RC -eq 1 -o $lun -eq 0 ; then
@@ -941,7 +941,7 @@
       elif test $i -eq $flush_retries ; then
         echo "Fail"
       fi
-      usleep 20000
+      sleep 0.02
       let i=$i+1
     done
   done

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to