From efb7296efd4e09afcbe3e142d003ff78e5688b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Fri, 14 Sep 2012 15:35:23 +0200 Subject: [PATCH] add fix for sg3_utils >= 1.32 to the rescan-scsi-bus script --- rescan-scsi-bus-fixes.patch | 41 +++++++++++++++++++++++++++++++++++++ sg3_utils.spec | 8 +++++++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 rescan-scsi-bus-fixes.patch diff --git a/rescan-scsi-bus-fixes.patch b/rescan-scsi-bus-fixes.patch new file mode 100644 index 0000000..1c95e21 --- /dev/null +++ b/rescan-scsi-bus-fixes.patch @@ -0,0 +1,41 @@ +From 64d876bf70c392390ac83a986b14f889c2a03741 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dan=20Hor=C3=A1k?= +Date: Fri, 14 Sep 2012 15:19:08 +0200 +Subject: [PATCH] fix for sg3_utils >= 1.32 + +sg_inq in sg3_utils 1.32 comes with version 1.01 while rescan-scsi-bus expects 0.xy +and thus throws an error about non-integer expression + +[dan@eagle ~]$ LANG=en_US.UTF-8 rescan-scsi-bus.sh ++ test @ = @--help -o @ = @-h -o @ = '@-?' ++ test '!' -d /sys/class/scsi_host/ -a '!' -d /proc/scsi/ ++ modprobe sg ++ test -x /usr/bin/sg_inq +++ sg_inq -V +++ cut -d ' ' -f 3 ++ sg_version=1.03 ++ sg_version=1.03 ++ '[' -z 1.03 -o 1.03 -lt 70 ']' +/usr/bin/rescan-scsi-bus.sh: line 532: [: 1.03: integer expression expected ++ sg_len_arg=--len=36 ++ unsetcolor +--- + rescan-scsi-bus.sh | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/rescan-scsi-bus.sh b/rescan-scsi-bus.sh +index 09744bb..e3b80d0 100644 +--- a/rescan-scsi-bus.sh ++++ b/rescan-scsi-bus.sh +@@ -623,7 +623,7 @@ modprobe sg >/dev/null 2>&1 + + if test -x /usr/bin/sg_inq; then + sg_version=$(sg_inq -V 2>&1 | cut -d " " -f 3) +- sg_version=${sg_version##0.} ++ sg_version=${sg_version/./} + #echo "\"$sg_version\"" + if [ -z "$sg_version" -o "$sg_version" -lt 70 ] ; then + sg_len_arg="-36" +-- +1.7.7.6 + diff --git a/sg3_utils.spec b/sg3_utils.spec index d26a934..bc8df5e 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -4,11 +4,12 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.33 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ and BSD Group: Applications/System Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tgz Source1: http://www.garloff.de/kurt/linux/%{rescan_script}-%{rescan_version} +Patch0: rescan-scsi-bus-fixes.patch URL: http://sg.danny.cz/sg/sg3_utils.html BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: %{name}-libs = %{version}-%{release} @@ -50,6 +51,8 @@ developing applications. # rescan-scsi-bus.sh cp -p %{SOURCE1} %{rescan_script} +# apply fixes +%patch0 -p1 %build @@ -97,6 +100,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Fri Sep 14 2012 Dan HorĂ¡k - 1.33-4 +- add fix for sg3_utils >= 1.32 to the rescan-scsi-bus script + * Sat Jul 21 2012 Fedora Release Engineering - 1.33-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild