fix scanning progress output

This commit is contained in:
cenhuilin 2024-03-21 10:18:27 +08:00
parent 5e7a3fbd34
commit 11a4e49f07
2 changed files with 76 additions and 1 deletions

View File

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

View File

@ -1,6 +1,6 @@
Name: sg3_utils
Version: 1.45
Release: 11
Release: 12
Summary: Utilities that send SCSI commands to devices.
License: GPL-2.0-or-later AND BSD
URL: http://sg.danny.cz/sg/sg3_utils.html
@ -16,6 +16,7 @@ Patch6: 0006-rescan-scsi-bus-sgdevice26-do-not-traverse-sg-class-.patch
Patch7: 0007-rescan-scsi-bus.sh-add-option-no-lip-scan.patch
Patch8: 0008-rescan-scsi-bus.sh-speed-testonline.patch
Patch9: 0009-rescan-scsi-bus-speed-large-multipath-scans.patch
Patch10: 0010-rescan-scsi-bus.sh_seq_-s.patch
Provides: %{name}-libs
Obsoletes: %{name}-libs
@ -79,6 +80,9 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la
%{_mandir}/man8/*
%changelog
* Wed Mar 20 2024 cenhuilin <cenhuilin@kylinos.cn> - 1.45-12
- fix scanning progress output
* Wed Nov 29 2023 wuguanghao <wuguanghao3@huawei.com> - 1.45-11
- fix rescan-scsi-bus.sh syntax error