diff --git a/0000-sg3_utils-1.37-dont-open-dev-snapshot.patch b/0000-sg3_utils-1.37-dont-open-dev-snapshot.patch deleted file mode 100644 index 2fbfe3a7e05703cd7266cfabc33ee15e39db2923..0000000000000000000000000000000000000000 --- a/0000-sg3_utils-1.37-dont-open-dev-snapshot.patch +++ /dev/null @@ -1,27 +0,0 @@ -From a0569d83929d98c0a175bc3992352c2c8d09ffa4 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Dan=20Hor=C3=A1k?= -Date: Fri, 18 Oct 2013 12:38:05 +0200 -Subject: [PATCH] don't open /dev/snapshot in sginfo (#920687) - -see https://bugzilla.redhat.com/show_bug.cgi?id=920687 for details ---- - src/sginfo.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/sginfo.c b/src/sginfo.c -index b27f117..1f2151d 100644 ---- a/src/sginfo.c -+++ b/src/sginfo.c -@@ -3408,6 +3408,9 @@ show_devices(int raw) - if ( isdigit(entry->d_name[strlen(entry->d_name)-1]) ) { - continue; - } -+ if ( strncmp("snapshot",entry->d_name,8) == 0 ) { -+ continue; -+ } - - snprintf(dev_name, sizeof(dev_name),"/dev/%s",entry->d_name); - --- -1.8.1.4 - diff --git a/0001-sg3_utils-1.42-sysmacros.patch b/0001-sg3_utils-1.42-sysmacros.patch deleted file mode 100644 index 5633653bdf9a636f32901b847be2882e37faf431..0000000000000000000000000000000000000000 --- a/0001-sg3_utils-1.42-sysmacros.patch +++ /dev/null @@ -1,132 +0,0 @@ -diff --git a/lib/sg_pt_linux.c b/lib/sg_pt_linux.c -index 76773fa..914570b 100644 ---- a/lib/sg_pt_linux.c -+++ b/lib/sg_pt_linux.c -@@ -18,8 +18,11 @@ - #include - #include - #include --#include - #include -+#include /* to define 'major' */ -+#ifndef major -+#include -+#endif - - - #ifdef HAVE_CONFIG_H -diff --git a/src/sg_dd.c b/src/sg_dd.c -index 97a6f77..7bb5eed 100644 ---- a/src/sg_dd.c -+++ b/src/sg_dd.c -@@ -44,13 +44,15 @@ - #define __STDC_FORMAT_MACROS 1 - #include - #include --#include - #include --#include - #include - #include --#include -+#include -+#ifndef major -+#include -+#endif - #include /* */ -+#include - - #ifdef HAVE_CONFIG_H - #include "config.h" -diff --git a/src/sg_map26.c b/src/sg_map26.c -index 7739592..8e583d2 100644 ---- a/src/sg_map26.c -+++ b/src/sg_map26.c -@@ -33,8 +33,11 @@ - #include - #include - #include --#include - #include -+#include /* new location for major + minor */ -+#ifndef major -+#include -+#endif - #include - - #ifdef HAVE_CONFIG_H -diff --git a/src/sg_read.c b/src/sg_read.c -index 2cf8212..1eb0411 100644 ---- a/src/sg_read.c -+++ b/src/sg_read.c -@@ -36,9 +36,11 @@ - #define __STDC_FORMAT_MACROS 1 - #include - #include --#include - #include - #include -+#ifndef major -+#include -+#endif - #include - #include - #include -diff --git a/src/sg_xcopy.c b/src/sg_xcopy.c -index 11206ac..49b4341 100644 ---- a/src/sg_xcopy.c -+++ b/src/sg_xcopy.c -@@ -47,11 +47,13 @@ - #define __STDC_FORMAT_MACROS 1 - #include - #include --#include - #include --#include - #include - #include -+#include -+#ifndef major -+#include -+#endif - #include - #include /* */ - -diff --git a/src/sgm_dd.c b/src/sgm_dd.c -index 4e40acc..edf4861 100644 ---- a/src/sgm_dd.c -+++ b/src/sgm_dd.c -@@ -48,11 +48,13 @@ - #define __STDC_FORMAT_MACROS 1 - #include - #include --#include - #include --#include --#include - #include -+#include -+#include -+#ifndef major -+#include -+#endif - #include - #include /* */ - -diff --git a/src/sgp_dd.c b/src/sgp_dd.c -index 1ebecca..be9547b 100644 ---- a/src/sgp_dd.c -+++ b/src/sgp_dd.c -@@ -43,9 +43,11 @@ - #define __STDC_FORMAT_MACROS 1 - #include - #include --#include - #include - #include -+#ifndef major -+#include -+#endif - #include - #include - #include /* */ diff --git a/0002-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch b/0002-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch deleted file mode 100644 index 2973477c267afb0e6656fe8acb329ddcd2736016..0000000000000000000000000000000000000000 --- a/0002-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 16041ee..74d5683 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -734,7 +734,12 @@ findremapped() - remapped=0 - id_serial=`udevadm info -q all -n $sddev | grep "ID_SERIAL=" | cut -d"=" -f2` - [ -z "$id_serial" ] && id_serial="none" -- if [ "$id_serial_old" != "$id_serial" ] ; then -+ dm_name=`cat /sys/class/scsi_device/$hctl/device/block/$sddev/holders/*/dm/name 2>/dev/null` -+ [ -z "$dm_name" ] && dm_name=$id_serial -+ if [ "$id_serial_old" != "$id_serial" -o "$id_serial_old" != "$dm_name" ] ; then -+ echo "$hctl id_serial_old=$id_serial_old" -+ echo "$hctl id_serial=$id_serial" -+ echo "$hctl dm_name=$dm_name" - remapped=1 - fi - # If udev events updated the disks already, but the multipath device isn't update diff --git a/0003-sg3_utils-1.37-rescan-downpress.patch b/0003-sg3_utils-1.37-rescan-downpress.patch deleted file mode 100644 index 24266086ca0b840e75628193cfc29bc3888d5221..0000000000000000000000000000000000000000 --- a/0003-sg3_utils-1.37-rescan-downpress.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 16041ee..e411fd2 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -713,6 +713,7 @@ findremapped() - rm -f $tmpfile - fi - -+ echo -n "Triggering udev to update device information... " - # Get all of the ID_SERIAL attributes, after finding their sd node - for hctl in $devs ; do - if [ -d /sys/class/scsi_device/$hctl/device/block ] ; then -@@ -720,12 +721,14 @@ findremapped() - id_serial_old=`udevadm info -q all -n $sddev | grep "ID_SERIAL=" | cut -d"=" -f2` - [ -z "$id_serial_old" ] && id_serial_old="none" - echo "$hctl $sddev $id_serial_old" >> $tmpfile -+ udevadm trigger --name-match=$sddev -+ sleep 0.01 - fi - done - - # Trigger udev to update the info -- echo -n "Triggering udev to update device information... " -- /sbin/udevadm trigger -+ #echo -n "Triggering udev to update device information... " -+ #/sbin/udevadm trigger - udevadm_settle 2>&1 /dev/null - echo "Done" - diff --git a/0004-bugfix-sg3_utils-fix-syntax-error.patch b/0004-bugfix-sg3_utils-fix-syntax-error.patch deleted file mode 100644 index 2114ff139ff6fa16808ba1ffa360cce87896f595..0000000000000000000000000000000000000000 --- a/0004-bugfix-sg3_utils-fix-syntax-error.patch +++ /dev/null @@ -1,58 +0,0 @@ -From eabadd8e6a20252b8ff2f7fde35fd0976a421be8 Mon Sep 17 00:00:00 2001 -From: root -Date: Wed, 20 Mar 2019 21:04:34 +0800 -Subject: [PATCH] sg3_utils: fix syntax error - -reason: when some variable not set, test its value, it will show -"test: =: unary operator expected" error message ---- - scripts/rescan-scsi-bus.sh | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 4fa5e6c..9bfd3be 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -85,10 +85,10 @@ findhosts () - hosts= - for driverdir in /proc/scsi/*; do - driver=${driverdir#/proc/scsi/} -- if test $driver = scsi -o $driver = sg -o $driver = dummy -o $driver = device_info; then continue; fi -+ if test x$driver = xscsi -o x$driver = xsg -o x$driver = xdummy -o x$driver = xdevice_info; then continue; fi - for hostdir in $driverdir/*; do - name=${hostdir#/proc/scsi/*/} -- if test $name = add_map -o $name = map -o $name = mod_parm; then continue; fi -+ if test x$name = xadd_map -o x$name = xmap -o x$name = xmod_parm; then continue; fi - num=$name - driverinfo=$driver - if test -r $hostdir/status; then -@@ -254,7 +254,7 @@ testonline () - print_and_scroll_back "$host:$channel:$id:$lun $SGDEV ($RMB) " - test $RC = 2 -a "$RMB" = "1" && break - done -- if test $ctr != 0; then white_out; fi -+ if test x$ctr != x0; then white_out; fi - # echo -e "\e[A\e[A\e[A${yellow}Test existence of $SGDEV = $RC ${norm} \n\n\n" - if test $RC = 1; then return $RC; fi - # Reset RC (might be !=0 for passive paths) -@@ -512,7 +512,7 @@ dolunscan() - # Device not present - printf "\r\e[A"; - # Optimization: if lun==0, stop here (only if in non-remove mode) -- if test $lun = 0 -a -z "$remove" -a $optscan = 1; then -+ if test x$lun = x0 -a -z "$remove" -a x$optscan = x1; then - break; - fi - else -@@ -1193,7 +1193,7 @@ if [ -d /sys/class/scsi_host -a ! -w /sys/class/scsi_host ]; then - fi - if test "$sync" = 1 -a "$remove" = 1; then sync=2; fi - if test "$sync" = 2; then echo "Syncing file systems"; sync; fi --if test -w /sys/module/scsi_mod/parameters/default_dev_flags -a $scan_flags != 0; then -+if test -w /sys/module/scsi_mod/parameters/default_dev_flags -a x$scan_flags != x0; then - OLD_SCANFLAGS=`cat /sys/module/scsi_mod/parameters/default_dev_flags` - NEW_SCANFLAGS=$(($OLD_SCANFLAGS|$scan_flags)) - if test "$OLD_SCANFLAGS" != "$NEW_SCANFLAGS"; then --- -2.19.1 - diff --git a/0005-sg_inq-fix-potential-unbounded-loop-in-export.patch b/0005-sg_inq-fix-potential-unbounded-loop-in-export.patch deleted file mode 100644 index 70b15050625b59b53d83aa9f947df1a07c572759..0000000000000000000000000000000000000000 --- a/0005-sg_inq-fix-potential-unbounded-loop-in-export.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 96055f3a30d9643eff5141ed1926468301379c74 Mon Sep 17 00:00:00 2001 -From: Douglas Gilbert -Date: Fri, 8 Apr 2016 02:46:35 +0000 -Subject: [PATCH 016/126] sg_inq: fix potential unbounded loop in --export - -git-svn-id: svn://localhost/trunk@691 6180dd3e-e324-4e3e-922d-17de1ae2f315 ---- - src/sg_inq.c | 21 +++++++++++---------- - 1 files changed, 11 insertions(+), 10 deletions(-) - -diff --git a/src/sg_inq.c b/src/sg_inq.c -index 9dc8838..8aa1970 100644 ---- a/src/sg_inq.c -+++ b/src/sg_inq.c -@@ -43,7 +43,7 @@ - #include "sg_unaligned.h" - #include "sg_pr2serr.h" - --static const char * version_str = "1.57 20160208"; /* SPC-5 rev 08 */ -+static const char * version_str = "1.58 20160407"; /* SPC-5 rev 08 */ - - /* INQUIRY notes: - * It is recommended that the initial allocation length given to a -@@ -1032,17 +1032,18 @@ static int - encode_whitespaces(unsigned char *str, int inlen) - { - int k, res; -- int j = 0; -- int valid = 0; -+ int j; -+ bool valid = false; - int outlen = inlen, zeroes = 0; - - /* Skip initial whitespaces */ -- while (isblank(str[j])) -- j++; -- /* Skip possible unicode prefix characters */ -- while (str[j] < 0x20) -- j++; -- -+ for (j = 0; (j < inlen) && isblank(str[j]); ++j) -+ ; -+ if (j < inlen) { -+ /* Skip possible unicode prefix characters */ -+ for ( ; (j < inlen) && (str[j] < 0x20); ++j) -+ ; -+ } - k = j; - /* Strip trailing whitespaces */ - while ((outlen > k) && -@@ -1069,7 +1070,7 @@ encode_whitespaces(unsigned char *str, int inlen) - zeroes = 0; - } else { - str[res++] = str[k]; -- valid++; -+ valid = true; - zeroes = 0; - } - } --- -1.8.3.1 - diff --git a/0006-rescan-scsi-bus-dolunscan-break-to-return.patch b/0006-rescan-scsi-bus-dolunscan-break-to-return.patch deleted file mode 100644 index 67e1dcbe9e24d0b89549bc9d134a1d8f073ce3de..0000000000000000000000000000000000000000 --- a/0006-rescan-scsi-bus-dolunscan-break-to-return.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 48a93dc7dfc8b13f89b0a20ede711de2c54fd0fc Mon Sep 17 00:00:00 2001 -From: Doug Gilbert -Date: Fri, 13 Mar 2020 18:43:57 +0800 -Subject: [PATCH] rescan-scsi-bus-dolunscan-break-to-return - ---- - scripts/rescan-scsi-bus.sh | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 9bfd3be..8bee514 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -494,7 +494,7 @@ dolunscan() - if test -z "$SCSISTR" -a $RC != 1 -a "$remappedlun0" != "1"; then - printf "\r${red}DEL: $norm\r\n\n" - # In the event we're replacing with a well known node, we need to let it continue, to create the replacement node -- test "$remappedlun0" != "2" && return 1 -+ test "$remappedlun0" != "2" && return 2 - fi - fi - if test -z "$SCSISTR" -o -n "$remappedlun0"; then -@@ -513,7 +513,7 @@ dolunscan() - printf "\r\e[A"; - # Optimization: if lun==0, stop here (only if in non-remove mode) - if test x$lun = x0 -a -z "$remove" -a x$optscan = x1; then -- break; -+ return 1; - fi - else - if test "$remappedlun0" != "2" ; then -@@ -521,6 +521,7 @@ dolunscan() - fi - fi - fi -+ return 0; - } - - # Perform report lun scan on $host $channel $id using REPORT_LUNS -@@ -593,6 +594,7 @@ doreportlun() - if test $tmplun -eq $lun ; then - inlist=1 - dolunscan $lun0added -+ [ $? -eq 1 ] && break - else - newsearch="$newsearch $tmplun" - fi -@@ -609,6 +611,7 @@ doreportlun() - # Add new ones and check stale ones - for lun in $targetluns $lunremove; do - dolunscan $lun0added -+ [ $? -eq 1 ] && break - done - } - -@@ -628,6 +631,7 @@ dosearch () - else - for lun in $lunsearch; do - dolunscan -+ [ $? -eq 1 ] && break - done - fi - done --- -1.8.3.1 - diff --git a/0007-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch b/0007-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch deleted file mode 100644 index 5e38c35a2275690fb5bd3c656c59560edce0088b..0000000000000000000000000000000000000000 --- a/0007-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 56fb49584c56afe1f222b3ee9fc12c7cfd079286 Mon Sep 17 00:00:00 2001 -From: wubo -Date: Tue, 27 Aug 2019 14:16:48 +0800 -Subject: [PATCH] rescan-scsi-bus.sh fix delete lun report error - ---- - scripts/rescan-scsi-bus.sh | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 4b23ba4..3f18403 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -434,7 +434,7 @@ dolunscan() - # Well known lun transition case. Only for Direct-Access devs (type 0) - # If block directory exists && and PQUAL != 0, we unmapped lun0 and just have a well-known lun - # If block directory doesn't exist && PQUAL == 0, we mapped a real lun0 -- if test $lun -eq 0 -a $IPTYPE -eq 0 ; then -+ if test x"$lun" = x0 -a x"$IPTYPE" = x0 ; then - if test $RC = 2 ; then - if test -e /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device; then - if test -d /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/block ; then -@@ -443,7 +443,7 @@ dolunscan() - RC=0 # Set this so the system leaves the existing well known lun alone. This is a lun 0 with no block directory - fi - fi -- elif test $RC = 0 -a $IPTYPE -eq 0; then -+ elif test $RC = 0 -a x"$IPTYPE" = x0; then - if test -e /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device; then - if test ! -d /sys/class/scsi_device/${host}:${channel}:${id}:${lun}/device/block ; then - remappedlun0=1 # Transition from well-known to real lun 0 -@@ -455,7 +455,7 @@ dolunscan() - - # Special case: lun 0 just got added (for reportlunscan), - # so make sure we correctly treat it as new -- if test "$lun" = "0" -a "$1" = "1" -a -z "$remappedlun0"; then -+ if test x"$lun" = x"0" -a "$1" = "1" -a -z "$remappedlun0"; then - SCSISTR="" - printf "\r\e[A\e[A\e[A" - fi -@@ -478,7 +478,7 @@ dolunscan() - sleep 0.02 - else - echo "scsi remove-single-device $devnr" > /proc/scsi/scsi -- if test $RC -eq 1 -o $lun -eq 0 ; then -+ if test $RC -eq 1 -o x"$lun" = x0 ; then - # Try readding, should fail if device is gone - echo "scsi add-single-device $devnr" > /proc/scsi/scsi - fi --- -1.8.3.1 - diff --git a/sg3_utils-1.42.tar.xz b/sg3_utils-1.42.tar.xz deleted file mode 100644 index c2ff11cbf0fec6d8d8cddf2df1801f27889b22e5..0000000000000000000000000000000000000000 Binary files a/sg3_utils-1.42.tar.xz and /dev/null differ diff --git a/sg3_utils-1.45.tgz b/sg3_utils-1.45.tgz new file mode 100644 index 0000000000000000000000000000000000000000..37b455419e34dda18e0f4e983f32f87b018e2f04 Binary files /dev/null and b/sg3_utils-1.45.tgz differ diff --git a/sg3_utils.spec b/sg3_utils.spec index ff5135c39cb681b746b07006c72b07347c4278d3..aa550abf74a639d7154dacffe067ba9aedf950c1 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -1,20 +1,11 @@ Name: sg3_utils -Version: 1.42 -Release: 12 +Version: 1.45 +Release: 1 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 Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz -Patch0: 0000-sg3_utils-1.37-dont-open-dev-snapshot.patch -Patch1: 0001-sg3_utils-1.42-sysmacros.patch -Patch2: 0002-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch -Patch3: 0003-sg3_utils-1.37-rescan-downpress.patch -Patch4: 0004-bugfix-sg3_utils-fix-syntax-error.patch -Patch5: 0005-sg_inq-fix-potential-unbounded-loop-in-export.patch -Patch6: 0006-rescan-scsi-bus-dolunscan-break-to-return.patch -Patch7: 0007-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch - Provides: %{name}-libs = %{version}-%{release} Obsoletes: %{name}-libs < %{version}-%{release} BuildRequires: gcc, git @@ -74,6 +65,9 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la %{_mandir}/man8/* %changelog +* Thu Jul 16 2020 yanglongkang - 1.45-1 +- update package to 1.45 + * Tue Jun 30 2020 Zhiqiang Liu - 1.42-12 - renumber patches.