diff --git a/9000-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch b/0000-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch similarity index 100% rename from 9000-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch rename to 0000-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch diff --git a/9001-sg3_utils-1.37-rescan-downpress.patch b/0001-sg3_utils-1.37-rescan-downpress.patch similarity index 100% rename from 9001-sg3_utils-1.37-rescan-downpress.patch rename to 0001-sg3_utils-1.37-rescan-downpress.patch diff --git a/9002-bugfix-sg3_utils-fix-syntax-error.patch b/0002-bugfix-sg3_utils-fix-syntax-error.patch similarity index 100% rename from 9002-bugfix-sg3_utils-fix-syntax-error.patch rename to 0002-bugfix-sg3_utils-fix-syntax-error.patch diff --git a/9003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-err.patch b/0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch similarity index 88% rename from 9003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-err.patch rename to 0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch index 05375c1ba0fa53c40d1ffc83fc5fbf25855abe00..d4adb6a6120858ae3aedeec42cfe22dc734fe1bc 100644 --- a/9003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-err.patch +++ b/0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch @@ -16,7 +16,7 @@ index 25a5f2a..dc3026a 100755 # 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 [ "$lun" -eq 0 ] && [ $IPTYPE -eq 0 ] ; then -+ if [ "x$lun" -eq x0 ] && [ x$IPTYPE -eq 0 ] ; then ++ if [ x"$lun" = x0 ] && [ x$IPTYPE = x0 ] ; then if [ $RC = 2 ] ; then if [ -e "$devpath" ] ; then if [ -d "$devpath/block" ] ; then @@ -25,7 +25,7 @@ index 25a5f2a..dc3026a 100755 fi fi - elif [ $RC = 0 ] && [ $IPTYPE -eq 0 ] ; then -+ elif [ $RC = 0 ] && [ x$IPTYPE -eq x0 ] ; then ++ elif [ $RC = 0 ] && [ x$IPTYPE = x0 ] ; then if [ -e "$devpath" ] ; then if [ ! -d "$devpath/block" ] ; then remappedlun0=1 # Transition from well-known to real lun 0 @@ -34,7 +34,7 @@ index 25a5f2a..dc3026a 100755 # Special case: lun 0 just got added (for reportlunscan), # so make sure we correctly treat it as new - if [ "$lun" = "0" ] && [ "$1" = "1" ] && [ -z "$remappedlun0" ] ; then -+ if [ x"$lun" = x"0" ] && [ "$1" = "1" ] && [ -z "$remappedlun0" ] ; then ++ if [ x"$lun" = x"0" ] && [ x"$1" = x"1" ] && [ -z "$remappedlun0" ] ; then SCSISTR="" printf "\r\e[A\e[A\e[A" fi @@ -43,7 +43,7 @@ index 25a5f2a..dc3026a 100755 else echo "scsi remove-single-device $devnr" > /proc/scsi/scsi - if [ $RC -eq 1 ] || [ "$lun" -eq 0 ] ; then -+ if [ $RC -eq 1 ] || [ x"$lun" -eq x0 ] ; then ++ if [ $RC -eq 1 ] || [ x"$lun" = x0 ] ; then # Try readding, should fail if device is gone echo "scsi add-single-device $devnr" > /proc/scsi/scsi fi diff --git a/0004-sg3_utils-fix-memset-coredump.patch b/0004-sg3_utils-fix-memset-coredump.patch new file mode 100644 index 0000000000000000000000000000000000000000..ff6fdc5a6b687bc9e6d49d7308171dfec0859772 --- /dev/null +++ b/0004-sg3_utils-fix-memset-coredump.patch @@ -0,0 +1,29 @@ +From dd2a61c9551ac5d2ac0c5902172fd8312edc22cb Mon Sep 17 00:00:00 2001 +From: yanglongkang +Date: Tue, 9 Feb 2021 11:39:32 +0800 +Subject: [PATCH] sg3_utils: fix memset coredump + +alloc MX_ALLOC_LEN size mem to enc_stat_rsp for +solving coredump problem. + +Signed-off-by: yanglongkang +--- + src/sg_ses.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sg_ses.c b/src/sg_ses.c +index 23fc3b9..cf344b7 100644 +--- a/src/sg_ses.c ++++ b/src/sg_ses.c +@@ -5582,7 +5582,7 @@ main(int argc, char * argv[]) + enumerate_work(op); + goto early_out; + } +- enc_stat_rsp = sg_memalign(op->maxlen, 0, &free_enc_stat_rsp, false); ++ enc_stat_rsp = sg_memalign(MX_ALLOC_LEN, 0, &free_enc_stat_rsp, false); + if (NULL == enc_stat_rsp) { + pr2serr("Unable to get heap for enc_stat_rsp\n"); + goto err_out; +-- +1.8.3.1 + diff --git a/sg3_utils.spec b/sg3_utils.spec index 206d10ab61012cb0f550e9ea4dc01c0e4f055f48..9ca0c5f5e05b688041f624572f95ec56f2c0553f 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -1,19 +1,20 @@ Name: sg3_utils Version: 1.45 -Release: 0 +Release: 6 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 -Patch9000: 9000-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch -Patch9001: 9001-sg3_utils-1.37-rescan-downpress.patch -Patch9002: 9002-bugfix-sg3_utils-fix-syntax-error.patch -Patch9003: 9003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-err.patch +Patch0: 0000-sg3_utils-1.37-rescan-scsi-findremapped-enhance.patch +Patch1: 0001-sg3_utils-1.37-rescan-downpress.patch +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 Provides: %{name}-libs Obsoletes: %{name}-libs -BuildRequires: gcc, git +BuildRequires: gcc %description The sg3_utils package contains utilities that send SCSI commands to devices. As well as @@ -38,7 +39,7 @@ Requires: man This contains man files for the using of pciutils. %prep -%autosetup -Sgit -n %{name}-%{version} +%autosetup -n %{name}-%{version} -p1 %build %configure --disable-static @@ -47,6 +48,9 @@ This contains man files for the using of pciutils. make %{?_smp_mflags} +%check +make check + %install %make_install install -p -m 644 doc/rescan-scsi-bus.sh.8 $RPM_BUILD_ROOT%{_mandir}/man8 @@ -70,6 +74,22 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la %{_mandir}/man8/* %changelog +* Wed Nov 3 2021 yanglongkang - 1.45-6 +- sync each branch submit + +* Sat Jul 31 2021 chenyanpanHW - 1.45-5 +- DESC: delete -Sgit from %autosetup, and delete BuildRequires git + +* Wed Nov 10 2020 haowenchao - 1.45-4 +- Fix grammar problems caused by patch + 0003-sg3_utils-1.42-delete-lun-rescan-scsi-bus-report-error.patch + +* Wed Nov 5 2020 lixiaokeng - 1.45-3 +- add make check + +* Tue Feb 9 2021 Zhiqiang Liu - 1.45-2 +- solve coredump problem, rename patches and set release to 2 for CI + * Fri Apr 17 2020 renxudong - 1.45-0 - Type:requirement - ID:NA