From d959f5add7dd605d880af993a9f02ae08dfae11b Mon Sep 17 00:00:00 2001 From: Wenchao Hao Date: Tue, 15 Feb 2022 15:51:12 +0800 Subject: [PATCH] Fix rescan-scsi-bus.sh -r remove valid disks Signed-off-by: Wenchao Hao (cherry picked from commit e239ad2a49e07f34d4ac6337ffd978a6167acda4) --- ...sh-apply-fix-for-r-from-https-github.patch | 43 +++++++++++++++++++ sg3_utils.spec | 6 ++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 0006-rescan-scsi-bus.sh-apply-fix-for-r-from-https-github.patch diff --git a/0006-rescan-scsi-bus.sh-apply-fix-for-r-from-https-github.patch b/0006-rescan-scsi-bus.sh-apply-fix-for-r-from-https-github.patch new file mode 100644 index 0000000..f5772e6 --- /dev/null +++ b/0006-rescan-scsi-bus.sh-apply-fix-for-r-from-https-github.patch @@ -0,0 +1,43 @@ +From fc72119f67614152d635452856ec9894474599e4 Mon Sep 17 00:00:00 2001 +From: Douglas Gilbert +Date: Mon, 3 Jan 2022 17:49:24 +0000 +Subject: [PATCH] rescan-scsi-bus.sh: apply fix for '-r' from + https://github.com/doug-gilbert/sg3_utils/pull/10/ from Nitin U. Yewale, + broken by rev 867 + +git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@929 6180dd3e-e324-4e3e-922d-17de1ae2f315 +Conflict: only keep rescan-scsi-bus's changes, change of following files +are removed: + BSD_LICENSE + CREDITS + ChangeLog + debian/changelog + doc/rescan-scsi-bus.sh.8 + doc/sg3_utils.8 + sg3_utils.spec + + --- + scripts/rescan-scsi-bus.sh | 6 ++++++ + 1 file changed, 6 insertions(+) + + diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh + index 16a7642..57fbe66 100755 + --- a/scripts/rescan-scsi-bus.sh + +++ b/scripts/rescan-scsi-bus.sh + @@ -307,7 +307,13 @@ testonline () + IPREV=$(echo "$INQ" | grep 'Product revision level:' | sed 's/^[^:]*: \(.*\)$/\1/') + STR=$(printf " Vendor: %-08s Model: %-16s Rev: %-4s" "$IVEND" "$IPROD" "$IPREV") + IPTYPE=$(echo "$INQ" | sed -n 's/.* Device_type=\([0-9]*\) .*/\1/p') + + if [ -z "$IPTYPE" ]; then + + IPTYPE=$(echo "$INQ" | sed -n 's/.* PDT=\([0-9]*\) .*/\1/p') + + fi + IPQUAL=$(echo "$INQ" | sed -n 's/ *PQual=\([0-9]*\) Device.*/\1/p') + + if [ -z "$IPQUAL" ] ; then + + IPQUAL=$(echo "$INQ" | sed -n 's/ *PQual=\([0-9]*\) PDT.*/\1/p') + + fi + if [ "$IPQUAL" != 0 ] ; then + [ -z "$IPQUAL" ] && IPQUAL=3 + [ -z "$IPTYPE" ] && IPTYPE=31 + -- + 2.34.1 + diff --git a/sg3_utils.spec b/sg3_utils.spec index fbf130c..efe74a2 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -1,6 +1,6 @@ Name: sg3_utils Version: 1.46 -Release: 2 +Release: 3 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 @@ -12,6 +12,7 @@ Patch2: 0002-bugfix-sg3_utils-fix-syntax-error.patch Patch3: 0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch Patch4: 0004-sg3_utils-fix-memset-coredump.patch Patch5: 0005-sg3_utils-rescan-scsi-bus-list-all-LUNs-in-one-line.patch +Patch6: 0006-rescan-scsi-bus.sh-apply-fix-for-r-from-https-github.patch Provides: %{name}-libs Obsoletes: %{name}-libs @@ -75,6 +76,9 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la %{_mandir}/man8/* %changelog +* Tue Feb 15 2022 Wenchao Hao -1.46-3 +- Fix rescan-scsi-bus.sh -r remove valid disks + * Sat Jan 29 2022 Zhiqiang Liu -1.46-2 - rescan scsi bus list all LUNs in one line -- Gitee