update 0002-bugfix-sg3_utils-fix-syntax-error.patch.

This commit is contained in:
Markeryang 2020-07-17 16:07:58 +08:00 committed by Gitee
parent 7eab0b1e92
commit 1caf77ddd2

View File

@ -1,58 +1,56 @@
From eabadd8e6a20252b8ff2f7fde35fd0976a421be8 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Wed, 20 Mar 2019 21:04:34 +0800
Subject: [PATCH] sg3_utils: fix syntax error
From 1d2cf4e2a477646b212b25d6d6be5fee99e20bdb Mon Sep 17 00:00:00 2001
From: sunshihao <sunshihao@huawei.com>
Date: Thu, 16 Apr 2020 10:53:25 +0800
Subject: [PATCH 3/4] bugfix-sg3_utils-fix-syntax-error
reason: when some variable not set, test its value, it will show
"test: =: unary operator expected" error message
---
scripts/rescan-scsi-bus.sh | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 4fa5e6c..9bfd3be 100755
index b1cbebc..25a5f2a 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -85,10 +85,10 @@ findhosts ()
@@ -83,10 +83,10 @@ findhosts ()
hosts=
for driverdir in /proc/scsi/*; do
driver=${driverdir#/proc/scsi/}
- if test $driver = scsi -o $driver = sg -o $driver = dummy -o $driver = device_info; then continue; fi
+ if test x$driver = xscsi -o x$driver = xsg -o x$driver = xdummy -o x$driver = xdevice_info; then continue; fi
- if [ "$driver" = scsi ] || [ "$driver" = sg ] || [ "$driver" = dummy ] || [ "$driver" = device_info ] ; then continue; fi
+ if [ "$driver" = xscsi ] || [ "$driver" = xsg ] || [ "$driver" = xdummy ] || [ "$driver" = xdevice_info ] ; then continue; fi
for hostdir in $driverdir/*; do
name=${hostdir#/proc/scsi/*/}
- if test $name = add_map -o $name = map -o $name = mod_parm; then continue; fi
+ if test x$name = xadd_map -o x$name = xmap -o x$name = xmod_parm; then continue; fi
- if [ "$name" = add_map ] || [ "$name" = map ] || [ "$name" = mod_parm ] ; then continue; fi
+ if [ "$name" = xadd_map ] || [ "$name" = xmap ] || [ "$name" = xmod_parm ] ; then continue; fi
num=$name
driverinfo=$driver
if test -r $hostdir/status; then
@@ -254,7 +254,7 @@ testonline ()
if [ -r "$hostdir/status" ] ; then
@@ -289,7 +289,7 @@ testonline ()
print_and_scroll_back "$host:$channel:$id:$lun $SGDEV ($RMB) "
test $RC = 2 -a "$RMB" = "1" && break
[ $RC = 2 ] && [ "$RMB" = "1" ] && break
done
- if test $ctr != 0; then white_out; fi
+ if test x$ctr != x0; then white_out; fi
- if [ $ctr != 0 ] ; then
+ if [ $xctr != x0 ] ; then
white_out
fi
# echo -e "\e[A\e[A\e[A${yellow}Test existence of $SGDEV = $RC ${norm} \n\n\n"
if test $RC = 1; then return $RC; fi
# Reset RC (might be !=0 for passive paths)
@@ -512,7 +512,7 @@ dolunscan()
@@ -569,7 +569,7 @@ dolunscan()
# Device not present
printf "\r\e[A";
# Optimization: if lun==0, stop here (only if in non-remove mode)
- if test $lun = 0 -a -z "$remove" -a $optscan = 1; then
+ if test x$lun = x0 -a -z "$remove" -a x$optscan = x1; then
break;
- if [ "$lun" = 0 ] && [ -z "$remove" ] && [ "$optscan" = 1 ] ; then
+ if [ "x$lun" = x0 ] && [ -z "$remove" ] && [ "x$optscan" = x1 ] ; then
return 1;
fi
else
@@ -1193,7 +1193,7 @@ if [ -d /sys/class/scsi_host -a ! -w /sys/class/scsi_host ]; then
fi
if test "$sync" = 1 -a "$remove" = 1; then sync=2; fi
if test "$sync" = 2; then echo "Syncing file systems"; sync; fi
-if test -w /sys/module/scsi_mod/parameters/default_dev_flags -a $scan_flags != 0; then
+if test -w /sys/module/scsi_mod/parameters/default_dev_flags -a x$scan_flags != x0; then
OLD_SCANFLAGS=`cat /sys/module/scsi_mod/parameters/default_dev_flags`
NEW_SCANFLAGS=$(($OLD_SCANFLAGS|$scan_flags))
if test "$OLD_SCANFLAGS" != "$NEW_SCANFLAGS"; then
else
@@ -1283,7 +1283,7 @@ if [ "$sync" = 2 ] ; then
echo "Syncing file systems"
sync
fi
-if [ -w /sys/module/scsi_mod/parameters/default_dev_flags ] && [ $scan_flags != 0 ] ; then
+if [ -w /sys/module/scsi_mod/parameters/default_dev_flags ] && [ x$scan_flags != x0 ] ; then
OLD_SCANFLAGS=$(cat /sys/module/scsi_mod/parameters/default_dev_flags)
NEW_SCANFLAGS=$((OLD_SCANFLAGS|scan_flags))
if [ "$OLD_SCANFLAGS" != "$NEW_SCANFLAGS" ] ; then
--
2.19.1