Blame SOURCES/sg3_utils-1.48-rescan-scsi-bus.sh_seq_-s.patch

973e8e
From 9939d8d804d0ce423824836173c296daf4e13e99 Mon Sep 17 00:00:00 2001
973e8e
From: Douglas Gilbert <dgilbert@interlog.com>
973e8e
Date: Mon, 7 Feb 2022 16:02:32 +0000
973e8e
Subject: [PATCH] rescan-scsi-bus.sh: Use "seq -s"
973e8e
973e8e
Since the commit [git: 8c86fe2; svn rev 815  "library: add to '.so' name;
973e8e
rescan-scsi-bus: multiple patches to sync with Suse], we correctly use
973e8e
quoting when we print $idsearch or $lunsearch. This causes a change in
973e8e
the output of the script, because these number lists are generated by
973e8e
the GNU seq utility, which uses "\n" as default separator, and the
973e8e
quoting now causes the newlines to be preserved. Use "seq -s" to
973e8e
generate space-separated lists instead.
973e8e
973e8e
973e8e
973e8e
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@936 6180dd3e-e324-4e3e-922d-17de1ae2f315
973e8e
---
973e8e
 ChangeLog                  |  4 +++-
973e8e
 scripts/rescan-scsi-bus.sh | 12 ++++++------
973e8e
 2 files changed, 9 insertions(+), 7 deletions(-)
973e8e
973e8e
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
973e8e
index e4eeef1..78544b1 100755
973e8e
--- a/scripts/rescan-scsi-bus.sh
973e8e
+++ b/scripts/rescan-scsi-bus.sh
973e8e
@@ -716,7 +716,7 @@ expandlist ()
973e8e
       result="$result $beg";
973e8e
     else
973e8e
       end=${first#*-}
973e8e
-      result="$result $(seq $beg $end)"
973e8e
+      result="$result $(seq -s ' ' $beg $end)"
973e8e
     fi
973e8e
     [ "$rest" = "$first" ] && rest=""
973e8e
     first=${rest%%,*}
973e8e
@@ -1200,7 +1200,7 @@ fi
973e8e
 unsetcolor
973e8e
 debug=0
973e8e
 lunsearch=
973e8e
-opt_idsearch=$(seq 0 7)
973e8e
+opt_idsearch=$(seq -s ' ' 0 7)
973e8e
 filter_ids=0
973e8e
 opt_channelsearch=
973e8e
 remove=
973e8e
@@ -1227,13 +1227,13 @@ while [ ! -z "$opt" ] && [ -z "${opt##-*}" ] ; do
973e8e
     f) flush=1 ;;
973e8e
     i) lipreset=0 ;;
973e8e
     I) shift; lipreset=$opt ;;
973e8e
-    l) lunsearch=$(seq 0 7) ;;
973e8e
-    L) lunsearch=$(seq 0 "$2"); shift ;;
973e8e
+    l) lunsearch=$(seq -s ' ' 0 7) ;;
973e8e
+    L) lunsearch=$(seq -s ' ' 0 "$2"); shift ;;
973e8e
     m) mp_enable=1 ;;
973e8e
     r) remove=1 ;;
973e8e
     s) resize=1; mp_enable=1 ;;
973e8e
     u) update=1 ;;
973e8e
-    w) opt_idsearch=$(seq 0 15) ;;
973e8e
+    w) opt_idsearch=$(seq -s ' ' 0 15) ;;
973e8e
     -alltargets)  existing_targets=;;
973e8e
     -attachpq3) scan_flags=$((scan_flags|0x1000000)) ;;
973e8e
     -channels=*)  arg=${opt#-channels=};opt_channelsearch=$(expandlist "$arg") ;;
973e8e
@@ -1257,7 +1257,7 @@ while [ ! -z "$opt" ] && [ -z "${opt##-*}" ] ; do
973e8e
     -sparselun) scan_flags=$((scan_flags|0x40)) ;;
973e8e
     -sync) sync=2 ;;
973e8e
     -update) update=1;;
973e8e
-    -wide) opt_idsearch=$(seq 0 15) ;;
973e8e
+    -wide) opt_idsearch=$(seq -s ' ' 0 15) ;;
973e8e
     *) echo "Unknown option -$opt !" ;;
973e8e
   esac
973e8e
   shift