diff --git a/RHEL-111346-rescan-scsi-bus.sh-Correctly-read-RMB-bit-on-enquiry.patch b/RHEL-111346-rescan-scsi-bus.sh-Correctly-read-RMB-bit-on-enquiry.patch new file mode 100644 index 0000000..95ab584 --- /dev/null +++ b/RHEL-111346-rescan-scsi-bus.sh-Correctly-read-RMB-bit-on-enquiry.patch @@ -0,0 +1,46 @@ +From bdd99d9be808ae55a4d4ff78357adfa9d3d5f0b3 Mon Sep 17 00:00:00 2001 +From: Paul Evans +Date: Wed, 28 Jan 2026 14:42:02 +0000 +Subject: [PATCH] rescan-scsi-bus.sh Correctly read RMB bit on enquiry + +Make changes to is_removable() in rescan-scsi-bus.sh to correctly +read the RMB byte on its hexedit enquiry response. + +As things stand the script incorrectly reads the first byte of the +repsonse the "Peripheral Qualifier" and will always return a device +as non-removable. + +Signed-off-by: Paul Evans +--- + scripts/rescan-scsi-bus.sh | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh +index e1363b66..2ccc316a 100755 +--- a/scripts/rescan-scsi-bus.sh ++++ b/scripts/rescan-scsi-bus.sh +@@ -4,7 +4,7 @@ + # (c) 2006--2018 Hannes Reinecke, GNU GPL v2 or later + # $Id: rescan-scsi-bus.sh,v 1.57 2012/03/31 14:08:48 garloff Exp $ + +-VERSION="20180615" ++VERSION="20260126" + SCAN_WILD_CARD=4294967295 + + setcolor () +@@ -242,9 +242,10 @@ is_removable () + + p=/sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/inquiry + # Extract the second byte of the INQUIRY response and check bit 7 (mask 0x80). +- b=$(hexdump -n1 -e '/1 "%02X"' "$p" 2>/dev/null) ++ b=$(od -j1 -N1 -An -t x1 "$p" 2>/dev/null) + if [ -n "$b" ]; then +- echo $(((0x$b & 0x80) != 0)) ++ # Handle od leading space with parameter substitution. ++ echo $(((0x${b// /} & 0x80) != 0)) + else + sg_inq /dev/$SGDEV 2>/dev/null | sed -n 's/^.*RMB=\([0-9]*\).*$/\1/p' + fi +-- +2.53.0 + diff --git a/sg3_utils.spec b/sg3_utils.spec index 2d2e789..e50910a 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -4,7 +4,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.47 -Release: 10%{?dist} +Release: 11%{?dist} License: GPLv2+ and BSD URL: https://sg.danny.cz/sg/sg3_utils.html Source0: https://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz @@ -33,6 +33,9 @@ Patch6: sg3_utils-1.48-sg_vpd_vendor-Fix-missing-newline-in-the-svpd_decode.pat # https://issues.redhat.com/browse/RHEL-29139 # 63-scsi-sg3_symlink.rules sets up symlinks for multipath paths Patch7: 63-scsi-sg3_symlink.rules-DM_MULTIPATH_DEVICE_PATH-skip.patch +# https://redhat.atlassian.net/browse/RHEL-122982 +Patch8: RHEL-111346-rescan-scsi-bus.sh-Correctly-read-RMB-bit-on-enquiry.patch + Requires: %{name}-libs%{?_isa} = %{version}-%{release} BuildRequires: make @@ -129,6 +132,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT%{_udevlibdir} %changelog +* Wed Mar 25 2026 Paul Evans - 1.47-11 +- rescan-scsi-bus.sh Correctly read RMB bit on enquiry (RHEL-122982) + * Tue Nov 05 2024 Tomas Bzatek - 1.47-10 - Skip symlink generation for multipath (RHEL-29139)