From 37e37b29651e7613aa00da93ccc0c7e501be681d Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Fri, 3 Jan 2020 18:07:38 +0100 Subject: [PATCH 01/23] * Fri Jan 03 2020 Tomas Bzatek - 1.44-1 - Rebase to 1.44 release - Enable supplemental udev rules - Fix sg_turs help invocation in an old mode (#1683343) - Fix sg_raw printing error about device not specified on version request (#1627657) - Fix coverity scan warnings (#1633235) This is basically a resync to RHEL 8.2 version. --- .gitignore | 1 + 40-usb-blacklist.rules | 14 + 59-fc-wwpn-id.rules | 17 + BZ_1633235-sg3_utils-1.44-covscan-fix.patch | 1427 +++++++++++++++++++ fc_wwpn_id-non_FC-devices.patch | 25 + sg3_utils-1.37-dont-open-dev-snapshot.patch | 27 - sg3_utils-1.42-sysmacros.patch | 132 -- sg3_utils.spec | 51 +- sg_raw-version.patch | 28 + sg_turs-help.patch | 24 + sources | 2 +- 11 files changed, 1577 insertions(+), 171 deletions(-) create mode 100644 40-usb-blacklist.rules create mode 100644 59-fc-wwpn-id.rules create mode 100644 BZ_1633235-sg3_utils-1.44-covscan-fix.patch create mode 100644 fc_wwpn_id-non_FC-devices.patch delete mode 100644 sg3_utils-1.37-dont-open-dev-snapshot.patch delete mode 100644 sg3_utils-1.42-sysmacros.patch create mode 100644 sg_raw-version.patch create mode 100644 sg_turs-help.patch diff --git a/.gitignore b/.gitignore index e605e0b..4484f7d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ rescan-scsi-bus.sh-1.35 /sg3_utils-1.40.tgz /sg3_utils-1.41.tgz /sg3_utils-1.42.tar.xz +/sg3_utils-1.44.tar.xz diff --git a/40-usb-blacklist.rules b/40-usb-blacklist.rules new file mode 100644 index 0000000..6cce3e6 --- /dev/null +++ b/40-usb-blacklist.rules @@ -0,0 +1,14 @@ +# +# Blacklist specific USB devices +# +# don't inquire sn and di on broken devices (https://bugzilla.suse.com/show_bug.cgi?id=840054) + +ACTION!="add|change", GOTO="usb_blacklist_end" +KERNEL!="sd*[!0-9]|sr*", GOTO="usb_blacklist_end" + +# unkown device +ATTRS{idVendor}=="0aec", ATTRS{idProduct}=="3260", ENV{ID_SCSI_INQUIRY}="1" +# Sony/JMicron port replicator +ATTRS{idVendor}=="054c", ATTRS{idProduct}=="06a0", ENV{ID_SCSI_INQUIRY}="1" + +LABEL="usb_blacklist_end" diff --git a/59-fc-wwpn-id.rules b/59-fc-wwpn-id.rules new file mode 100644 index 0000000..5ad0a5c --- /dev/null +++ b/59-fc-wwpn-id.rules @@ -0,0 +1,17 @@ +# +# FC WWPN-based by-path links +# + +ACTION!="add|change", GOTO="fc_wwpn_end" +KERNEL!="sd*", GOTO="fc_wwpn_end" + +ENV{DEVTYPE}=="disk", IMPORT{program}="fc_wwpn_id %p" +ENV{DEVTYPE}=="partition", IMPORT{parent}="FC_*" +ENV{FC_TARGET_WWPN}!="?*", GOTO="fc_wwpn_end" +ENV{FC_INITIATOR_WWPN}!="?*", GOTO="fc_wwpn_end" +ENV{FC_TARGET_LUN}!="?*", GOTO="fc_wwpn_end" + +ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-path/fc-$env{FC_INITIATOR_WWPN}-$env{FC_TARGET_WWPN}-lun-$env{FC_TARGET_LUN}" +ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-path/fc-$env{FC_INITIATOR_WWPN}-$env{FC_TARGET_WWPN}-lun-$env{FC_TARGET_LUN}-part%n" + +LABEL="fc_wwpn_end" diff --git a/BZ_1633235-sg3_utils-1.44-covscan-fix.patch b/BZ_1633235-sg3_utils-1.44-covscan-fix.patch new file mode 100644 index 0000000..3ac642b --- /dev/null +++ b/BZ_1633235-sg3_utils-1.44-covscan-fix.patch @@ -0,0 +1,1427 @@ +From 7a39d7758c9c799bc6341a8a339a91692ec8a9dd Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Tue, 25 Sep 2018 18:52:26 +0800 +Subject: [PATCH 01/30] Fix overrunning array. + +Issue: + * `jrp` might pointing outside of join_arr after the for loop. + * Out of index: `op->cdb`. + +Fix: + * Check index number before dereferencing `jpr` pointer. + * Check index number before access `op->cdb` array. + +Signed-off-by: Gris Ge +--- + src/sg_raw.c | 2 +- + src/sg_ses.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/sg_raw.c b/src/sg_raw.c +index 92c2287..90c3d9c 100644 +--- a/src/sg_raw.c ++++ b/src/sg_raw.c +@@ -454,7 +454,7 @@ parse_cmd_line(struct opts_t * op, int argc, char *argv[]) + return SG_LIB_SYNTAX_ERROR; + } + +- if (op->cdb_length > MAX_SCSI_CDBSZ) { ++ if (op->cdb_length >= MAX_SCSI_CDBSZ) { + pr2serr("CDB too long (max. %d bytes)\n", MAX_SCSI_CDBSZ); + return SG_LIB_SYNTAX_ERROR; + } +diff --git a/src/sg_ses.c b/src/sg_ses.c +index abb1fea..29b66b3 100644 +--- a/src/sg_ses.c ++++ b/src/sg_ses.c +@@ -5310,7 +5310,7 @@ ses_cgs(struct sg_pt_base * ptvp, const struct tuple_acronym_val * tavp, + if (op->ind_indiv_last <= op->ind_indiv) + break; + } /* end of loop over join array */ +- if ((NULL == jrp->enc_statp) || (k >= MX_JOIN_ROWS)) { ++ if ((k >= MX_JOIN_ROWS) || (NULL == jrp->enc_statp)) { + if (op->desc_name) + pr2serr("descriptor name: %s not found (check the 'ed' page " + "[0x7])\n", op->desc_name); +-- +1.8.3.1 + + +From ad7d26c94ad555a647528c31eb11b78fc0ac4474 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Tue, 25 Sep 2018 18:59:01 +0800 +Subject: [PATCH 02/30] sg_persist: Workaround for false warning of covscan. + +The covscan think we might access out of index on `tid_arr` but +actually we did the index check before. + +Signed-off-by: Gris Ge +--- + src/sg_persist.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sg_persist.c b/src/sg_persist.c +index f582d32..b565a5a 100644 +--- a/src/sg_persist.c ++++ b/src/sg_persist.c +@@ -824,7 +824,7 @@ decode_file_tids(const char * fnp, struct opts_t * op) + pr2serr("%s: array length exceeded\n", __func__); + goto bad; + } +- tid_arr[off + k] = h; ++ op->transportid_arr[off + k] = h; + lcp = strpbrk(lcp, " ,\t"); + if (NULL == lcp) + break; +-- +1.8.3.1 + + +From 24e54cf4c04fa7aa3bdf8e7315ce6240ab306c5f Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Tue, 25 Sep 2018 19:12:34 +0800 +Subject: [PATCH 03/30] sg_opcodes: Fix overrun of array. + +Overrunning array `b` as 4 + m might bigger than the size of array `b`. + +Signed-off-by: Gris Ge +--- + src/sg_opcodes.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/sg_opcodes.c b/src/sg_opcodes.c +index 21897c4..a8cf762 100644 +--- a/src/sg_opcodes.c ++++ b/src/sg_opcodes.c +@@ -799,7 +799,8 @@ list_all_codes(uint8_t * rsoc_buff, int rsoc_len, struct opts_t * op, + printf(" usage: "); + else + printf(" cdb usage: "); +- for (m = 0; m < cdb_sz; ++m) ++ for (m = 0; (m < cdb_sz) && ((size_t) (4 + m) < sizeof(b)); ++ ++m) + printf("%.2x ", b[4 + m]); + printf("\n"); + } +-- +1.8.3.1 + + +From ca241cf82c746391edb3b460550310da40202fe4 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 20:34:42 +0800 +Subject: [PATCH 04/30] sg_lib: Fix overruning of array + `sg_lib_scsi_status_sense_arr` + +Check index before dereferencing `mp`. + +Signed-off-by: Gris Ge +--- + include/sg_lib_data.h | 2 ++ + lib/sg_lib.c | 3 +++ + lib/sg_lib_data.c | 6 ++++++ + 3 files changed, 11 insertions(+) + +diff --git a/include/sg_lib_data.h b/include/sg_lib_data.h +index a870043..9739453 100644 +--- a/include/sg_lib_data.h ++++ b/include/sg_lib_data.h +@@ -122,6 +122,8 @@ extern struct sg_lib_simple_value_name_t sg_lib_nvme_nvm_cmd_arr[]; + extern struct sg_lib_value_name_t sg_lib_nvme_cmd_status_arr[]; + extern struct sg_lib_4tuple_u8 sg_lib_scsi_status_sense_arr[]; + ++size_t sg_lib_scsi_status_sense_arr_len(void); ++ + extern struct sg_value_2names_t sg_exit_str_arr[]; + + #ifdef __cplusplus +diff --git a/lib/sg_lib.c b/lib/sg_lib.c +index c2c5891..c281cce 100644 +--- a/lib/sg_lib.c ++++ b/lib/sg_lib.c +@@ -2585,6 +2585,9 @@ sg_nvme_status2scsi(uint16_t sct_sc, uint8_t * status_p, uint8_t * sk_p, + return false; + } else if (ind >= k) + return false; ++ /* Check whether `ind` is out of index of sg_lib_scsi_status_sense_arr */ ++ if (ind >= (int) sg_lib_scsi_status_sense_arr_len()) ++ return false; + mp = sg_lib_scsi_status_sense_arr + ind; + if (status_p) + *status_p = mp->t1; +diff --git a/lib/sg_lib_data.c b/lib/sg_lib_data.c +index d5ca380..3a898e5 100644 +--- a/lib/sg_lib_data.c ++++ b/lib/sg_lib_data.c +@@ -1850,3 +1850,9 @@ struct sg_value_2names_t sg_exit_str_arr[] = { + }; + + #endif /* (SG_SCSI_STRINGS && HAVE_NVME && (! IGNORE_NVME)) */ ++ ++size_t sg_lib_scsi_status_sense_arr_len(void) ++{ ++ return sizeof(sg_lib_scsi_status_sense_arr)/ ++ sizeof(struct sg_lib_4tuple_u8) - 1; ++} +-- +1.8.3.1 + + +From 36a487285d9e7c9afce9acaefa8fad25017cacd8 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Fri, 28 Sep 2018 20:56:26 +0800 +Subject: [PATCH 05/30] sginfo,sg_dd: Fix resource leak. + + * sginfo: Free the memory of `headsp`. + * sg_dd: Close infd/outfd before return error. + +Signed-off-by: Gris Ge +--- + src/sg_dd.c | 6 ++++++ + src/sginfo.c | 1 + + 2 files changed, 7 insertions(+) + +diff --git a/src/sg_dd.c b/src/sg_dd.c +index edd8f9c..6bdbcdb 100644 +--- a/src/sg_dd.c ++++ b/src/sg_dd.c +@@ -1276,6 +1276,7 @@ open_if(const char * inf, int64_t skip, int bpt, struct flags_t * ifp, + perror(ME "SG_SET_RESERVED_SIZE error"); + res = ioctl(infd, SG_GET_VERSION_NUM, &t); + if ((res < 0) || (t < 30000)) { ++ close(infd); + if (FT_BLOCK & *in_typep) + pr2serr(ME "SG_IO unsupported on this block device\n"); + else +@@ -1308,6 +1309,7 @@ open_if(const char * inf, int64_t skip, int bpt, struct flags_t * ifp, + snprintf(ebuff, EBUFF_SZ, ME "couldn't skip to " + "required position on %s", inf); + perror(ebuff); ++ close(infd); + goto file_err; + } + if (vb) +@@ -1341,6 +1343,7 @@ open_if(const char * inf, int64_t skip, int bpt, struct flags_t * ifp, + file_err: + return -SG_LIB_FILE_ERROR; + other_err: ++ close(infd); + return -SG_LIB_CAT_OTHER; + } + +@@ -1398,6 +1401,7 @@ open_of(const char * outf, int64_t seek, int bpt, struct flags_t * ofp, + perror(ME "SG_SET_RESERVED_SIZE error"); + res = ioctl(outfd, SG_GET_VERSION_NUM, &t); + if ((res < 0) || (t < 30000)) { ++ close(outfd); + pr2serr(ME "sg driver prior to 3.x.y\n"); + goto file_err; + } +@@ -1447,6 +1451,7 @@ open_of(const char * outf, int64_t seek, int bpt, struct flags_t * ofp, + snprintf(ebuff, EBUFF_SZ, + ME "couldn't seek to required position on %s", outf); + perror(ebuff); ++ close(outfd); + goto file_err; + } + if (vb) +@@ -1469,6 +1474,7 @@ open_of(const char * outf, int64_t seek, int bpt, struct flags_t * ofp, + file_err: + return -SG_LIB_FILE_ERROR; + other_err: ++ close(outfd); + return -SG_LIB_CAT_OTHER; + } + +diff --git a/src/sginfo.c b/src/sginfo.c +index bddc964..1032f05 100644 +--- a/src/sginfo.c ++++ b/src/sginfo.c +@@ -1825,6 +1825,7 @@ trytenbyte: + } + } + printf("\n"); ++ free(headsp); + return status; + } + +-- +1.8.3.1 + + +From 5bd764553056b2182db8ef8d6c1a1ab09b0d5a24 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 21:10:23 +0800 +Subject: [PATCH 06/30] covscan: Calling func without checking return value + +* Use the macro `_ignore_return()` defined in `misc.h` to ignore the + return value of functions. + +Signed-off-by: Gris Ge +--- + src/misc.h | 34 ++++++++++++++++++++++++++++++++++ + src/sg_get_config.c | 6 ++++-- + src/sg_logs.c | 6 ++++-- + src/sg_persist.c | 13 +++++++++---- + src/sg_xcopy.c | 23 +++++++++++++---------- + 5 files changed, 64 insertions(+), 18 deletions(-) + create mode 100644 src/misc.h + +diff --git a/src/misc.h b/src/misc.h +new file mode 100644 +index 0000000..6289eae +--- /dev/null ++++ b/src/misc.h +@@ -0,0 +1,34 @@ ++/* ++ * Copyright (c) 2018 Red Hat, Inc. ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ * ++ * Author: Gris Ge ++ */ ++#ifndef __SG_UTILS_MISC_H__ ++#define __SG_UTILS_MISC_H__ ++ ++/* Just make coverity scan happy. */ ++#define _ignore_return(x) if (x) {} ++ ++#endif /* End of __SG_UTILS_MISC_H__ */ +diff --git a/src/sg_get_config.c b/src/sg_get_config.c +index 28af720..4d2cc9b 100644 +--- a/src/sg_get_config.c ++++ b/src/sg_get_config.c +@@ -24,6 +24,8 @@ + #include "sg_unaligned.h" + #include "sg_pr2serr.h" + ++#include "misc.h" ++ + /* A utility program originally written for the Linux OS SCSI subsystem. + * + * This program outputs information provided by a SCSI "Get Configuration" +@@ -1091,7 +1093,7 @@ main(int argc, char * argv[]) + pr2serr(ME "%s doesn't respond to a SCSI INQUIRY\n", device_name); + return SG_LIB_CAT_OTHER; + } +- sg_cmds_close_device(sg_fd); ++ _ignore_return(sg_cmds_close_device(sg_fd)); + + sg_fd = sg_cmds_open_device(device_name, readonly, verbose); + if (sg_fd < 0) { +@@ -1122,7 +1124,7 @@ main(int argc, char * argv[]) + } else { + char b[80]; + +- sg_get_category_sense_str(res, sizeof(b), b, verbose); ++ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, verbose)); + pr2serr("Get Configuration command: %s\n", b); + if (0 == verbose) + pr2serr(" try '-v' option for more information\n"); +diff --git a/src/sg_logs.c b/src/sg_logs.c +index 61443ff..e4f265e 100644 +--- a/src/sg_logs.c ++++ b/src/sg_logs.c +@@ -34,6 +34,8 @@ + #include "sg_unaligned.h" + #include "sg_pr2serr.h" + ++#include "misc.h" ++ + static const char * version_str = "1.69 20180911"; /* spc5r19 + sbc4r11 */ + + #define MX_ALLOC_LEN (0xfffc) +@@ -6776,7 +6778,7 @@ fetchTemperature(int sg_fd, uint8_t * resp, int max_len, struct opts_t * op) + pr2serr("Unable to find temperature in either Temperature or " + "IE log page\n"); + } +- sg_cmds_close_device(sg_fd); ++ _ignore_return(sg_cmds_close_device(sg_fd)); + return (res >= 0) ? res : SG_LIB_CAT_OTHER; + } + +@@ -7246,7 +7248,7 @@ err_out: + if (free_parr) + free(free_parr); + if (sg_fd >= 0) +- sg_cmds_close_device(sg_fd); ++ _ignore_return(sg_cmds_close_device(sg_fd)); + if (0 == vb) { + if (! sg_if_can2stderr("sg_logs failed: ", ret)) + pr2serr("Some error occurred, try again with '-v' or '-vv' for " +diff --git a/src/sg_persist.c b/src/sg_persist.c +index b565a5a..2e10aff 100644 +--- a/src/sg_persist.c ++++ b/src/sg_persist.c +@@ -33,6 +33,8 @@ + #include "sg_unaligned.h" + #include "sg_pr2serr.h" + ++#include "misc.h" ++ + static const char * version_str = "0.66 20180615"; + + +@@ -303,7 +305,8 @@ prin_work(int sg_fd, const struct opts_t * op) + pr2serr("PR in (%s): bad field in cdb or parameter list (perhaps " + "unsupported service action)\n", b); + else { +- sg_get_category_sense_str(res, sizeof(bb), bb, op->verbose); ++ _ignore_return(sg_get_category_sense_str(res, sizeof(bb), bb, ++ op->verbose)); + pr2serr("PR in (%s): %s\n", b, bb); + } + goto fini; +@@ -519,7 +522,8 @@ prout_work(int sg_fd, struct opts_t * op) + pr2serr("PR out (%s): bad field in cdb or parameter list " + "(perhaps unsupported service action)\n", b); + else { +- sg_get_category_sense_str(res, sizeof(bb), bb, op->verbose); ++ _ignore_return(sg_get_category_sense_str(res, sizeof(bb), bb, ++ op->verbose)); + pr2serr("PR out (%s): %s\n", b, bb); + } + goto fini; +@@ -573,7 +577,8 @@ prout_reg_move_work(int sg_fd, struct opts_t * op) + else { + char bb[80]; + +- sg_get_category_sense_str(res, sizeof(bb), bb, op->verbose); ++ _ignore_return(sg_get_category_sense_str(res, sizeof(bb), bb, ++ op->verbose)); + pr2serr("PR out (register and move): %s\n", bb); + } + goto fini; +@@ -1277,7 +1282,7 @@ main(int argc, char * argv[]) + flagged = true; + goto fini; + } +- sg_cmds_close_device(sg_fd); ++ _ignore_return(sg_cmds_close_device(sg_fd)); + } + + if (! op->readwrite_force) { +diff --git a/src/sg_xcopy.c b/src/sg_xcopy.c +index 5facfc8..6230685 100644 +--- a/src/sg_xcopy.c ++++ b/src/sg_xcopy.c +@@ -67,6 +67,8 @@ + #include "sg_unaligned.h" + #include "sg_pr2serr.h" + ++#include "misc.h" ++ + static const char * version_str = "0.68 20180811"; + + #define ME "sg_xcopy: " +@@ -341,7 +343,7 @@ open_sg(struct xcopy_fp_t * fp, int vb) + } + if (sg_simple_inquiry(fp->sg_fd, &sir, false, vb)) { + pr2serr("INQUIRY failed on %s\n", ebuff); +- sg_cmds_close_device(fp->sg_fd); ++ _ignore_return(sg_cmds_close_device(fp->sg_fd)); + fp->sg_fd = -1; + return -1; + } +@@ -415,7 +417,7 @@ dd_filetype_str(int ft, char * buff) + if (FT_OTHER & ft) + off += sg_scnpr(buff + off, 32, "other (perhaps ordinary file) "); + if (FT_ERROR & ft) +- sg_scnpr(buff + off, 32, "unable to 'stat' file "); ++ _ignore_return(sg_scnpr(buff + off, 32, "unable to 'stat' file ")); + return buff; + } + +@@ -640,7 +642,7 @@ scsi_extended_copy(int sg_fd, uint8_t list_id, + DEF_GROUP_NUM, DEF_3PC_OUT_TIMEOUT, + xcopyBuff, desc_offset, true, verb); + if (res) { +- sg_get_category_sense_str(res, sizeof(b), b, verb); ++ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, verb)); + pr2serr("Xcopy(LID1): %s\n", b); + } + return res; +@@ -660,7 +662,7 @@ scsi_read_capacity(struct xcopy_fp_t *xfp) + res = sg_ll_readcap_10(xfp->sg_fd, false /* pmi */, 0, rcBuff, + READ_CAP_REPLY_LEN, true, verb); + if (0 != res) { +- sg_get_category_sense_str(res, sizeof(b), b, verb); ++ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, verb)); + pr2serr("Read capacity(10): %s\n", b); + return res; + } +@@ -672,7 +674,7 @@ scsi_read_capacity(struct xcopy_fp_t *xfp) + res = sg_ll_readcap_16(xfp->sg_fd, false /* pmi */, 0, rcBuff, + RCAP16_REPLY_LEN, true, verb); + if (0 != res) { +- sg_get_category_sense_str(res, sizeof(b), b, verb); ++ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, verb)); + pr2serr("Read capacity(16): %s\n", b); + return res; + } +@@ -714,7 +716,7 @@ scsi_operating_parameter(struct xcopy_fp_t *xfp, int is_target) + res = sg_ll_receive_copy_results(xfp->sg_fd, SA_COPY_OP_PARAMS, 0, rcBuff, + rcBuffLen, true, verb); + if (0 != res) { +- sg_get_category_sense_str(res, sizeof(b), b, verb); ++ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, verb)); + pr2serr("Xcopy operating parameters: %s\n", b); + return -res; + } +@@ -1006,8 +1008,8 @@ decode_designation_descriptor(const uint8_t * bp, int i_len) + { + char c[2048]; + +- sg_get_designation_descriptor_str(NULL, bp, i_len, 1, verbose, +- sizeof(c), c); ++ _ignore_return(sg_get_designation_descriptor_str(NULL, bp, i_len, 1, ++ verbose, sizeof(c), c)); + pr2serr("%s", c); + } + +@@ -1029,7 +1031,8 @@ desc_from_vpd_id(int sg_fd, uint8_t *desc, int desc_len, + if (SG_LIB_CAT_ILLEGAL_REQ == res) + pr2serr("Device identification VPD page not found\n"); + else { +- sg_get_category_sense_str(res, sizeof(b), b, verbose); ++ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, ++ verbose)); + pr2serr("VPD inquiry (Device ID): %s\n", b); + pr2serr(" try again with '-vv'\n"); + } +@@ -1042,7 +1045,7 @@ desc_from_vpd_id(int sg_fd, uint8_t *desc, int desc_len, + res = sg_ll_inquiry(sg_fd, false, true, VPD_DEVICE_ID, rcBuff, len, true, + verb); + if (0 != res) { +- sg_get_category_sense_str(res, sizeof(b), b, verbose); ++ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, verbose)); + pr2serr("VPD inquiry (Device ID): %s\n", b); + return res; + } else if (rcBuff[1] != VPD_DEVICE_ID) { +-- +1.8.3.1 + + +From 3a99f93d11cea7d4273477c698eb6bfb2f6d4696 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 22:14:11 +0800 +Subject: [PATCH 07/30] sg_dd: flock does not allows negative fd. + + * The `outfd` could be -1 in line 1408. We do negative number check on + `outfd` before sending to flock. + +Signed-off-by: Gris Ge +--- + src/sg_dd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sg_dd.c b/src/sg_dd.c +index 6bdbcdb..8696ee7 100644 +--- a/src/sg_dd.c ++++ b/src/sg_dd.c +@@ -1459,7 +1459,7 @@ open_of(const char * outf, int64_t seek, int bpt, struct flags_t * ofp, + "\n", (uint64_t)offset); + } + } +- if (ofp->flock) { ++ if ((ofp->flock) && (outfd >= 0)) { + res = flock(outfd, LOCK_EX | LOCK_NB); + if (res < 0) { + close(outfd); +-- +1.8.3.1 + + +From 158f6547f156b8a7fc175904b4bd502642ed56a5 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 22:21:00 +0800 +Subject: [PATCH 08/30] sginfo: Suspend the fallthrough warning. + +* The GCC and Clang will complain about fallthrough of switch statement, + use maker comments to suspend that. + +Signed-off-by: Gris Ge +--- + src/sginfo.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/sginfo.c b/src/sginfo.c +index 1032f05..9c626ee 100644 +--- a/src/sginfo.c ++++ b/src/sginfo.c +@@ -1757,6 +1757,7 @@ trytenbyte: + } + else if (!sorthead) printf("|"); + } ++ /* fall through */ + case 5: /* physical sector */ + while (len > 0) { + snprintf((char *)cbuffer1, 40, "%6d:%2u:%5d", +@@ -1775,6 +1776,7 @@ trytenbyte: + } + else if (!sorthead) printf("|"); + } ++ /* fall through */ + case 0: /* lba (32 bit) */ + while (len > 0) { + printf("%10d", getnbyte(df, 4)); +@@ -1788,6 +1790,7 @@ trytenbyte: + else + printf("|"); + } ++ /* fall through */ + case 3: /* lba (64 bit) */ + while (len > 0) { + printf("%15" PRId64 , getnbyte_ll(df, 8)); +-- +1.8.3.1 + + +From 7e90f135eeb3900735847df32ed878d8207c59dc Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 22:24:01 +0800 +Subject: [PATCH 09/30] sg_get_lba_status: Fix incorrect use of + sg_ll_get_lba_status32. + +Fix the incorrect argument order of `sg_get_lba_status()`. + +Signed-off-by: Gris Ge +--- + src/sg_get_lba_status.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sg_get_lba_status.c b/src/sg_get_lba_status.c +index 91c7a96..61a823b 100644 +--- a/src/sg_get_lba_status.c ++++ b/src/sg_get_lba_status.c +@@ -340,7 +340,7 @@ main(int argc, char * argv[]) + res = sg_ll_get_lba_status16(sg_fd, lba, rt, glbasBuffp, maxlen, true, + verbose); + else if (do_32) /* keep analyser happy since do_32 must be true */ +- res = sg_ll_get_lba_status32(sg_fd, lba, element_id, scan_len, rt, ++ res = sg_ll_get_lba_status32(sg_fd, lba, scan_len, element_id, rt, + glbasBuffp, maxlen, true, verbose); + + ret = res; +-- +1.8.3.1 + + +From c86a7be69c8601722ba39ef6eacc6aaa993b3d5a Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 22:35:35 +0800 +Subject: [PATCH 10/30] rescan-scsi-bus.sh: Fix shellcheck warning of SC2155. + +Declare and assign separately to avoid masking return values: + https://github.com/koalaman/shellcheck/wiki/SC2155 + +Signed-off-by: Gris Ge +--- + scripts/rescan-scsi-bus.sh | 24 ++++++++++++++++-------- + 1 file changed, 16 insertions(+), 8 deletions(-) + +diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh +index 6989208..75e169a 100755 +--- a/scripts/rescan-scsi-bus.sh ++++ b/scripts/rescan-scsi-bus.sh +@@ -314,8 +314,10 @@ testonline () + fi + else + # Ignore disk revision change +- local old_str_no_rev=`echo "$TMPSTR" | sed -e 's/.\{4\}$//'` +- local new_str_no_rev=`echo "$STR" | sed -e 's/.\{4\}$//'` ++ local old_str_no_rev ++ old_str_no_rev=`echo "$TMPSTR" | sed -e 's/.\{4\}$//'` ++ local new_str_no_rev ++ new_str_no_rev=`echo "$STR" | sed -e 's/.\{4\}$//'` + if [ "$old_str_no_rev" != "$new_str_no_rev" ]; then + echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${SCSISTR#* } \nto: $STR ${norm} \n\n\n" + return 1 +@@ -696,7 +698,8 @@ searchexisting() + local tmpch; + local tmpid + local match=0 +- local targets=`ls -d /sys/class/scsi_device/$host:* 2> /dev/null | egrep -o $host:[0-9]+:[0-9]+ | sort | uniq` ++ local targets ++ targets=`ls -d /sys/class/scsi_device/$host:* 2> /dev/null | egrep -o $host:[0-9]+:[0-9]+ | sort | uniq` + + # Nothing came back on this host, so we should skip it + test -z "$targets" && return +@@ -742,13 +745,15 @@ searchexisting() + findremapped() + { + local hctl=; +- local devs=`ls /sys/class/scsi_device/` ++ local devs ++ devs=`ls /sys/class/scsi_device/` + local sddev= + local id_serial= + local id_serial_old= + local remapped= + mpaths="" +- local tmpfile=$(mktemp /tmp/rescan-scsi-bus.XXXXXXXX 2> /dev/null) ++ local tmpfile ++ tmpfile=$(mktemp /tmp/rescan-scsi-bus.XXXXXXXX 2> /dev/null) + + if [ -z "$tmpfile" ] ; then + tmpfile="/tmp/rescan-scsi-bus.$$" +@@ -835,7 +840,8 @@ incrchgd() + fi + + if test -n "$mp_enable" ; then +- local sdev="`findsddev \"$hctl\"`" ++ local sdev ++ sdev="`findsddev \"$hctl\"`" + if test -n "$sdev" ; then + findmultipath "$sdev" + fi +@@ -853,7 +859,8 @@ incrrmvd() + fi + + if test -n "$mp_enable" ; then +- local sdev="`findsddev \"$hctl\"`" ++ local sdev ++ sdev="`findsddev \"$hctl\"`" + if test -n "$sdev" ; then + findmultipath "$sdev" + fi +@@ -902,7 +909,8 @@ findmultipath() + return 1 + fi + +- local maj_min=`cat /sys/block/$dev/dev` ++ local maj_min ++ maj_min=`cat /sys/block/$dev/dev` + for mp in $($DMSETUP ls --target=multipath | cut -f 1) ; do + [ "$mp" = "No" ] && break; + if $DMSETUP status $mp | grep -q " $maj_min "; then +-- +1.8.3.1 + + +From 0185fcb6527b331082eb10ef733a2a2f746578d8 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 22:36:44 +0800 +Subject: [PATCH 11/30] rescan-scsi-bus.sh: Fix incorrect use of `break`. + +Should use `return` instead in `if` code block. + +Signed-off-by: Gris Ge +--- + scripts/rescan-scsi-bus.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh +index 75e169a..37f121d 100755 +--- a/scripts/rescan-scsi-bus.sh ++++ b/scripts/rescan-scsi-bus.sh +@@ -548,7 +548,7 @@ dolunscan() + 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 +- break; ++ return; + fi + else + if test "$remappedlun0" != "2" ; then +-- +1.8.3.1 + + +From 533e455337251971a94b5d9bce2183fb55383db6 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 22:39:13 +0800 +Subject: [PATCH 12/30] rescan-scsi-bus.sh: Use dummy for throwaway variable. + +* The `offset` is unused and should be replaced by dummy `_`. + https://github.com/koalaman/shellcheck/wiki/SC2034 + +Signed-off-by: Gris Ge +--- + scripts/rescan-scsi-bus.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh +index 37f121d..ed3cf49 100755 +--- a/scripts/rescan-scsi-bus.sh ++++ b/scripts/rescan-scsi-bus.sh +@@ -235,7 +235,7 @@ 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=$(od -tx1 -j1 -N1 "$p" 2>/dev/null | +- { read -r offset byte rest; echo -n "$byte"; }) ++ { read -r _ byte rest; echo -n "$byte"; }) + if [ -n "$b" ]; then + echo $(((0x$b & 0x80) != 0)) + else +-- +1.8.3.1 + + +From 751afef7a7a5049a6d1a6171efb65e9e2f515911 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 22:55:08 +0800 +Subject: [PATCH 13/30] sg_write_x: parameter string might overflow a char + array. + + * The `lcp` might overflow the char array `c`. Use `snprintf` instead. + +Signed-off-by: Gris Ge +--- + src/sg_write_x.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/sg_write_x.c b/src/sg_write_x.c +index 3b8f091..89b5616 100644 +--- a/src/sg_write_x.c ++++ b/src/sg_write_x.c +@@ -671,8 +671,10 @@ parse_scat_pi_line(const char * lcp, uint8_t * up, uint32_t * sum_num) + if (cp) { /* copy from first non whitespace ... */ + memcpy(c, lcp, cp - lcp); /* ... to just prior to first '#' */ + c[cp - lcp] = '\0'; +- } else +- strcpy(c, lcp); /* ... to end of line, including null */ ++ } else { ++ /* ... to end of line, including null */ ++ snprintf(c, sizeof(c)/sizeof(char), "%s", lcp); ++ } + ll = sg_get_llnum(bp); + ok = ((-1 != ll) || all_ascii_f_s(bp, 16)); + if (! ok) { +-- +1.8.3.1 + + +From cd7fdbdeffabd41fe9e9c65e1158cbdb6f906f20 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 22:56:48 +0800 +Subject: [PATCH 14/30] sg_vpd_vendor: Fix potential string overflow. + +Currently, none of `vendor_vpd_pg` name string is longer than 64, +to ease the coverity scan, change strcpy to snprintf. + +Signed-off-by: Gris Ge +--- + src/sg_vpd_vendor.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sg_vpd_vendor.c b/src/sg_vpd_vendor.c +index 3c75177..9a73748 100644 +--- a/src/sg_vpd_vendor.c ++++ b/src/sg_vpd_vendor.c +@@ -1420,7 +1420,7 @@ svpd_decode_vendor(int sg_fd, struct opts_t * op, int off) + if (0 == res) { + vnp = svpd_get_v_detail(op->vpd_pn, op->vend_prod_num, 0xf & rp[0]); + if (vnp && vnp->name) +- strcpy(name, vnp->name); ++ snprintf(name, sizeof(name)/sizeof(char), "%s", vnp->name); + else + snprintf(name, sizeof(name) - 1, "Vendor VPD page=0x%x", + op->vpd_pn); +-- +1.8.3.1 + + +From 7ddd2de9d7c7ebcfcb3c33da9993cb60a91b0525 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 23:38:05 +0800 +Subject: [PATCH 15/30] sg_write_x: Remove dead code. + +* The `k` is always smaller than 3, `default:` will never be reached. +* The `ok` is already checked for non-zero. + +Signed-off-by: Gris Ge +--- + src/sg_write_x.c | 10 +--------- + 1 file changed, 1 insertion(+), 9 deletions(-) + +diff --git a/src/sg_write_x.c b/src/sg_write_x.c +index 89b5616..d6949ed 100644 +--- a/src/sg_write_x.c ++++ b/src/sg_write_x.c +@@ -750,10 +750,6 @@ parse_scat_pi_line(const char * lcp, uint8_t * up, uint32_t * sum_num) + } else if (up) + sg_put_unaligned_be16((uint16_t)ll, up + 18); + break; +- default: +- pr2serr("%s: k=%d should not be >= 3\n", __func__, k); +- ok = false; +- break; + } + if (! ok) + break; +@@ -774,13 +770,9 @@ parse_scat_pi_line(const char * lcp, uint8_t * up, uint32_t * sum_num) + if (up) + sg_put_unaligned_be16((uint16_t)DEF_TM, up + 18); + break; +- default: +- pr2serr("%s: k=%d should not be >= 3\n", __func__, k); +- ok = false; +- break; + } + } +- return ok ? 0 : SG_LIB_SYNTAX_ERROR; ++ return 0; + } + + /* Read pairs or quintets from a scat_file and places them in a T10 scatter +-- +1.8.3.1 + + +From 2ff6254d584b2c673b9d6289da2f6af6e293a3d3 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 23:36:58 +0800 +Subject: [PATCH 16/30] sg_vpd: Remove dead code. + + * The `n` is between 0 and 7, the `default` statement is never reached. + + * The `do_hex` will never been bigger than 2 at that line. + +Signed-off-by: Gris Ge +--- + src/sg_vpd.c | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/src/sg_vpd.c b/src/sg_vpd.c +index a15ed74..081232d 100644 +--- a/src/sg_vpd.c ++++ b/src/sg_vpd.c +@@ -1233,9 +1233,6 @@ decode_x_inq_vpd(uint8_t * b, int len, int do_hex, bool do_long, + case 7: + printf(" [protection types 1, 2 and 3 supported]\n"); + break; +- default: +- printf("\n"); +- break; + } + } else + printf("\n"); +@@ -1991,8 +1988,6 @@ decode_proto_lu_vpd(uint8_t * buff, int len, int do_hex) + continue; + if (2 == do_hex) + hex2stdout(bp + 8, desc_len, 1); +- else if (do_hex > 2) +- hex2stdout(bp, bump, 1); + else { + switch (proto) { + case TPROTO_SAS: +@@ -2042,8 +2037,6 @@ decode_proto_port_vpd(uint8_t * buff, int len, int do_hex) + continue; + if (2 == do_hex) + hex2stdout(bp + 8, desc_len, 1); +- else if (do_hex > 2) +- hex2stdout(bp, bump, 1); + else { + switch (proto) { + case TPROTO_SAS: /* page added in spl3r02 */ +-- +1.8.3.1 + + +From 013eb336d61d56eb7dc3c67b6551096a8175527a Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 23:41:46 +0800 +Subject: [PATCH 17/30] sg_test_rwbuf: Fix incorrect initial value of + `version_given`. + +* With current code, no real code could be execute as + `version_give` is always true(if not in debug mode). + +Signed-off-by: Gris Ge +--- + src/sg_test_rwbuf.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/sg_test_rwbuf.c b/src/sg_test_rwbuf.c +index f187ba0..52b7e81 100644 +--- a/src/sg_test_rwbuf.c ++++ b/src/sg_test_rwbuf.c +@@ -386,8 +386,8 @@ void usage () + + int main (int argc, char * argv[]) + { +- bool verbose_given = true; +- bool version_given = true; ++ bool verbose_given = false; ++ bool version_given = false; + int sg_fd, res; + const char * device_name = NULL; + int times = 1; +-- +1.8.3.1 + + +From bf1ee2b1ecc966f50b19bec4126a58b3c4c53111 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 26 Sep 2018 23:53:52 +0800 +Subject: [PATCH 18/30] sg_ses: Remove dead code. + +* The `n` is always '>= 1' after the for loop. +* All the possible value between 0x20 to 0x2f is covered by preview + switch statements. +* The cp is pointing to a stack memory, is always not NULL. + +Signed-off-by: Gris Ge +--- + src/sg_ses.c | 11 +---------- + 1 file changed, 1 insertion(+), 10 deletions(-) + +diff --git a/src/sg_ses.c b/src/sg_ses.c +index 29b66b3..9c4b0c0 100644 +--- a/src/sg_ses.c ++++ b/src/sg_ses.c +@@ -1405,9 +1405,6 @@ parse_cmd_line(struct opts_t *op, int argc, char *argv[]) + else if (1 == n) { + op->page_code_given = true; + op->page_code = pc; +- } else { +- pr2serr("No dpage found --data= argument\n"); +- goto err_help; + } + if (op->verbose > 3) { + int k; +@@ -2431,9 +2428,6 @@ find_sas_connector_type(int conn_type, bool abridged, char * buff, + else if (conn_type < 0x20) + snprintf(buff, buff_len, "unknown internal wide connector type: " + "0x%x", conn_type); +- else if (conn_type < 0x30) +- snprintf(buff, buff_len, "unknown internal connector to end " +- "device, type: 0x%x", conn_type); + else if (conn_type < 0x3f) + snprintf(buff, buff_len, "reserved for internal connector, " + "type: 0x%x", conn_type); +@@ -2637,8 +2631,6 @@ enc_status_helper(const char * pad, const uint8_t * statp, int etype, + printf("%slast 3 bytes (hex): %02x %02x %02x\n", pad, statp[1], + statp[2], statp[3]); + break; +- default: +- break; + } + break; + case UI_POWER_SUPPLY_ETC: /* Uninterruptible power supply */ +@@ -4260,8 +4252,7 @@ process_status_dpage(struct sg_pt_base * ptvp, int page_code, uint8_t * resp, + subenc_nickname_sdg(resp, resp_len); + break; + default: +- printf("Cannot decode response from diagnostic " +- "page: %s\n", (cp ? cp : "")); ++ printf("Cannot decode response from diagnostic page: %s\n", cp); + hex2stdout(resp, resp_len, 0); + } + +-- +1.8.3.1 + + +From d1a53f72716e0013c6ff4e76c4ccae575e32e35d Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 27 Sep 2018 00:07:56 +0800 +Subject: [PATCH 19/30] sg_sanitize: Remove dead code. + + * The `has_di` will always be 0 at that line. + +Signed-off-by: Gris Ge +--- + src/sg_sanitize.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/src/sg_sanitize.c b/src/sg_sanitize.c +index b45462f..b810128 100644 +--- a/src/sg_sanitize.c ++++ b/src/sg_sanitize.c +@@ -388,11 +388,6 @@ print_dev_id(int fd, uint8_t * sinq_resp, int max_rlen, int verbose) + n = (SAFE_STD_INQ_RESP_LEN - 4); + for (k = 0, has_sn = 0, has_di = 0; k < n; ++k) { + if (VPD_UNIT_SERIAL_NUM == b[4 + k]) { +- if (has_di) { +- if (verbose) +- pr2serr("VPD_SUPPORTED_VPDS dis-ordered\n"); +- return 0; +- } + ++has_sn; + } else if (VPD_DEVICE_ID == b[4 + k]) { + ++has_di; +-- +1.8.3.1 + + +From 880d18e2e0296a91a65f7f94dcd8ad5e2497cfa6 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 27 Sep 2018 00:09:08 +0800 +Subject: [PATCH 20/30] sg_rbuf: Remove dead code. + +The `res` is always >=0 at that line. + +Signed-off-by: Gris Ge +--- + src/sg_rbuf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sg_rbuf.c b/src/sg_rbuf.c +index 61604d3..6b74436 100644 +--- a/src/sg_rbuf.c ++++ b/src/sg_rbuf.c +@@ -681,5 +681,5 @@ main(int argc, char * argv[]) + else + printf("read buffer non-zero\n"); + #endif +- return (res >= 0) ? res : SG_LIB_CAT_OTHER; ++ return res; + } +-- +1.8.3.1 + + +From d58bc5904989a381b9ab541409b83578a56b75da Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 27 Sep 2018 00:17:07 +0800 +Subject: [PATCH 21/30] sg_luns: Remove dead code. + +The `a_method` is always between 0 and 3. + +Signed-off-by: Gris Ge +--- + src/sg_luns.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/src/sg_luns.c b/src/sg_luns.c +index 904b2ce..9115070 100644 +--- a/src/sg_luns.c ++++ b/src/sg_luns.c +@@ -306,9 +306,6 @@ decode_lun(const char * leadin, const uint8_t * lunp, bool lu_cong, + } + } + break; +- default: +- printf("%s<<%s: faulty logic>>\n", l_leadin, __func__); +- break; + } + if (next_level) + continue; +-- +1.8.3.1 + + +From 601fe8621fa0fb1d2674d67181dd368936354cb4 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 27 Sep 2018 00:18:57 +0800 +Subject: [PATCH 22/30] sg_logs: Fix typo in variable name. + +Signed-off-by: Gris Ge +--- + src/sg_logs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sg_logs.c b/src/sg_logs.c +index e4f265e..7001ee4 100644 +--- a/src/sg_logs.c ++++ b/src/sg_logs.c +@@ -7109,7 +7109,7 @@ main(int argc, char * argv[]) + if (k) { + if (SG_LIB_CAT_NOT_READY == k) + pr2serr("log_select: device not ready\n"); +- else if (SG_LIB_CAT_ILLEGAL_REQ == res) ++ else if (SG_LIB_CAT_ILLEGAL_REQ == k) + pr2serr("log_select: field in cdb illegal\n"); + else if (SG_LIB_CAT_INVALID_OP == k) + pr2serr("log_select: not supported\n"); +-- +1.8.3.1 + + +From e921a23e89f91b50929e9f4dc2f5902021f689d9 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 27 Sep 2018 00:19:40 +0800 +Subject: [PATCH 23/30] sg_inq: Remove dead code. + +The `support_num` is always between 0 and 7. + +Signed-off-by: Gris Ge +--- + src/sg_inq.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/sg_inq.c b/src/sg_inq.c +index b32ab87..1664345 100644 +--- a/src/sg_inq.c ++++ b/src/sg_inq.c +@@ -3428,7 +3428,6 @@ cmddt_process(int sg_fd, const struct opts_t * op) + break; + case 6: desc_p = "vendor specific (6)"; break; + case 7: desc_p = "reserved (7)"; break; +- default: desc_p = "impossible value > 7"; break; + } + if (prnt_cmd) { + printf(" Support field: %s [", desc_p); +-- +1.8.3.1 + + +From 27a19f00c6c58e91296e918a34afb2b2bdcac822 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 27 Sep 2018 00:20:32 +0800 +Subject: [PATCH 24/30] sg_format: Remove dead code. + +The `has_di` is always 0 in that line. + +Signed-off-by: Gris Ge +--- + src/sg_format.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/src/sg_format.c b/src/sg_format.c +index af1a033..61ee77f 100644 +--- a/src/sg_format.c ++++ b/src/sg_format.c +@@ -700,12 +700,6 @@ print_dev_id(int fd, uint8_t * sinq_resp, int max_rlen, + n = (SAFE_STD_INQ_RESP_LEN - 4); + for (k = 0, has_sn = 0, has_di = 0; k < n; ++k) { + if (VPD_UNIT_SERIAL_NUM == b[4 + k]) { +- if (has_di) { +- if (op->verbose) +- pr2serr("VPD_SUPPORTED_VPDS " +- "dis-ordered\n"); +- goto out; +- } + ++has_sn; + } else if (VPD_DEVICE_ID == b[4 + k]) { + ++has_di; +-- +1.8.3.1 + + +From 8292e3e96cac1f234f1139161c5e92e29b545da1 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 27 Sep 2018 00:22:35 +0800 +Subject: [PATCH 25/30] sg_dd: Remove dead code. + +The `ret` there is always non-zero. + +Signed-off-by: Gris Ge +--- + src/sg_dd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sg_dd.c b/src/sg_dd.c +index 8696ee7..aa544c7 100644 +--- a/src/sg_dd.c ++++ b/src/sg_dd.c +@@ -976,7 +976,7 @@ err_out: + } + return may_coe ? 0 : ret; + } else +- return ret ? ret : -1; ++ return ret; + } + + +-- +1.8.3.1 + + +From 50ba84424a1226dfef9a2746fd797cffbc544aad Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 27 Sep 2018 00:23:49 +0800 +Subject: [PATCH 26/30] sg_pt_linux_nvme: Remove dead code. + +The `return 0` already stop the `if (dout_len > 0)` check. + +Signed-off-by: Gris Ge +--- + lib/sg_pt_linux_nvme.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/lib/sg_pt_linux_nvme.c b/lib/sg_pt_linux_nvme.c +index 18b1374..98feaef 100644 +--- a/lib/sg_pt_linux_nvme.c ++++ b/lib/sg_pt_linux_nvme.c +@@ -899,11 +899,6 @@ sntl_senddiag(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp, + return 0; + } else + return 0; /* nothing to do */ +- if (dout_len > 0) { +- if (vb) +- pr2ws("%s: dout given but PF clear\n", __func__); +- return SCSI_PT_DO_BAD_PARAMS; +- } + } + if (dout_len < 4) { + if (vb) +-- +1.8.3.1 + + +From 570105df861066e0943fc6a7511172acdeb212c0 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Fri, 28 Sep 2018 19:50:11 +0800 +Subject: [PATCH 27/30] sg_lib: Remove dead code. + +Signed-off-by: Gris Ge +--- + lib/sg_lib.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/lib/sg_lib.c b/lib/sg_lib.c +index c281cce..e7cac29 100644 +--- a/lib/sg_lib.c ++++ b/lib/sg_lib.c +@@ -2123,14 +2123,11 @@ sg_get_command_size(uint8_t opcode) + switch ((opcode >> 5) & 0x7) { + case 0: + return 6; +- case 1: case 2: case 6: case 7: +- return 10; + case 3: case 5: + return 12; +- break; + case 4: + return 16; +- default: ++ default: /* 1, 2, 6, 7 */ + return 10; + } + } +@@ -2267,9 +2264,6 @@ sg_get_opcode_name(uint8_t cmd_byte0, int peri_type, int buff_len, + case 7: + sg_scnpr(buff, buff_len, "Vendor specific [0x%x]", (int)cmd_byte0); + break; +- default: +- sg_scnpr(buff, buff_len, "Opcode=0x%x", (int)cmd_byte0); +- break; + } + } + +-- +1.8.3.1 + + +From 26932a6b4e5a1e844df3edcef86d399391f4b18c Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 27 Sep 2018 00:33:00 +0800 +Subject: [PATCH 28/30] sg_vpd: Fix protantially overflowing of uint64_t. + +Signed-off-by: Gris Ge +--- + src/sg_vpd.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/sg_vpd.c b/src/sg_vpd.c +index 081232d..2865af4 100644 +--- a/src/sg_vpd.c ++++ b/src/sg_vpd.c +@@ -1929,9 +1929,9 @@ decode_3party_copy_vpd(uint8_t * buff, int len, int do_hex, int pdt, + printf(" Maximum identified concurrent copies: %u\n", u); + u = sg_get_unaligned_be32(bp + 12); + printf(" Maximum segment length: %u\n", u); +- ull = (1 << bp[16]); /* field is power of 2 */ ++ ull = (1 << bp[16]) & UINT64_MAX; /* field is power of 2 */ + printf(" Data segment granularity: %" PRIu64 "\n", ull); +- ull = (1 << bp[17]); ++ ull = (1 << bp[17]) & UINT64_MAX; + printf(" Inline data granularity: %" PRIu64 "\n", ull); + break; + case 0x9101: +@@ -1943,7 +1943,7 @@ decode_3party_copy_vpd(uint8_t * buff, int len, int do_hex, int pdt, + printf(" Held data:\n"); + u = sg_get_unaligned_be32(bp + 4); + printf(" Held data limit: %u\n", u); +- ull = (1 << bp[8]); ++ ull = (1 << bp[8]) & UINT64_MAX; + printf(" Held data granularity: %" PRIu64 "\n", ull); + break; + default: +-- +1.8.3.1 + + +From 5b2e117dee27ec7cebecd042b2d505f2b6dcb461 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Fri, 28 Sep 2018 19:45:26 +0800 +Subject: [PATCH 29/30] sg_lib: Removed dead code. + + * The value 32 stored in `len` is never used afterwords. + * The `bump` initial value is always been overridden. + +Signed-off-by: Gris Ge +--- + lib/sg_lib.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/lib/sg_lib.c b/lib/sg_lib.c +index e7cac29..a691b02 100644 +--- a/lib/sg_lib.c ++++ b/lib/sg_lib.c +@@ -545,7 +545,6 @@ sg_decode_transportid_str(const char * lip, uint8_t * bp, int bplen, + } + if (NULL == lip) + lip = ""; +- bump = TRANSPORT_ID_MIN_LEN; /* should be overwritten in all loop paths */ + for (k = 0, n = 0; bplen > 0; ++k, bp += bump, bplen -= bump) { + if ((k > 0) && only_one) + break; +@@ -1846,9 +1845,6 @@ sg_get_sense_str(const char * lip, const uint8_t * sbp, int sb_len, + sg_scnpr(b + r, blen - r, "%s lba=0x%x\n", lip, + sg_get_unaligned_be24(sbp + 1) & 0x1fffff); + n += sg_scnpr(cbp + n, cblen - n, "%s\n", b); +- len = sb_len; +- if (len > 32) +- len = 32; /* trim in case there is a lot of rubbish */ + } + check_raw: + if (raw_sinfo) { +-- +1.8.3.1 + + +From 8ebcd159bbc41f63fa96e904dee9307b2ee7aec2 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Fri, 28 Sep 2018 19:59:28 +0800 +Subject: [PATCH 30/30] sg_cmds_basic: Check resp for NULL before doing memset. + +Signed-off-by: Gris Ge +--- + lib/sg_cmds_basic.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/lib/sg_cmds_basic.c b/lib/sg_cmds_basic.c +index e625465..f4021bb 100644 +--- a/lib/sg_cmds_basic.c ++++ b/lib/sg_cmds_basic.c +@@ -324,6 +324,13 @@ sg_ll_inquiry_com(struct sg_pt_base * ptvp, bool cmddt, bool evpd, int pg_op, + uint8_t sense_b[SENSE_BUFF_LEN]; + uint8_t * up; + ++ if (resp == NULL) { ++ if (verbose) ++ pr2ws("Got NULL `resp` pointer"); ++ return SG_LIB_CAT_MALFORMED; ++ } ++ ++ + if (cmddt) + inq_cdb[1] |= 0x2; + if (evpd) +-- +1.8.3.1 + diff --git a/fc_wwpn_id-non_FC-devices.patch b/fc_wwpn_id-non_FC-devices.patch new file mode 100644 index 0000000..6bff83a --- /dev/null +++ b/fc_wwpn_id-non_FC-devices.patch @@ -0,0 +1,25 @@ +From 37b8af8278bba0b116b579950218f2e610a2ab2b Mon Sep 17 00:00:00 2001 +From: jtpittman195 +Date: Fri, 4 Oct 2019 10:58:24 -0400 +Subject: [PATCH] fc_wwpn_id: add condition to FC_TARGET_LUN return + +If there is no relevant fc_remote_port or fc_host found, there is no need to return the target_lun number. Returning with no condition causes a FC_TARGET_LUN value to be present in the udev database for devices that are not fibre attached. Add condition to check. +--- + scripts/fc_wwpn_id | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/scripts/fc_wwpn_id b/scripts/fc_wwpn_id +index c8d0189..b05c5e8 100644 +--- a/scripts/fc_wwpn_id ++++ b/scripts/fc_wwpn_id +@@ -38,7 +38,9 @@ while [ -n "$d" ] ; do + esac + done + +-echo "FC_TARGET_LUN=$target_lun" ++if [ -n "$rport_wwpn" ] || [ -n "$host_wwpn" ] ; then ++ echo "FC_TARGET_LUN=$target_lun" ++fi + + if [ -n "$rport_wwpn" ] ; then + echo "FC_TARGET_WWPN=$rport_wwpn" diff --git a/sg3_utils-1.37-dont-open-dev-snapshot.patch b/sg3_utils-1.37-dont-open-dev-snapshot.patch deleted file mode 100644 index 2fbfe3a..0000000 --- a/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/sg3_utils-1.42-sysmacros.patch b/sg3_utils-1.42-sysmacros.patch deleted file mode 100644 index 5633653..0000000 --- a/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/sg3_utils.spec b/sg3_utils.spec index 0a79abd..1a462a2 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -2,16 +2,24 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils -Version: 1.42 -Release: 8%{?dist} +Version: 1.44 +Release: 1%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 -# https://bugzilla.redhat.com/show_bug.cgi?id=920687 -Patch0: sg3_utils-1.37-dont-open-dev-snapshot.patch -# use sysmacros.h for major()/minor() -# backported from https://github.com/hreinecke/sg3_utils/commit/3e50c99af4a446642c7055d1d06b84a94e4a76c2 -Patch1: sg3_utils-1.42-sysmacros.patch +Source10: 40-usb-blacklist.rules +Source11: 59-fc-wwpn-id.rules +Patch0: BZ_1633235-sg3_utils-1.44-covscan-fix.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1683343 +# sg_turs: improper usage show +Patch1: sg_turs-help.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1627657 +# sg_raw -V fail +Patch2: sg_raw-version.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1760847 +# FC_TARGET_LUN attribute assigned for non FC device +Patch3: fc_wwpn_id-non_FC-devices.patch + URL: http://sg.danny.cz/sg/sg3_utils.html Requires: %{name}-libs%{?_isa} = %{version}-%{release} BuildRequires: gcc @@ -46,10 +54,7 @@ This package contains the %{name} library and its header files for developing applications. %prep -%setup -q -%patch0 -p1 -b .dev-snapshot -%patch1 -p1 -b .sysmacros - +%autosetup -p 1 %build %configure --disable-static @@ -70,11 +75,28 @@ install -p -m 755 scripts/%{rescan_script} $RPM_BUILD_ROOT%{_bindir} install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8 +# install all extra udev rules +mkdir -p $RPM_BUILD_ROOT%{_udevrulesdir} +mkdir -p $RPM_BUILD_ROOT/usr/lib/udev +# need to run after 60-persistent-storage.rules +install -p -m 644 scripts/55-scsi-sg3_id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/61-scsi-sg3_id.rules +# need to run after 62-multipath.rules +install -p -m 644 scripts/58-scsi-sg3_symlink.rules $RPM_BUILD_ROOT%{_udevrulesdir}/63-scsi-sg3_symlink.rules +install -p -m 644 scripts/59-scsi-cciss_id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/65-scsi-cciss_id.rules +install -p -m 644 %{SOURCE10} $RPM_BUILD_ROOT%{_udevrulesdir} +install -p -m 644 %{SOURCE11} $RPM_BUILD_ROOT%{_udevrulesdir}/63-fc-wwpn-id.rules +install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %files %doc AUTHORS BSD_LICENSE COPYING COVERAGE CREDITS ChangeLog README README.sg_start %{_bindir}/* %{_mandir}/man8/* +%{_udevrulesdir}/61-scsi-sg3_id.rules +%{_udevrulesdir}/63-scsi-sg3_symlink.rules +%{_udevrulesdir}/63-fc-wwpn-id.rules +%{_udevrulesdir}/65-scsi-cciss_id.rules +%{_udevrulesdir}/40-usb-blacklist.rules +/usr/lib/udev/* %files libs %doc BSD_LICENSE COPYING @@ -86,6 +108,13 @@ install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8 %changelog +* Fri Jan 03 2020 Tomas Bzatek - 1.44-1 +- Rebase to 1.44 release +- Enable supplemental udev rules +- Fix sg_turs help invocation in an old mode (#1683343) +- Fix sg_raw printing error about device not specified on version request (#1627657) +- Fix coverity scan warnings (#1633235) + * Fri Jul 26 2019 Fedora Release Engineering - 1.42-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild diff --git a/sg_raw-version.patch b/sg_raw-version.patch new file mode 100644 index 0000000..ab5cb6a --- /dev/null +++ b/sg_raw-version.patch @@ -0,0 +1,28 @@ +From c683e6e2bc62b43c140934b919323d107b0a48cb Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Tue, 28 May 2019 16:06:06 +0200 +Subject: [PATCH] sg_raw: do not print error about device not specified on + version request + +--- + src/sg_raw.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/sg_raw.c b/src/sg_raw.c +index 33a85f7c..453ff42a 100644 +--- a/src/sg_raw.c ++++ b/src/sg_raw.c +@@ -440,6 +440,13 @@ parse_cmd_line(struct opts_t * op, int argc, char *argv[]) + } + } + ++ if (op->version_given ++#ifdef DEBUG ++ && ! op->verbose_given ++#endif ++ ) ++ return 0; ++ + if (optind >= argc) { + pr2serr("No device specified\n\n"); + return SG_LIB_SYNTAX_ERROR; diff --git a/sg_turs-help.patch b/sg_turs-help.patch new file mode 100644 index 0000000..da7de09 --- /dev/null +++ b/sg_turs-help.patch @@ -0,0 +1,24 @@ +From 116e665ddb7b38bb8f7065ddb08192bd3551897d Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Tue, 26 Feb 2019 16:45:59 +0100 +Subject: [PATCH] sg_turs: fix help invocation in the old mode + +In the old mode the usage was printed out twice when called +by `sg_turs -O -?`. +--- + src/sg_turs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/sg_turs.c b/src/sg_turs.c +index 8c6e3792..a318d22c 100644 +--- a/src/sg_turs.c ++++ b/src/sg_turs.c +@@ -252,7 +252,7 @@ old_parse_cmd_line(struct opts_t * op, int argc, char * argv[]) + op->version_given = true; + break; + case '?': +- usage_old(); ++ ++op->do_help; + return 0; + default: + jmp_out = true; diff --git a/sources b/sources index 93e4f09..0f837e1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (sg3_utils-1.42.tar.xz) = 7672a9f2ed5064b6a528d1777510704d72a076bc45f7e92b16f70246ab75212078feb485f88674483a9157883516c20ae76d14d6e0fb80e38da105c0b24ff3b8 +SHA512 (sg3_utils-1.44.tar.xz) = 4f4d5536ebed62f2c81c55741043d9ac3f4610a4dd6ef2e3125f041afd57aae03a32c2affe84a960c9f61fb6f84784bc901c756a8c36c1bc97082fa61e73ae8d From 19a871b76c521f362fa67696a319b537c94f94a4 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Fri, 3 Jan 2020 18:16:31 +0100 Subject: [PATCH 02/23] Fix %{_udevrulesdir} macro presence --- sg3_utils.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/sg3_utils.spec b/sg3_utils.spec index 1a462a2..7dd843f 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -23,6 +23,7 @@ Patch3: fc_wwpn_id-non_FC-devices.patch URL: http://sg.danny.cz/sg/sg3_utils.html Requires: %{name}-libs%{?_isa} = %{version}-%{release} BuildRequires: gcc +BuildRequires: systemd %description From 2ded79587814551f6538c1444c026cdefb392cc6 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Mon, 6 Jan 2020 16:51:31 +0100 Subject: [PATCH 03/23] * Mon Jan 06 2020 Tomas Bzatek - 1.44-2 - Backport "rescan-scsi-bus.sh: use LUN wildcard in idlist" --- ...si-bus.sh_use_LUN_wildcard_in_idlist.patch | 34 +++++++++++++++++++ sg3_utils.spec | 7 +++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 sg3_utils-1.45_rescan-scsi-bus.sh_use_LUN_wildcard_in_idlist.patch diff --git a/sg3_utils-1.45_rescan-scsi-bus.sh_use_LUN_wildcard_in_idlist.patch b/sg3_utils-1.45_rescan-scsi-bus.sh_use_LUN_wildcard_in_idlist.patch new file mode 100644 index 0000000..5a4fcf8 --- /dev/null +++ b/sg3_utils-1.45_rescan-scsi-bus.sh_use_LUN_wildcard_in_idlist.patch @@ -0,0 +1,34 @@ +From linux-scsi Thu Oct 25 08:49:11 2018 +From: Martin Wilck +Date: Thu, 25 Oct 2018 08:49:11 +0000 +To: linux-scsi +Subject: [PATCH] rescan-scsi-bus.sh: use LUN wildcard in idlist +Message-Id: <20181025084911.19958-1-mwilck () suse ! com> +X-MARC-Message: https://marc.info/?l=linux-scsi&m=154045737232713 + +By scanning for LUN 0 only, we may encounter a device that the +kernel won't add (e.g. peripheral device type 31) and which may +thus never appear in sysfs for us to use for REPORT LUNS. That +causes LUN additions for such devices to be missed by +"rescan-iscsi-bus.sh -a". + +Signed-off-by: Martin Wilck +--- + scripts/rescan-scsi-bus.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh +index 6989208..a2aa8d8 100755 +--- a/scripts/rescan-scsi-bus.sh ++++ b/scripts/rescan-scsi-bus.sh +@@ -376,7 +376,7 @@ idlist () + + oldlist=$(ls /sys/class/scsi_device/ | sed -n "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq) + # Rescan LUN 0 to check if we found new targets +- echo "${channel} - 0" > /sys/class/scsi_host/host${host}/scan ++ echo "${channel} - -" > /sys/class/scsi_host/host${host}/scan + newlist=$(ls /sys/class/scsi_device/ | sed -n "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq) + for newid in $newlist ; do + oldid=$newid +-- +2.19.1 diff --git a/sg3_utils.spec b/sg3_utils.spec index 7dd843f..b2a5de7 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -3,7 +3,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.44 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 @@ -19,6 +19,8 @@ Patch2: sg_raw-version.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1760847 # FC_TARGET_LUN attribute assigned for non FC device Patch3: fc_wwpn_id-non_FC-devices.patch +# backport from svn +Patch4: sg3_utils-1.45_rescan-scsi-bus.sh_use_LUN_wildcard_in_idlist.patch URL: http://sg.danny.cz/sg/sg3_utils.html Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -109,6 +111,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Mon Jan 06 2020 Tomas Bzatek - 1.44-2 +- Backport "rescan-scsi-bus.sh: use LUN wildcard in idlist" + * Fri Jan 03 2020 Tomas Bzatek - 1.44-1 - Rebase to 1.44 release - Enable supplemental udev rules From 669d1a9086f30c674a8420ae6b8e9f4a4c3cbe6b Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 30 Jan 2020 23:18:54 +0000 Subject: [PATCH 04/23] - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- sg3_utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index b2a5de7..0e1718b 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -3,7 +3,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.44 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 @@ -111,6 +111,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Thu Jan 30 2020 Fedora Release Engineering - 1.44-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + * Mon Jan 06 2020 Tomas Bzatek - 1.44-2 - Backport "rescan-scsi-bus.sh: use LUN wildcard in idlist" From a4eab4fb1a871140865d3cb5fbe56cb5c4e12608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 12 Mar 2020 12:05:31 +0100 Subject: [PATCH 05/23] - update to version 1.45 (#1809392) --- BZ_1633235-sg3_utils-1.44-covscan-fix.patch | 1427 ----------------- ...si-bus.sh_use_LUN_wildcard_in_idlist.patch | 34 - sg3_utils.spec | 12 +- 3 files changed, 6 insertions(+), 1467 deletions(-) delete mode 100644 BZ_1633235-sg3_utils-1.44-covscan-fix.patch delete mode 100644 sg3_utils-1.45_rescan-scsi-bus.sh_use_LUN_wildcard_in_idlist.patch diff --git a/BZ_1633235-sg3_utils-1.44-covscan-fix.patch b/BZ_1633235-sg3_utils-1.44-covscan-fix.patch deleted file mode 100644 index 3ac642b..0000000 --- a/BZ_1633235-sg3_utils-1.44-covscan-fix.patch +++ /dev/null @@ -1,1427 +0,0 @@ -From 7a39d7758c9c799bc6341a8a339a91692ec8a9dd Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Tue, 25 Sep 2018 18:52:26 +0800 -Subject: [PATCH 01/30] Fix overrunning array. - -Issue: - * `jrp` might pointing outside of join_arr after the for loop. - * Out of index: `op->cdb`. - -Fix: - * Check index number before dereferencing `jpr` pointer. - * Check index number before access `op->cdb` array. - -Signed-off-by: Gris Ge ---- - src/sg_raw.c | 2 +- - src/sg_ses.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/sg_raw.c b/src/sg_raw.c -index 92c2287..90c3d9c 100644 ---- a/src/sg_raw.c -+++ b/src/sg_raw.c -@@ -454,7 +454,7 @@ parse_cmd_line(struct opts_t * op, int argc, char *argv[]) - return SG_LIB_SYNTAX_ERROR; - } - -- if (op->cdb_length > MAX_SCSI_CDBSZ) { -+ if (op->cdb_length >= MAX_SCSI_CDBSZ) { - pr2serr("CDB too long (max. %d bytes)\n", MAX_SCSI_CDBSZ); - return SG_LIB_SYNTAX_ERROR; - } -diff --git a/src/sg_ses.c b/src/sg_ses.c -index abb1fea..29b66b3 100644 ---- a/src/sg_ses.c -+++ b/src/sg_ses.c -@@ -5310,7 +5310,7 @@ ses_cgs(struct sg_pt_base * ptvp, const struct tuple_acronym_val * tavp, - if (op->ind_indiv_last <= op->ind_indiv) - break; - } /* end of loop over join array */ -- if ((NULL == jrp->enc_statp) || (k >= MX_JOIN_ROWS)) { -+ if ((k >= MX_JOIN_ROWS) || (NULL == jrp->enc_statp)) { - if (op->desc_name) - pr2serr("descriptor name: %s not found (check the 'ed' page " - "[0x7])\n", op->desc_name); --- -1.8.3.1 - - -From ad7d26c94ad555a647528c31eb11b78fc0ac4474 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Tue, 25 Sep 2018 18:59:01 +0800 -Subject: [PATCH 02/30] sg_persist: Workaround for false warning of covscan. - -The covscan think we might access out of index on `tid_arr` but -actually we did the index check before. - -Signed-off-by: Gris Ge ---- - src/sg_persist.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/sg_persist.c b/src/sg_persist.c -index f582d32..b565a5a 100644 ---- a/src/sg_persist.c -+++ b/src/sg_persist.c -@@ -824,7 +824,7 @@ decode_file_tids(const char * fnp, struct opts_t * op) - pr2serr("%s: array length exceeded\n", __func__); - goto bad; - } -- tid_arr[off + k] = h; -+ op->transportid_arr[off + k] = h; - lcp = strpbrk(lcp, " ,\t"); - if (NULL == lcp) - break; --- -1.8.3.1 - - -From 24e54cf4c04fa7aa3bdf8e7315ce6240ab306c5f Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Tue, 25 Sep 2018 19:12:34 +0800 -Subject: [PATCH 03/30] sg_opcodes: Fix overrun of array. - -Overrunning array `b` as 4 + m might bigger than the size of array `b`. - -Signed-off-by: Gris Ge ---- - src/sg_opcodes.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/sg_opcodes.c b/src/sg_opcodes.c -index 21897c4..a8cf762 100644 ---- a/src/sg_opcodes.c -+++ b/src/sg_opcodes.c -@@ -799,7 +799,8 @@ list_all_codes(uint8_t * rsoc_buff, int rsoc_len, struct opts_t * op, - printf(" usage: "); - else - printf(" cdb usage: "); -- for (m = 0; m < cdb_sz; ++m) -+ for (m = 0; (m < cdb_sz) && ((size_t) (4 + m) < sizeof(b)); -+ ++m) - printf("%.2x ", b[4 + m]); - printf("\n"); - } --- -1.8.3.1 - - -From ca241cf82c746391edb3b460550310da40202fe4 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 20:34:42 +0800 -Subject: [PATCH 04/30] sg_lib: Fix overruning of array - `sg_lib_scsi_status_sense_arr` - -Check index before dereferencing `mp`. - -Signed-off-by: Gris Ge ---- - include/sg_lib_data.h | 2 ++ - lib/sg_lib.c | 3 +++ - lib/sg_lib_data.c | 6 ++++++ - 3 files changed, 11 insertions(+) - -diff --git a/include/sg_lib_data.h b/include/sg_lib_data.h -index a870043..9739453 100644 ---- a/include/sg_lib_data.h -+++ b/include/sg_lib_data.h -@@ -122,6 +122,8 @@ extern struct sg_lib_simple_value_name_t sg_lib_nvme_nvm_cmd_arr[]; - extern struct sg_lib_value_name_t sg_lib_nvme_cmd_status_arr[]; - extern struct sg_lib_4tuple_u8 sg_lib_scsi_status_sense_arr[]; - -+size_t sg_lib_scsi_status_sense_arr_len(void); -+ - extern struct sg_value_2names_t sg_exit_str_arr[]; - - #ifdef __cplusplus -diff --git a/lib/sg_lib.c b/lib/sg_lib.c -index c2c5891..c281cce 100644 ---- a/lib/sg_lib.c -+++ b/lib/sg_lib.c -@@ -2585,6 +2585,9 @@ sg_nvme_status2scsi(uint16_t sct_sc, uint8_t * status_p, uint8_t * sk_p, - return false; - } else if (ind >= k) - return false; -+ /* Check whether `ind` is out of index of sg_lib_scsi_status_sense_arr */ -+ if (ind >= (int) sg_lib_scsi_status_sense_arr_len()) -+ return false; - mp = sg_lib_scsi_status_sense_arr + ind; - if (status_p) - *status_p = mp->t1; -diff --git a/lib/sg_lib_data.c b/lib/sg_lib_data.c -index d5ca380..3a898e5 100644 ---- a/lib/sg_lib_data.c -+++ b/lib/sg_lib_data.c -@@ -1850,3 +1850,9 @@ struct sg_value_2names_t sg_exit_str_arr[] = { - }; - - #endif /* (SG_SCSI_STRINGS && HAVE_NVME && (! IGNORE_NVME)) */ -+ -+size_t sg_lib_scsi_status_sense_arr_len(void) -+{ -+ return sizeof(sg_lib_scsi_status_sense_arr)/ -+ sizeof(struct sg_lib_4tuple_u8) - 1; -+} --- -1.8.3.1 - - -From 36a487285d9e7c9afce9acaefa8fad25017cacd8 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Fri, 28 Sep 2018 20:56:26 +0800 -Subject: [PATCH 05/30] sginfo,sg_dd: Fix resource leak. - - * sginfo: Free the memory of `headsp`. - * sg_dd: Close infd/outfd before return error. - -Signed-off-by: Gris Ge ---- - src/sg_dd.c | 6 ++++++ - src/sginfo.c | 1 + - 2 files changed, 7 insertions(+) - -diff --git a/src/sg_dd.c b/src/sg_dd.c -index edd8f9c..6bdbcdb 100644 ---- a/src/sg_dd.c -+++ b/src/sg_dd.c -@@ -1276,6 +1276,7 @@ open_if(const char * inf, int64_t skip, int bpt, struct flags_t * ifp, - perror(ME "SG_SET_RESERVED_SIZE error"); - res = ioctl(infd, SG_GET_VERSION_NUM, &t); - if ((res < 0) || (t < 30000)) { -+ close(infd); - if (FT_BLOCK & *in_typep) - pr2serr(ME "SG_IO unsupported on this block device\n"); - else -@@ -1308,6 +1309,7 @@ open_if(const char * inf, int64_t skip, int bpt, struct flags_t * ifp, - snprintf(ebuff, EBUFF_SZ, ME "couldn't skip to " - "required position on %s", inf); - perror(ebuff); -+ close(infd); - goto file_err; - } - if (vb) -@@ -1341,6 +1343,7 @@ open_if(const char * inf, int64_t skip, int bpt, struct flags_t * ifp, - file_err: - return -SG_LIB_FILE_ERROR; - other_err: -+ close(infd); - return -SG_LIB_CAT_OTHER; - } - -@@ -1398,6 +1401,7 @@ open_of(const char * outf, int64_t seek, int bpt, struct flags_t * ofp, - perror(ME "SG_SET_RESERVED_SIZE error"); - res = ioctl(outfd, SG_GET_VERSION_NUM, &t); - if ((res < 0) || (t < 30000)) { -+ close(outfd); - pr2serr(ME "sg driver prior to 3.x.y\n"); - goto file_err; - } -@@ -1447,6 +1451,7 @@ open_of(const char * outf, int64_t seek, int bpt, struct flags_t * ofp, - snprintf(ebuff, EBUFF_SZ, - ME "couldn't seek to required position on %s", outf); - perror(ebuff); -+ close(outfd); - goto file_err; - } - if (vb) -@@ -1469,6 +1474,7 @@ open_of(const char * outf, int64_t seek, int bpt, struct flags_t * ofp, - file_err: - return -SG_LIB_FILE_ERROR; - other_err: -+ close(outfd); - return -SG_LIB_CAT_OTHER; - } - -diff --git a/src/sginfo.c b/src/sginfo.c -index bddc964..1032f05 100644 ---- a/src/sginfo.c -+++ b/src/sginfo.c -@@ -1825,6 +1825,7 @@ trytenbyte: - } - } - printf("\n"); -+ free(headsp); - return status; - } - --- -1.8.3.1 - - -From 5bd764553056b2182db8ef8d6c1a1ab09b0d5a24 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 21:10:23 +0800 -Subject: [PATCH 06/30] covscan: Calling func without checking return value - -* Use the macro `_ignore_return()` defined in `misc.h` to ignore the - return value of functions. - -Signed-off-by: Gris Ge ---- - src/misc.h | 34 ++++++++++++++++++++++++++++++++++ - src/sg_get_config.c | 6 ++++-- - src/sg_logs.c | 6 ++++-- - src/sg_persist.c | 13 +++++++++---- - src/sg_xcopy.c | 23 +++++++++++++---------- - 5 files changed, 64 insertions(+), 18 deletions(-) - create mode 100644 src/misc.h - -diff --git a/src/misc.h b/src/misc.h -new file mode 100644 -index 0000000..6289eae ---- /dev/null -+++ b/src/misc.h -@@ -0,0 +1,34 @@ -+/* -+ * Copyright (c) 2018 Red Hat, Inc. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions -+ * are met: -+ * 1. Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * 2. Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. -+ * -+ * Author: Gris Ge -+ */ -+#ifndef __SG_UTILS_MISC_H__ -+#define __SG_UTILS_MISC_H__ -+ -+/* Just make coverity scan happy. */ -+#define _ignore_return(x) if (x) {} -+ -+#endif /* End of __SG_UTILS_MISC_H__ */ -diff --git a/src/sg_get_config.c b/src/sg_get_config.c -index 28af720..4d2cc9b 100644 ---- a/src/sg_get_config.c -+++ b/src/sg_get_config.c -@@ -24,6 +24,8 @@ - #include "sg_unaligned.h" - #include "sg_pr2serr.h" - -+#include "misc.h" -+ - /* A utility program originally written for the Linux OS SCSI subsystem. - * - * This program outputs information provided by a SCSI "Get Configuration" -@@ -1091,7 +1093,7 @@ main(int argc, char * argv[]) - pr2serr(ME "%s doesn't respond to a SCSI INQUIRY\n", device_name); - return SG_LIB_CAT_OTHER; - } -- sg_cmds_close_device(sg_fd); -+ _ignore_return(sg_cmds_close_device(sg_fd)); - - sg_fd = sg_cmds_open_device(device_name, readonly, verbose); - if (sg_fd < 0) { -@@ -1122,7 +1124,7 @@ main(int argc, char * argv[]) - } else { - char b[80]; - -- sg_get_category_sense_str(res, sizeof(b), b, verbose); -+ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, verbose)); - pr2serr("Get Configuration command: %s\n", b); - if (0 == verbose) - pr2serr(" try '-v' option for more information\n"); -diff --git a/src/sg_logs.c b/src/sg_logs.c -index 61443ff..e4f265e 100644 ---- a/src/sg_logs.c -+++ b/src/sg_logs.c -@@ -34,6 +34,8 @@ - #include "sg_unaligned.h" - #include "sg_pr2serr.h" - -+#include "misc.h" -+ - static const char * version_str = "1.69 20180911"; /* spc5r19 + sbc4r11 */ - - #define MX_ALLOC_LEN (0xfffc) -@@ -6776,7 +6778,7 @@ fetchTemperature(int sg_fd, uint8_t * resp, int max_len, struct opts_t * op) - pr2serr("Unable to find temperature in either Temperature or " - "IE log page\n"); - } -- sg_cmds_close_device(sg_fd); -+ _ignore_return(sg_cmds_close_device(sg_fd)); - return (res >= 0) ? res : SG_LIB_CAT_OTHER; - } - -@@ -7246,7 +7248,7 @@ err_out: - if (free_parr) - free(free_parr); - if (sg_fd >= 0) -- sg_cmds_close_device(sg_fd); -+ _ignore_return(sg_cmds_close_device(sg_fd)); - if (0 == vb) { - if (! sg_if_can2stderr("sg_logs failed: ", ret)) - pr2serr("Some error occurred, try again with '-v' or '-vv' for " -diff --git a/src/sg_persist.c b/src/sg_persist.c -index b565a5a..2e10aff 100644 ---- a/src/sg_persist.c -+++ b/src/sg_persist.c -@@ -33,6 +33,8 @@ - #include "sg_unaligned.h" - #include "sg_pr2serr.h" - -+#include "misc.h" -+ - static const char * version_str = "0.66 20180615"; - - -@@ -303,7 +305,8 @@ prin_work(int sg_fd, const struct opts_t * op) - pr2serr("PR in (%s): bad field in cdb or parameter list (perhaps " - "unsupported service action)\n", b); - else { -- sg_get_category_sense_str(res, sizeof(bb), bb, op->verbose); -+ _ignore_return(sg_get_category_sense_str(res, sizeof(bb), bb, -+ op->verbose)); - pr2serr("PR in (%s): %s\n", b, bb); - } - goto fini; -@@ -519,7 +522,8 @@ prout_work(int sg_fd, struct opts_t * op) - pr2serr("PR out (%s): bad field in cdb or parameter list " - "(perhaps unsupported service action)\n", b); - else { -- sg_get_category_sense_str(res, sizeof(bb), bb, op->verbose); -+ _ignore_return(sg_get_category_sense_str(res, sizeof(bb), bb, -+ op->verbose)); - pr2serr("PR out (%s): %s\n", b, bb); - } - goto fini; -@@ -573,7 +577,8 @@ prout_reg_move_work(int sg_fd, struct opts_t * op) - else { - char bb[80]; - -- sg_get_category_sense_str(res, sizeof(bb), bb, op->verbose); -+ _ignore_return(sg_get_category_sense_str(res, sizeof(bb), bb, -+ op->verbose)); - pr2serr("PR out (register and move): %s\n", bb); - } - goto fini; -@@ -1277,7 +1282,7 @@ main(int argc, char * argv[]) - flagged = true; - goto fini; - } -- sg_cmds_close_device(sg_fd); -+ _ignore_return(sg_cmds_close_device(sg_fd)); - } - - if (! op->readwrite_force) { -diff --git a/src/sg_xcopy.c b/src/sg_xcopy.c -index 5facfc8..6230685 100644 ---- a/src/sg_xcopy.c -+++ b/src/sg_xcopy.c -@@ -67,6 +67,8 @@ - #include "sg_unaligned.h" - #include "sg_pr2serr.h" - -+#include "misc.h" -+ - static const char * version_str = "0.68 20180811"; - - #define ME "sg_xcopy: " -@@ -341,7 +343,7 @@ open_sg(struct xcopy_fp_t * fp, int vb) - } - if (sg_simple_inquiry(fp->sg_fd, &sir, false, vb)) { - pr2serr("INQUIRY failed on %s\n", ebuff); -- sg_cmds_close_device(fp->sg_fd); -+ _ignore_return(sg_cmds_close_device(fp->sg_fd)); - fp->sg_fd = -1; - return -1; - } -@@ -415,7 +417,7 @@ dd_filetype_str(int ft, char * buff) - if (FT_OTHER & ft) - off += sg_scnpr(buff + off, 32, "other (perhaps ordinary file) "); - if (FT_ERROR & ft) -- sg_scnpr(buff + off, 32, "unable to 'stat' file "); -+ _ignore_return(sg_scnpr(buff + off, 32, "unable to 'stat' file ")); - return buff; - } - -@@ -640,7 +642,7 @@ scsi_extended_copy(int sg_fd, uint8_t list_id, - DEF_GROUP_NUM, DEF_3PC_OUT_TIMEOUT, - xcopyBuff, desc_offset, true, verb); - if (res) { -- sg_get_category_sense_str(res, sizeof(b), b, verb); -+ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, verb)); - pr2serr("Xcopy(LID1): %s\n", b); - } - return res; -@@ -660,7 +662,7 @@ scsi_read_capacity(struct xcopy_fp_t *xfp) - res = sg_ll_readcap_10(xfp->sg_fd, false /* pmi */, 0, rcBuff, - READ_CAP_REPLY_LEN, true, verb); - if (0 != res) { -- sg_get_category_sense_str(res, sizeof(b), b, verb); -+ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, verb)); - pr2serr("Read capacity(10): %s\n", b); - return res; - } -@@ -672,7 +674,7 @@ scsi_read_capacity(struct xcopy_fp_t *xfp) - res = sg_ll_readcap_16(xfp->sg_fd, false /* pmi */, 0, rcBuff, - RCAP16_REPLY_LEN, true, verb); - if (0 != res) { -- sg_get_category_sense_str(res, sizeof(b), b, verb); -+ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, verb)); - pr2serr("Read capacity(16): %s\n", b); - return res; - } -@@ -714,7 +716,7 @@ scsi_operating_parameter(struct xcopy_fp_t *xfp, int is_target) - res = sg_ll_receive_copy_results(xfp->sg_fd, SA_COPY_OP_PARAMS, 0, rcBuff, - rcBuffLen, true, verb); - if (0 != res) { -- sg_get_category_sense_str(res, sizeof(b), b, verb); -+ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, verb)); - pr2serr("Xcopy operating parameters: %s\n", b); - return -res; - } -@@ -1006,8 +1008,8 @@ decode_designation_descriptor(const uint8_t * bp, int i_len) - { - char c[2048]; - -- sg_get_designation_descriptor_str(NULL, bp, i_len, 1, verbose, -- sizeof(c), c); -+ _ignore_return(sg_get_designation_descriptor_str(NULL, bp, i_len, 1, -+ verbose, sizeof(c), c)); - pr2serr("%s", c); - } - -@@ -1029,7 +1031,8 @@ desc_from_vpd_id(int sg_fd, uint8_t *desc, int desc_len, - if (SG_LIB_CAT_ILLEGAL_REQ == res) - pr2serr("Device identification VPD page not found\n"); - else { -- sg_get_category_sense_str(res, sizeof(b), b, verbose); -+ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, -+ verbose)); - pr2serr("VPD inquiry (Device ID): %s\n", b); - pr2serr(" try again with '-vv'\n"); - } -@@ -1042,7 +1045,7 @@ desc_from_vpd_id(int sg_fd, uint8_t *desc, int desc_len, - res = sg_ll_inquiry(sg_fd, false, true, VPD_DEVICE_ID, rcBuff, len, true, - verb); - if (0 != res) { -- sg_get_category_sense_str(res, sizeof(b), b, verbose); -+ _ignore_return(sg_get_category_sense_str(res, sizeof(b), b, verbose)); - pr2serr("VPD inquiry (Device ID): %s\n", b); - return res; - } else if (rcBuff[1] != VPD_DEVICE_ID) { --- -1.8.3.1 - - -From 3a99f93d11cea7d4273477c698eb6bfb2f6d4696 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 22:14:11 +0800 -Subject: [PATCH 07/30] sg_dd: flock does not allows negative fd. - - * The `outfd` could be -1 in line 1408. We do negative number check on - `outfd` before sending to flock. - -Signed-off-by: Gris Ge ---- - src/sg_dd.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/sg_dd.c b/src/sg_dd.c -index 6bdbcdb..8696ee7 100644 ---- a/src/sg_dd.c -+++ b/src/sg_dd.c -@@ -1459,7 +1459,7 @@ open_of(const char * outf, int64_t seek, int bpt, struct flags_t * ofp, - "\n", (uint64_t)offset); - } - } -- if (ofp->flock) { -+ if ((ofp->flock) && (outfd >= 0)) { - res = flock(outfd, LOCK_EX | LOCK_NB); - if (res < 0) { - close(outfd); --- -1.8.3.1 - - -From 158f6547f156b8a7fc175904b4bd502642ed56a5 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 22:21:00 +0800 -Subject: [PATCH 08/30] sginfo: Suspend the fallthrough warning. - -* The GCC and Clang will complain about fallthrough of switch statement, - use maker comments to suspend that. - -Signed-off-by: Gris Ge ---- - src/sginfo.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/sginfo.c b/src/sginfo.c -index 1032f05..9c626ee 100644 ---- a/src/sginfo.c -+++ b/src/sginfo.c -@@ -1757,6 +1757,7 @@ trytenbyte: - } - else if (!sorthead) printf("|"); - } -+ /* fall through */ - case 5: /* physical sector */ - while (len > 0) { - snprintf((char *)cbuffer1, 40, "%6d:%2u:%5d", -@@ -1775,6 +1776,7 @@ trytenbyte: - } - else if (!sorthead) printf("|"); - } -+ /* fall through */ - case 0: /* lba (32 bit) */ - while (len > 0) { - printf("%10d", getnbyte(df, 4)); -@@ -1788,6 +1790,7 @@ trytenbyte: - else - printf("|"); - } -+ /* fall through */ - case 3: /* lba (64 bit) */ - while (len > 0) { - printf("%15" PRId64 , getnbyte_ll(df, 8)); --- -1.8.3.1 - - -From 7e90f135eeb3900735847df32ed878d8207c59dc Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 22:24:01 +0800 -Subject: [PATCH 09/30] sg_get_lba_status: Fix incorrect use of - sg_ll_get_lba_status32. - -Fix the incorrect argument order of `sg_get_lba_status()`. - -Signed-off-by: Gris Ge ---- - src/sg_get_lba_status.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/sg_get_lba_status.c b/src/sg_get_lba_status.c -index 91c7a96..61a823b 100644 ---- a/src/sg_get_lba_status.c -+++ b/src/sg_get_lba_status.c -@@ -340,7 +340,7 @@ main(int argc, char * argv[]) - res = sg_ll_get_lba_status16(sg_fd, lba, rt, glbasBuffp, maxlen, true, - verbose); - else if (do_32) /* keep analyser happy since do_32 must be true */ -- res = sg_ll_get_lba_status32(sg_fd, lba, element_id, scan_len, rt, -+ res = sg_ll_get_lba_status32(sg_fd, lba, scan_len, element_id, rt, - glbasBuffp, maxlen, true, verbose); - - ret = res; --- -1.8.3.1 - - -From c86a7be69c8601722ba39ef6eacc6aaa993b3d5a Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 22:35:35 +0800 -Subject: [PATCH 10/30] rescan-scsi-bus.sh: Fix shellcheck warning of SC2155. - -Declare and assign separately to avoid masking return values: - https://github.com/koalaman/shellcheck/wiki/SC2155 - -Signed-off-by: Gris Ge ---- - scripts/rescan-scsi-bus.sh | 24 ++++++++++++++++-------- - 1 file changed, 16 insertions(+), 8 deletions(-) - -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 6989208..75e169a 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -314,8 +314,10 @@ testonline () - fi - else - # Ignore disk revision change -- local old_str_no_rev=`echo "$TMPSTR" | sed -e 's/.\{4\}$//'` -- local new_str_no_rev=`echo "$STR" | sed -e 's/.\{4\}$//'` -+ local old_str_no_rev -+ old_str_no_rev=`echo "$TMPSTR" | sed -e 's/.\{4\}$//'` -+ local new_str_no_rev -+ new_str_no_rev=`echo "$STR" | sed -e 's/.\{4\}$//'` - if [ "$old_str_no_rev" != "$new_str_no_rev" ]; then - echo -e "\e[A\e[A\e[A\e[A${red}$SGDEV changed: ${bold}\nfrom:${SCSISTR#* } \nto: $STR ${norm} \n\n\n" - return 1 -@@ -696,7 +698,8 @@ searchexisting() - local tmpch; - local tmpid - local match=0 -- local targets=`ls -d /sys/class/scsi_device/$host:* 2> /dev/null | egrep -o $host:[0-9]+:[0-9]+ | sort | uniq` -+ local targets -+ targets=`ls -d /sys/class/scsi_device/$host:* 2> /dev/null | egrep -o $host:[0-9]+:[0-9]+ | sort | uniq` - - # Nothing came back on this host, so we should skip it - test -z "$targets" && return -@@ -742,13 +745,15 @@ searchexisting() - findremapped() - { - local hctl=; -- local devs=`ls /sys/class/scsi_device/` -+ local devs -+ devs=`ls /sys/class/scsi_device/` - local sddev= - local id_serial= - local id_serial_old= - local remapped= - mpaths="" -- local tmpfile=$(mktemp /tmp/rescan-scsi-bus.XXXXXXXX 2> /dev/null) -+ local tmpfile -+ tmpfile=$(mktemp /tmp/rescan-scsi-bus.XXXXXXXX 2> /dev/null) - - if [ -z "$tmpfile" ] ; then - tmpfile="/tmp/rescan-scsi-bus.$$" -@@ -835,7 +840,8 @@ incrchgd() - fi - - if test -n "$mp_enable" ; then -- local sdev="`findsddev \"$hctl\"`" -+ local sdev -+ sdev="`findsddev \"$hctl\"`" - if test -n "$sdev" ; then - findmultipath "$sdev" - fi -@@ -853,7 +859,8 @@ incrrmvd() - fi - - if test -n "$mp_enable" ; then -- local sdev="`findsddev \"$hctl\"`" -+ local sdev -+ sdev="`findsddev \"$hctl\"`" - if test -n "$sdev" ; then - findmultipath "$sdev" - fi -@@ -902,7 +909,8 @@ findmultipath() - return 1 - fi - -- local maj_min=`cat /sys/block/$dev/dev` -+ local maj_min -+ maj_min=`cat /sys/block/$dev/dev` - for mp in $($DMSETUP ls --target=multipath | cut -f 1) ; do - [ "$mp" = "No" ] && break; - if $DMSETUP status $mp | grep -q " $maj_min "; then --- -1.8.3.1 - - -From 0185fcb6527b331082eb10ef733a2a2f746578d8 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 22:36:44 +0800 -Subject: [PATCH 11/30] rescan-scsi-bus.sh: Fix incorrect use of `break`. - -Should use `return` instead in `if` code block. - -Signed-off-by: Gris Ge ---- - scripts/rescan-scsi-bus.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 75e169a..37f121d 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -548,7 +548,7 @@ dolunscan() - 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 -- break; -+ return; - fi - else - if test "$remappedlun0" != "2" ; then --- -1.8.3.1 - - -From 533e455337251971a94b5d9bce2183fb55383db6 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 22:39:13 +0800 -Subject: [PATCH 12/30] rescan-scsi-bus.sh: Use dummy for throwaway variable. - -* The `offset` is unused and should be replaced by dummy `_`. - https://github.com/koalaman/shellcheck/wiki/SC2034 - -Signed-off-by: Gris Ge ---- - scripts/rescan-scsi-bus.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 37f121d..ed3cf49 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -235,7 +235,7 @@ 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=$(od -tx1 -j1 -N1 "$p" 2>/dev/null | -- { read -r offset byte rest; echo -n "$byte"; }) -+ { read -r _ byte rest; echo -n "$byte"; }) - if [ -n "$b" ]; then - echo $(((0x$b & 0x80) != 0)) - else --- -1.8.3.1 - - -From 751afef7a7a5049a6d1a6171efb65e9e2f515911 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 22:55:08 +0800 -Subject: [PATCH 13/30] sg_write_x: parameter string might overflow a char - array. - - * The `lcp` might overflow the char array `c`. Use `snprintf` instead. - -Signed-off-by: Gris Ge ---- - src/sg_write_x.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/src/sg_write_x.c b/src/sg_write_x.c -index 3b8f091..89b5616 100644 ---- a/src/sg_write_x.c -+++ b/src/sg_write_x.c -@@ -671,8 +671,10 @@ parse_scat_pi_line(const char * lcp, uint8_t * up, uint32_t * sum_num) - if (cp) { /* copy from first non whitespace ... */ - memcpy(c, lcp, cp - lcp); /* ... to just prior to first '#' */ - c[cp - lcp] = '\0'; -- } else -- strcpy(c, lcp); /* ... to end of line, including null */ -+ } else { -+ /* ... to end of line, including null */ -+ snprintf(c, sizeof(c)/sizeof(char), "%s", lcp); -+ } - ll = sg_get_llnum(bp); - ok = ((-1 != ll) || all_ascii_f_s(bp, 16)); - if (! ok) { --- -1.8.3.1 - - -From cd7fdbdeffabd41fe9e9c65e1158cbdb6f906f20 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 22:56:48 +0800 -Subject: [PATCH 14/30] sg_vpd_vendor: Fix potential string overflow. - -Currently, none of `vendor_vpd_pg` name string is longer than 64, -to ease the coverity scan, change strcpy to snprintf. - -Signed-off-by: Gris Ge ---- - src/sg_vpd_vendor.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/sg_vpd_vendor.c b/src/sg_vpd_vendor.c -index 3c75177..9a73748 100644 ---- a/src/sg_vpd_vendor.c -+++ b/src/sg_vpd_vendor.c -@@ -1420,7 +1420,7 @@ svpd_decode_vendor(int sg_fd, struct opts_t * op, int off) - if (0 == res) { - vnp = svpd_get_v_detail(op->vpd_pn, op->vend_prod_num, 0xf & rp[0]); - if (vnp && vnp->name) -- strcpy(name, vnp->name); -+ snprintf(name, sizeof(name)/sizeof(char), "%s", vnp->name); - else - snprintf(name, sizeof(name) - 1, "Vendor VPD page=0x%x", - op->vpd_pn); --- -1.8.3.1 - - -From 7ddd2de9d7c7ebcfcb3c33da9993cb60a91b0525 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 23:38:05 +0800 -Subject: [PATCH 15/30] sg_write_x: Remove dead code. - -* The `k` is always smaller than 3, `default:` will never be reached. -* The `ok` is already checked for non-zero. - -Signed-off-by: Gris Ge ---- - src/sg_write_x.c | 10 +--------- - 1 file changed, 1 insertion(+), 9 deletions(-) - -diff --git a/src/sg_write_x.c b/src/sg_write_x.c -index 89b5616..d6949ed 100644 ---- a/src/sg_write_x.c -+++ b/src/sg_write_x.c -@@ -750,10 +750,6 @@ parse_scat_pi_line(const char * lcp, uint8_t * up, uint32_t * sum_num) - } else if (up) - sg_put_unaligned_be16((uint16_t)ll, up + 18); - break; -- default: -- pr2serr("%s: k=%d should not be >= 3\n", __func__, k); -- ok = false; -- break; - } - if (! ok) - break; -@@ -774,13 +770,9 @@ parse_scat_pi_line(const char * lcp, uint8_t * up, uint32_t * sum_num) - if (up) - sg_put_unaligned_be16((uint16_t)DEF_TM, up + 18); - break; -- default: -- pr2serr("%s: k=%d should not be >= 3\n", __func__, k); -- ok = false; -- break; - } - } -- return ok ? 0 : SG_LIB_SYNTAX_ERROR; -+ return 0; - } - - /* Read pairs or quintets from a scat_file and places them in a T10 scatter --- -1.8.3.1 - - -From 2ff6254d584b2c673b9d6289da2f6af6e293a3d3 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 23:36:58 +0800 -Subject: [PATCH 16/30] sg_vpd: Remove dead code. - - * The `n` is between 0 and 7, the `default` statement is never reached. - - * The `do_hex` will never been bigger than 2 at that line. - -Signed-off-by: Gris Ge ---- - src/sg_vpd.c | 7 ------- - 1 file changed, 7 deletions(-) - -diff --git a/src/sg_vpd.c b/src/sg_vpd.c -index a15ed74..081232d 100644 ---- a/src/sg_vpd.c -+++ b/src/sg_vpd.c -@@ -1233,9 +1233,6 @@ decode_x_inq_vpd(uint8_t * b, int len, int do_hex, bool do_long, - case 7: - printf(" [protection types 1, 2 and 3 supported]\n"); - break; -- default: -- printf("\n"); -- break; - } - } else - printf("\n"); -@@ -1991,8 +1988,6 @@ decode_proto_lu_vpd(uint8_t * buff, int len, int do_hex) - continue; - if (2 == do_hex) - hex2stdout(bp + 8, desc_len, 1); -- else if (do_hex > 2) -- hex2stdout(bp, bump, 1); - else { - switch (proto) { - case TPROTO_SAS: -@@ -2042,8 +2037,6 @@ decode_proto_port_vpd(uint8_t * buff, int len, int do_hex) - continue; - if (2 == do_hex) - hex2stdout(bp + 8, desc_len, 1); -- else if (do_hex > 2) -- hex2stdout(bp, bump, 1); - else { - switch (proto) { - case TPROTO_SAS: /* page added in spl3r02 */ --- -1.8.3.1 - - -From 013eb336d61d56eb7dc3c67b6551096a8175527a Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 23:41:46 +0800 -Subject: [PATCH 17/30] sg_test_rwbuf: Fix incorrect initial value of - `version_given`. - -* With current code, no real code could be execute as - `version_give` is always true(if not in debug mode). - -Signed-off-by: Gris Ge ---- - src/sg_test_rwbuf.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/sg_test_rwbuf.c b/src/sg_test_rwbuf.c -index f187ba0..52b7e81 100644 ---- a/src/sg_test_rwbuf.c -+++ b/src/sg_test_rwbuf.c -@@ -386,8 +386,8 @@ void usage () - - int main (int argc, char * argv[]) - { -- bool verbose_given = true; -- bool version_given = true; -+ bool verbose_given = false; -+ bool version_given = false; - int sg_fd, res; - const char * device_name = NULL; - int times = 1; --- -1.8.3.1 - - -From bf1ee2b1ecc966f50b19bec4126a58b3c4c53111 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Wed, 26 Sep 2018 23:53:52 +0800 -Subject: [PATCH 18/30] sg_ses: Remove dead code. - -* The `n` is always '>= 1' after the for loop. -* All the possible value between 0x20 to 0x2f is covered by preview - switch statements. -* The cp is pointing to a stack memory, is always not NULL. - -Signed-off-by: Gris Ge ---- - src/sg_ses.c | 11 +---------- - 1 file changed, 1 insertion(+), 10 deletions(-) - -diff --git a/src/sg_ses.c b/src/sg_ses.c -index 29b66b3..9c4b0c0 100644 ---- a/src/sg_ses.c -+++ b/src/sg_ses.c -@@ -1405,9 +1405,6 @@ parse_cmd_line(struct opts_t *op, int argc, char *argv[]) - else if (1 == n) { - op->page_code_given = true; - op->page_code = pc; -- } else { -- pr2serr("No dpage found --data= argument\n"); -- goto err_help; - } - if (op->verbose > 3) { - int k; -@@ -2431,9 +2428,6 @@ find_sas_connector_type(int conn_type, bool abridged, char * buff, - else if (conn_type < 0x20) - snprintf(buff, buff_len, "unknown internal wide connector type: " - "0x%x", conn_type); -- else if (conn_type < 0x30) -- snprintf(buff, buff_len, "unknown internal connector to end " -- "device, type: 0x%x", conn_type); - else if (conn_type < 0x3f) - snprintf(buff, buff_len, "reserved for internal connector, " - "type: 0x%x", conn_type); -@@ -2637,8 +2631,6 @@ enc_status_helper(const char * pad, const uint8_t * statp, int etype, - printf("%slast 3 bytes (hex): %02x %02x %02x\n", pad, statp[1], - statp[2], statp[3]); - break; -- default: -- break; - } - break; - case UI_POWER_SUPPLY_ETC: /* Uninterruptible power supply */ -@@ -4260,8 +4252,7 @@ process_status_dpage(struct sg_pt_base * ptvp, int page_code, uint8_t * resp, - subenc_nickname_sdg(resp, resp_len); - break; - default: -- printf("Cannot decode response from diagnostic " -- "page: %s\n", (cp ? cp : "")); -+ printf("Cannot decode response from diagnostic page: %s\n", cp); - hex2stdout(resp, resp_len, 0); - } - --- -1.8.3.1 - - -From d1a53f72716e0013c6ff4e76c4ccae575e32e35d Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Thu, 27 Sep 2018 00:07:56 +0800 -Subject: [PATCH 19/30] sg_sanitize: Remove dead code. - - * The `has_di` will always be 0 at that line. - -Signed-off-by: Gris Ge ---- - src/sg_sanitize.c | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/src/sg_sanitize.c b/src/sg_sanitize.c -index b45462f..b810128 100644 ---- a/src/sg_sanitize.c -+++ b/src/sg_sanitize.c -@@ -388,11 +388,6 @@ print_dev_id(int fd, uint8_t * sinq_resp, int max_rlen, int verbose) - n = (SAFE_STD_INQ_RESP_LEN - 4); - for (k = 0, has_sn = 0, has_di = 0; k < n; ++k) { - if (VPD_UNIT_SERIAL_NUM == b[4 + k]) { -- if (has_di) { -- if (verbose) -- pr2serr("VPD_SUPPORTED_VPDS dis-ordered\n"); -- return 0; -- } - ++has_sn; - } else if (VPD_DEVICE_ID == b[4 + k]) { - ++has_di; --- -1.8.3.1 - - -From 880d18e2e0296a91a65f7f94dcd8ad5e2497cfa6 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Thu, 27 Sep 2018 00:09:08 +0800 -Subject: [PATCH 20/30] sg_rbuf: Remove dead code. - -The `res` is always >=0 at that line. - -Signed-off-by: Gris Ge ---- - src/sg_rbuf.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/sg_rbuf.c b/src/sg_rbuf.c -index 61604d3..6b74436 100644 ---- a/src/sg_rbuf.c -+++ b/src/sg_rbuf.c -@@ -681,5 +681,5 @@ main(int argc, char * argv[]) - else - printf("read buffer non-zero\n"); - #endif -- return (res >= 0) ? res : SG_LIB_CAT_OTHER; -+ return res; - } --- -1.8.3.1 - - -From d58bc5904989a381b9ab541409b83578a56b75da Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Thu, 27 Sep 2018 00:17:07 +0800 -Subject: [PATCH 21/30] sg_luns: Remove dead code. - -The `a_method` is always between 0 and 3. - -Signed-off-by: Gris Ge ---- - src/sg_luns.c | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/src/sg_luns.c b/src/sg_luns.c -index 904b2ce..9115070 100644 ---- a/src/sg_luns.c -+++ b/src/sg_luns.c -@@ -306,9 +306,6 @@ decode_lun(const char * leadin, const uint8_t * lunp, bool lu_cong, - } - } - break; -- default: -- printf("%s<<%s: faulty logic>>\n", l_leadin, __func__); -- break; - } - if (next_level) - continue; --- -1.8.3.1 - - -From 601fe8621fa0fb1d2674d67181dd368936354cb4 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Thu, 27 Sep 2018 00:18:57 +0800 -Subject: [PATCH 22/30] sg_logs: Fix typo in variable name. - -Signed-off-by: Gris Ge ---- - src/sg_logs.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/sg_logs.c b/src/sg_logs.c -index e4f265e..7001ee4 100644 ---- a/src/sg_logs.c -+++ b/src/sg_logs.c -@@ -7109,7 +7109,7 @@ main(int argc, char * argv[]) - if (k) { - if (SG_LIB_CAT_NOT_READY == k) - pr2serr("log_select: device not ready\n"); -- else if (SG_LIB_CAT_ILLEGAL_REQ == res) -+ else if (SG_LIB_CAT_ILLEGAL_REQ == k) - pr2serr("log_select: field in cdb illegal\n"); - else if (SG_LIB_CAT_INVALID_OP == k) - pr2serr("log_select: not supported\n"); --- -1.8.3.1 - - -From e921a23e89f91b50929e9f4dc2f5902021f689d9 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Thu, 27 Sep 2018 00:19:40 +0800 -Subject: [PATCH 23/30] sg_inq: Remove dead code. - -The `support_num` is always between 0 and 7. - -Signed-off-by: Gris Ge ---- - src/sg_inq.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/src/sg_inq.c b/src/sg_inq.c -index b32ab87..1664345 100644 ---- a/src/sg_inq.c -+++ b/src/sg_inq.c -@@ -3428,7 +3428,6 @@ cmddt_process(int sg_fd, const struct opts_t * op) - break; - case 6: desc_p = "vendor specific (6)"; break; - case 7: desc_p = "reserved (7)"; break; -- default: desc_p = "impossible value > 7"; break; - } - if (prnt_cmd) { - printf(" Support field: %s [", desc_p); --- -1.8.3.1 - - -From 27a19f00c6c58e91296e918a34afb2b2bdcac822 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Thu, 27 Sep 2018 00:20:32 +0800 -Subject: [PATCH 24/30] sg_format: Remove dead code. - -The `has_di` is always 0 in that line. - -Signed-off-by: Gris Ge ---- - src/sg_format.c | 6 ------ - 1 file changed, 6 deletions(-) - -diff --git a/src/sg_format.c b/src/sg_format.c -index af1a033..61ee77f 100644 ---- a/src/sg_format.c -+++ b/src/sg_format.c -@@ -700,12 +700,6 @@ print_dev_id(int fd, uint8_t * sinq_resp, int max_rlen, - n = (SAFE_STD_INQ_RESP_LEN - 4); - for (k = 0, has_sn = 0, has_di = 0; k < n; ++k) { - if (VPD_UNIT_SERIAL_NUM == b[4 + k]) { -- if (has_di) { -- if (op->verbose) -- pr2serr("VPD_SUPPORTED_VPDS " -- "dis-ordered\n"); -- goto out; -- } - ++has_sn; - } else if (VPD_DEVICE_ID == b[4 + k]) { - ++has_di; --- -1.8.3.1 - - -From 8292e3e96cac1f234f1139161c5e92e29b545da1 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Thu, 27 Sep 2018 00:22:35 +0800 -Subject: [PATCH 25/30] sg_dd: Remove dead code. - -The `ret` there is always non-zero. - -Signed-off-by: Gris Ge ---- - src/sg_dd.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/sg_dd.c b/src/sg_dd.c -index 8696ee7..aa544c7 100644 ---- a/src/sg_dd.c -+++ b/src/sg_dd.c -@@ -976,7 +976,7 @@ err_out: - } - return may_coe ? 0 : ret; - } else -- return ret ? ret : -1; -+ return ret; - } - - --- -1.8.3.1 - - -From 50ba84424a1226dfef9a2746fd797cffbc544aad Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Thu, 27 Sep 2018 00:23:49 +0800 -Subject: [PATCH 26/30] sg_pt_linux_nvme: Remove dead code. - -The `return 0` already stop the `if (dout_len > 0)` check. - -Signed-off-by: Gris Ge ---- - lib/sg_pt_linux_nvme.c | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/lib/sg_pt_linux_nvme.c b/lib/sg_pt_linux_nvme.c -index 18b1374..98feaef 100644 ---- a/lib/sg_pt_linux_nvme.c -+++ b/lib/sg_pt_linux_nvme.c -@@ -899,11 +899,6 @@ sntl_senddiag(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp, - return 0; - } else - return 0; /* nothing to do */ -- if (dout_len > 0) { -- if (vb) -- pr2ws("%s: dout given but PF clear\n", __func__); -- return SCSI_PT_DO_BAD_PARAMS; -- } - } - if (dout_len < 4) { - if (vb) --- -1.8.3.1 - - -From 570105df861066e0943fc6a7511172acdeb212c0 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Fri, 28 Sep 2018 19:50:11 +0800 -Subject: [PATCH 27/30] sg_lib: Remove dead code. - -Signed-off-by: Gris Ge ---- - lib/sg_lib.c | 8 +------- - 1 file changed, 1 insertion(+), 7 deletions(-) - -diff --git a/lib/sg_lib.c b/lib/sg_lib.c -index c281cce..e7cac29 100644 ---- a/lib/sg_lib.c -+++ b/lib/sg_lib.c -@@ -2123,14 +2123,11 @@ sg_get_command_size(uint8_t opcode) - switch ((opcode >> 5) & 0x7) { - case 0: - return 6; -- case 1: case 2: case 6: case 7: -- return 10; - case 3: case 5: - return 12; -- break; - case 4: - return 16; -- default: -+ default: /* 1, 2, 6, 7 */ - return 10; - } - } -@@ -2267,9 +2264,6 @@ sg_get_opcode_name(uint8_t cmd_byte0, int peri_type, int buff_len, - case 7: - sg_scnpr(buff, buff_len, "Vendor specific [0x%x]", (int)cmd_byte0); - break; -- default: -- sg_scnpr(buff, buff_len, "Opcode=0x%x", (int)cmd_byte0); -- break; - } - } - --- -1.8.3.1 - - -From 26932a6b4e5a1e844df3edcef86d399391f4b18c Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Thu, 27 Sep 2018 00:33:00 +0800 -Subject: [PATCH 28/30] sg_vpd: Fix protantially overflowing of uint64_t. - -Signed-off-by: Gris Ge ---- - src/sg_vpd.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/sg_vpd.c b/src/sg_vpd.c -index 081232d..2865af4 100644 ---- a/src/sg_vpd.c -+++ b/src/sg_vpd.c -@@ -1929,9 +1929,9 @@ decode_3party_copy_vpd(uint8_t * buff, int len, int do_hex, int pdt, - printf(" Maximum identified concurrent copies: %u\n", u); - u = sg_get_unaligned_be32(bp + 12); - printf(" Maximum segment length: %u\n", u); -- ull = (1 << bp[16]); /* field is power of 2 */ -+ ull = (1 << bp[16]) & UINT64_MAX; /* field is power of 2 */ - printf(" Data segment granularity: %" PRIu64 "\n", ull); -- ull = (1 << bp[17]); -+ ull = (1 << bp[17]) & UINT64_MAX; - printf(" Inline data granularity: %" PRIu64 "\n", ull); - break; - case 0x9101: -@@ -1943,7 +1943,7 @@ decode_3party_copy_vpd(uint8_t * buff, int len, int do_hex, int pdt, - printf(" Held data:\n"); - u = sg_get_unaligned_be32(bp + 4); - printf(" Held data limit: %u\n", u); -- ull = (1 << bp[8]); -+ ull = (1 << bp[8]) & UINT64_MAX; - printf(" Held data granularity: %" PRIu64 "\n", ull); - break; - default: --- -1.8.3.1 - - -From 5b2e117dee27ec7cebecd042b2d505f2b6dcb461 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Fri, 28 Sep 2018 19:45:26 +0800 -Subject: [PATCH 29/30] sg_lib: Removed dead code. - - * The value 32 stored in `len` is never used afterwords. - * The `bump` initial value is always been overridden. - -Signed-off-by: Gris Ge ---- - lib/sg_lib.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/lib/sg_lib.c b/lib/sg_lib.c -index e7cac29..a691b02 100644 ---- a/lib/sg_lib.c -+++ b/lib/sg_lib.c -@@ -545,7 +545,6 @@ sg_decode_transportid_str(const char * lip, uint8_t * bp, int bplen, - } - if (NULL == lip) - lip = ""; -- bump = TRANSPORT_ID_MIN_LEN; /* should be overwritten in all loop paths */ - for (k = 0, n = 0; bplen > 0; ++k, bp += bump, bplen -= bump) { - if ((k > 0) && only_one) - break; -@@ -1846,9 +1845,6 @@ sg_get_sense_str(const char * lip, const uint8_t * sbp, int sb_len, - sg_scnpr(b + r, blen - r, "%s lba=0x%x\n", lip, - sg_get_unaligned_be24(sbp + 1) & 0x1fffff); - n += sg_scnpr(cbp + n, cblen - n, "%s\n", b); -- len = sb_len; -- if (len > 32) -- len = 32; /* trim in case there is a lot of rubbish */ - } - check_raw: - if (raw_sinfo) { --- -1.8.3.1 - - -From 8ebcd159bbc41f63fa96e904dee9307b2ee7aec2 Mon Sep 17 00:00:00 2001 -From: Gris Ge -Date: Fri, 28 Sep 2018 19:59:28 +0800 -Subject: [PATCH 30/30] sg_cmds_basic: Check resp for NULL before doing memset. - -Signed-off-by: Gris Ge ---- - lib/sg_cmds_basic.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/lib/sg_cmds_basic.c b/lib/sg_cmds_basic.c -index e625465..f4021bb 100644 ---- a/lib/sg_cmds_basic.c -+++ b/lib/sg_cmds_basic.c -@@ -324,6 +324,13 @@ sg_ll_inquiry_com(struct sg_pt_base * ptvp, bool cmddt, bool evpd, int pg_op, - uint8_t sense_b[SENSE_BUFF_LEN]; - uint8_t * up; - -+ if (resp == NULL) { -+ if (verbose) -+ pr2ws("Got NULL `resp` pointer"); -+ return SG_LIB_CAT_MALFORMED; -+ } -+ -+ - if (cmddt) - inq_cdb[1] |= 0x2; - if (evpd) --- -1.8.3.1 - diff --git a/sg3_utils-1.45_rescan-scsi-bus.sh_use_LUN_wildcard_in_idlist.patch b/sg3_utils-1.45_rescan-scsi-bus.sh_use_LUN_wildcard_in_idlist.patch deleted file mode 100644 index 5a4fcf8..0000000 --- a/sg3_utils-1.45_rescan-scsi-bus.sh_use_LUN_wildcard_in_idlist.patch +++ /dev/null @@ -1,34 +0,0 @@ -From linux-scsi Thu Oct 25 08:49:11 2018 -From: Martin Wilck -Date: Thu, 25 Oct 2018 08:49:11 +0000 -To: linux-scsi -Subject: [PATCH] rescan-scsi-bus.sh: use LUN wildcard in idlist -Message-Id: <20181025084911.19958-1-mwilck () suse ! com> -X-MARC-Message: https://marc.info/?l=linux-scsi&m=154045737232713 - -By scanning for LUN 0 only, we may encounter a device that the -kernel won't add (e.g. peripheral device type 31) and which may -thus never appear in sysfs for us to use for REPORT LUNS. That -causes LUN additions for such devices to be missed by -"rescan-iscsi-bus.sh -a". - -Signed-off-by: Martin Wilck ---- - scripts/rescan-scsi-bus.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh -index 6989208..a2aa8d8 100755 ---- a/scripts/rescan-scsi-bus.sh -+++ b/scripts/rescan-scsi-bus.sh -@@ -376,7 +376,7 @@ idlist () - - oldlist=$(ls /sys/class/scsi_device/ | sed -n "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq) - # Rescan LUN 0 to check if we found new targets -- echo "${channel} - 0" > /sys/class/scsi_host/host${host}/scan -+ echo "${channel} - -" > /sys/class/scsi_host/host${host}/scan - newlist=$(ls /sys/class/scsi_device/ | sed -n "s/${host}:${channel}:\([0-9]*:[0-9]*\)/\1/p" | uniq) - for newid in $newlist ; do - oldid=$newid --- -2.19.1 diff --git a/sg3_utils.spec b/sg3_utils.spec index 0e1718b..5de7207 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -2,14 +2,13 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils -Version: 1.44 -Release: 3%{?dist} +Version: 1.45 +Release: 1%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 Source10: 40-usb-blacklist.rules Source11: 59-fc-wwpn-id.rules -Patch0: BZ_1633235-sg3_utils-1.44-covscan-fix.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1683343 # sg_turs: improper usage show Patch1: sg_turs-help.patch @@ -19,8 +18,6 @@ Patch2: sg_raw-version.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1760847 # FC_TARGET_LUN attribute assigned for non FC device Patch3: fc_wwpn_id-non_FC-devices.patch -# backport from svn -Patch4: sg3_utils-1.45_rescan-scsi-bus.sh_use_LUN_wildcard_in_idlist.patch URL: http://sg.danny.cz/sg/sg3_utils.html Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -99,7 +96,7 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %{_udevrulesdir}/63-fc-wwpn-id.rules %{_udevrulesdir}/65-scsi-cciss_id.rules %{_udevrulesdir}/40-usb-blacklist.rules -/usr/lib/udev/* +/usr/lib/udev/fc_wwpn_id %files libs %doc BSD_LICENSE COPYING @@ -111,6 +108,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Thu Mar 12 2020 Dan Horák - 1.45-1 +- update to version 1.45 (#1809392) + * Thu Jan 30 2020 Fedora Release Engineering - 1.44-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild From 0a3d43fdb9f4574aead875d3e93b26db079083d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 20 Apr 2020 11:15:18 +0200 Subject: [PATCH 06/23] upload new sources --- .gitignore | 1 + sources | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4484f7d..32b525f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ rescan-scsi-bus.sh-1.35 /sg3_utils-1.41.tgz /sg3_utils-1.42.tar.xz /sg3_utils-1.44.tar.xz +/sg3_utils-1.45.tar.xz diff --git a/sources b/sources index 0f837e1..16c3ed7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (sg3_utils-1.44.tar.xz) = 4f4d5536ebed62f2c81c55741043d9ac3f4610a4dd6ef2e3125f041afd57aae03a32c2affe84a960c9f61fb6f84784bc901c756a8c36c1bc97082fa61e73ae8d +SHA512 (sg3_utils-1.45.tar.xz) = fa25dedc447154d33937248a856af9a7ef380dda282a681d465a57d7dfc24b6c0409fa06aabf8cc28ba191e91db80fed0757b45212eddf713855574b48a97868 From 8583d46863b533f99e8e36a90015361c8e99309d Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 14 Jul 2020 14:11:23 +0000 Subject: [PATCH 07/23] Use make macros https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro --- sg3_utils.spec | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index 5de7207..ef0b67b 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -3,7 +3,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.45 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 @@ -63,11 +63,11 @@ developing applications. sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool -make %{?_smp_mflags} +%make_build %install -make install DESTDIR=$RPM_BUILD_ROOT +%make_install rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la install -p -m 755 scripts/%{rescan_script} $RPM_BUILD_ROOT%{_bindir} @@ -108,6 +108,10 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Tue Jul 14 2020 Tom Stellard - 1.45-2 +- Use make macros +- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro + * Thu Mar 12 2020 Dan Horák - 1.45-1 - update to version 1.45 (#1809392) From c7b25463bb071ee29dc4707edc79b12f03b7010f Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 29 Jul 2020 10:36:27 +0000 Subject: [PATCH 08/23] - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- sg3_utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index ef0b67b..e744eb6 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -3,7 +3,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.45 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 @@ -108,6 +108,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Wed Jul 29 2020 Fedora Release Engineering - 1.45-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Tue Jul 14 2020 Tom Stellard - 1.45-2 - Use make macros - https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro From 24fb771dc6476771cf09e068d2ee0cb5173dc71a Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 8 Jan 2021 21:25:05 +0000 Subject: [PATCH 09/23] Add BuildRequires: make https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot --- sg3_utils.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/sg3_utils.spec b/sg3_utils.spec index e744eb6..af2d92d 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -21,6 +21,7 @@ Patch3: fc_wwpn_id-non_FC-devices.patch URL: http://sg.danny.cz/sg/sg3_utils.html Requires: %{name}-libs%{?_isa} = %{version}-%{release} +BuildRequires: make BuildRequires: gcc BuildRequires: systemd From b23132e3e9588f6bb590c57f1507416a18bae46d Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Wed, 27 Jan 2021 20:16:34 +0000 Subject: [PATCH 10/23] - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- sg3_utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index af2d92d..a8d429d 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -3,7 +3,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.45 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 @@ -109,6 +109,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Wed Jan 27 2021 Fedora Release Engineering - 1.45-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + * Wed Jul 29 2020 Fedora Release Engineering - 1.45-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild From 5137362a1dc84832c9ec2b3090ec9b64d3843fe0 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Tue, 30 Mar 2021 18:31:44 +0200 Subject: [PATCH 11/23] * Tue Mar 30 2021 Tomas Bzatek - 1.46-1 - update to version 1.46 --- .gitignore | 1 + 40-usb-blacklist.rules | 14 -------------- 59-fc-wwpn-id.rules | 17 ----------------- fc_wwpn_id-non_FC-devices.patch | 25 ------------------------- sg3_utils.spec | 22 +++++++--------------- sg_raw-version.patch | 28 ---------------------------- sg_turs-help.patch | 24 ------------------------ sources | 2 +- 8 files changed, 9 insertions(+), 124 deletions(-) delete mode 100644 40-usb-blacklist.rules delete mode 100644 59-fc-wwpn-id.rules delete mode 100644 fc_wwpn_id-non_FC-devices.patch delete mode 100644 sg_raw-version.patch delete mode 100644 sg_turs-help.patch diff --git a/.gitignore b/.gitignore index 32b525f..27f7c31 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ rescan-scsi-bus.sh-1.35 /sg3_utils-1.42.tar.xz /sg3_utils-1.44.tar.xz /sg3_utils-1.45.tar.xz +/sg3_utils-1.46.tar.xz diff --git a/40-usb-blacklist.rules b/40-usb-blacklist.rules deleted file mode 100644 index 6cce3e6..0000000 --- a/40-usb-blacklist.rules +++ /dev/null @@ -1,14 +0,0 @@ -# -# Blacklist specific USB devices -# -# don't inquire sn and di on broken devices (https://bugzilla.suse.com/show_bug.cgi?id=840054) - -ACTION!="add|change", GOTO="usb_blacklist_end" -KERNEL!="sd*[!0-9]|sr*", GOTO="usb_blacklist_end" - -# unkown device -ATTRS{idVendor}=="0aec", ATTRS{idProduct}=="3260", ENV{ID_SCSI_INQUIRY}="1" -# Sony/JMicron port replicator -ATTRS{idVendor}=="054c", ATTRS{idProduct}=="06a0", ENV{ID_SCSI_INQUIRY}="1" - -LABEL="usb_blacklist_end" diff --git a/59-fc-wwpn-id.rules b/59-fc-wwpn-id.rules deleted file mode 100644 index 5ad0a5c..0000000 --- a/59-fc-wwpn-id.rules +++ /dev/null @@ -1,17 +0,0 @@ -# -# FC WWPN-based by-path links -# - -ACTION!="add|change", GOTO="fc_wwpn_end" -KERNEL!="sd*", GOTO="fc_wwpn_end" - -ENV{DEVTYPE}=="disk", IMPORT{program}="fc_wwpn_id %p" -ENV{DEVTYPE}=="partition", IMPORT{parent}="FC_*" -ENV{FC_TARGET_WWPN}!="?*", GOTO="fc_wwpn_end" -ENV{FC_INITIATOR_WWPN}!="?*", GOTO="fc_wwpn_end" -ENV{FC_TARGET_LUN}!="?*", GOTO="fc_wwpn_end" - -ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-path/fc-$env{FC_INITIATOR_WWPN}-$env{FC_TARGET_WWPN}-lun-$env{FC_TARGET_LUN}" -ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-path/fc-$env{FC_INITIATOR_WWPN}-$env{FC_TARGET_WWPN}-lun-$env{FC_TARGET_LUN}-part%n" - -LABEL="fc_wwpn_end" diff --git a/fc_wwpn_id-non_FC-devices.patch b/fc_wwpn_id-non_FC-devices.patch deleted file mode 100644 index 6bff83a..0000000 --- a/fc_wwpn_id-non_FC-devices.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 37b8af8278bba0b116b579950218f2e610a2ab2b Mon Sep 17 00:00:00 2001 -From: jtpittman195 -Date: Fri, 4 Oct 2019 10:58:24 -0400 -Subject: [PATCH] fc_wwpn_id: add condition to FC_TARGET_LUN return - -If there is no relevant fc_remote_port or fc_host found, there is no need to return the target_lun number. Returning with no condition causes a FC_TARGET_LUN value to be present in the udev database for devices that are not fibre attached. Add condition to check. ---- - scripts/fc_wwpn_id | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/scripts/fc_wwpn_id b/scripts/fc_wwpn_id -index c8d0189..b05c5e8 100644 ---- a/scripts/fc_wwpn_id -+++ b/scripts/fc_wwpn_id -@@ -38,7 +38,9 @@ while [ -n "$d" ] ; do - esac - done - --echo "FC_TARGET_LUN=$target_lun" -+if [ -n "$rport_wwpn" ] || [ -n "$host_wwpn" ] ; then -+ echo "FC_TARGET_LUN=$target_lun" -+fi - - if [ -n "$rport_wwpn" ] ; then - echo "FC_TARGET_WWPN=$rport_wwpn" diff --git a/sg3_utils.spec b/sg3_utils.spec index a8d429d..1603e2b 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -2,22 +2,11 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils -Version: 1.45 -Release: 4%{?dist} +Version: 1.46 +Release: 1%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 -Source10: 40-usb-blacklist.rules -Source11: 59-fc-wwpn-id.rules -# https://bugzilla.redhat.com/show_bug.cgi?id=1683343 -# sg_turs: improper usage show -Patch1: sg_turs-help.patch -# https://bugzilla.redhat.com/show_bug.cgi?id=1627657 -# sg_raw -V fail -Patch2: sg_raw-version.patch -# https://bugzilla.redhat.com/show_bug.cgi?id=1760847 -# FC_TARGET_LUN attribute assigned for non FC device -Patch3: fc_wwpn_id-non_FC-devices.patch URL: http://sg.danny.cz/sg/sg3_utils.html Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -79,13 +68,13 @@ install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8 # install all extra udev rules mkdir -p $RPM_BUILD_ROOT%{_udevrulesdir} mkdir -p $RPM_BUILD_ROOT/usr/lib/udev +install -p -m 644 scripts/40-usb-blacklist.rules $RPM_BUILD_ROOT%{_udevrulesdir} # need to run after 60-persistent-storage.rules install -p -m 644 scripts/55-scsi-sg3_id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/61-scsi-sg3_id.rules # need to run after 62-multipath.rules install -p -m 644 scripts/58-scsi-sg3_symlink.rules $RPM_BUILD_ROOT%{_udevrulesdir}/63-scsi-sg3_symlink.rules install -p -m 644 scripts/59-scsi-cciss_id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/65-scsi-cciss_id.rules -install -p -m 644 %{SOURCE10} $RPM_BUILD_ROOT%{_udevrulesdir} -install -p -m 644 %{SOURCE11} $RPM_BUILD_ROOT%{_udevrulesdir}/63-fc-wwpn-id.rules +install -p -m 644 scripts/59-fc-wwpn-id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/63-fc-wwpn-id.rules install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %files @@ -109,6 +98,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Tue Mar 30 2021 Tomas Bzatek - 1.46-1 +- update to version 1.46 + * Wed Jan 27 2021 Fedora Release Engineering - 1.45-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/sg_raw-version.patch b/sg_raw-version.patch deleted file mode 100644 index ab5cb6a..0000000 --- a/sg_raw-version.patch +++ /dev/null @@ -1,28 +0,0 @@ -From c683e6e2bc62b43c140934b919323d107b0a48cb Mon Sep 17 00:00:00 2001 -From: Tomas Bzatek -Date: Tue, 28 May 2019 16:06:06 +0200 -Subject: [PATCH] sg_raw: do not print error about device not specified on - version request - ---- - src/sg_raw.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/sg_raw.c b/src/sg_raw.c -index 33a85f7c..453ff42a 100644 ---- a/src/sg_raw.c -+++ b/src/sg_raw.c -@@ -440,6 +440,13 @@ parse_cmd_line(struct opts_t * op, int argc, char *argv[]) - } - } - -+ if (op->version_given -+#ifdef DEBUG -+ && ! op->verbose_given -+#endif -+ ) -+ return 0; -+ - if (optind >= argc) { - pr2serr("No device specified\n\n"); - return SG_LIB_SYNTAX_ERROR; diff --git a/sg_turs-help.patch b/sg_turs-help.patch deleted file mode 100644 index da7de09..0000000 --- a/sg_turs-help.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 116e665ddb7b38bb8f7065ddb08192bd3551897d Mon Sep 17 00:00:00 2001 -From: Tomas Bzatek -Date: Tue, 26 Feb 2019 16:45:59 +0100 -Subject: [PATCH] sg_turs: fix help invocation in the old mode - -In the old mode the usage was printed out twice when called -by `sg_turs -O -?`. ---- - src/sg_turs.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/sg_turs.c b/src/sg_turs.c -index 8c6e3792..a318d22c 100644 ---- a/src/sg_turs.c -+++ b/src/sg_turs.c -@@ -252,7 +252,7 @@ old_parse_cmd_line(struct opts_t * op, int argc, char * argv[]) - op->version_given = true; - break; - case '?': -- usage_old(); -+ ++op->do_help; - return 0; - default: - jmp_out = true; diff --git a/sources b/sources index 16c3ed7..bea802b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (sg3_utils-1.45.tar.xz) = fa25dedc447154d33937248a856af9a7ef380dda282a681d465a57d7dfc24b6c0409fa06aabf8cc28ba191e91db80fed0757b45212eddf713855574b48a97868 +SHA512 (sg3_utils-1.46.tar.xz) = 0b4caab97ccc11fb45e88219e460b37c6ff69b8f3c79e513279aef51783ff22399d141253abdbf55db198db0815bc39d30e9b1e3bd7dda5e15c5f4dae3fe89cf From 595af7378cd134ca1502770351876a1dc806135a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 23 Jul 2021 17:26:28 +0000 Subject: [PATCH 12/23] - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- sg3_utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index 1603e2b..3a4bd30 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -3,7 +3,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.46 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 @@ -98,6 +98,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Fri Jul 23 2021 Fedora Release Engineering - 1.46-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + * Tue Mar 30 2021 Tomas Bzatek - 1.46-1 - update to version 1.46 From 7d79c3714925d3e10ec674d80e4c6eb8dec7ea7e Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 22 Jan 2022 00:45:27 +0000 Subject: [PATCH 13/23] - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- sg3_utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index 3a4bd30..bc62df8 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -3,7 +3,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.46 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 @@ -98,6 +98,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Sat Jan 22 2022 Fedora Release Engineering - 1.46-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + * Fri Jul 23 2021 Fedora Release Engineering - 1.46-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild From 3075f171f289fed25af8fec2bdba4a99cb261659 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 23 Jul 2022 08:27:39 +0000 Subject: [PATCH 14/23] Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- sg3_utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index bc62df8..8e41b4f 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -3,7 +3,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.46 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 @@ -98,6 +98,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Sat Jul 23 2022 Fedora Release Engineering - 1.46-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + * Sat Jan 22 2022 Fedora Release Engineering - 1.46-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild From aef77f210453ce661aeb80536cb90e6b7ca5c3e9 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 21 Jan 2023 03:05:38 +0000 Subject: [PATCH 15/23] Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- sg3_utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index 8e41b4f..e7173da 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -3,7 +3,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.46 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 @@ -98,6 +98,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Sat Jan 21 2023 Fedora Release Engineering - 1.46-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + * Sat Jul 23 2022 Fedora Release Engineering - 1.46-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild From 5549d7d57243ac8a166b8f077cb1891c6af19626 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 22 Jul 2023 01:30:29 +0000 Subject: [PATCH 16/23] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- sg3_utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index e7173da..4237086 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -3,7 +3,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.46 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 @@ -98,6 +98,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Sat Jul 22 2023 Fedora Release Engineering - 1.46-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Sat Jan 21 2023 Fedora Release Engineering - 1.46-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild From 187ccad96a050e88da43ca08b6034faddc1b9278 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 27 Jan 2024 02:46:33 +0000 Subject: [PATCH 17/23] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- sg3_utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index 4237086..ca373a8 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -3,7 +3,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.46 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2+ and BSD Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source2: scsi-rescan.8 @@ -98,6 +98,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Sat Jan 27 2024 Fedora Release Engineering - 1.46-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Sat Jul 22 2023 Fedora Release Engineering - 1.46-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From f9a9f881043d4b8b83a45907efc4127de360f4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Fri, 9 Feb 2024 14:20:47 +0100 Subject: [PATCH 18/23] - update to version 1.48 (rhbz#1944444) --- .gitignore | 1 + sg3_utils.spec | 72 ++++++++++++++++++++++++++++++++------------------ sources | 2 +- 3 files changed, 49 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 27f7c31..a23f508 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ rescan-scsi-bus.sh-1.35 /sg3_utils-1.44.tar.xz /sg3_utils-1.45.tar.xz /sg3_utils-1.46.tar.xz +/sg3_utils-1.48.tar.xz diff --git a/sg3_utils.spec b/sg3_utils.spec index ca373a8..5737944 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -1,14 +1,15 @@ %global rescan_script rescan-scsi-bus.sh +%global _udevlibdir %{_prefix}/lib/udev Summary: Utilities for devices that use SCSI command sets -Name: sg3_utils -Version: 1.46 -Release: 7%{?dist} -License: GPLv2+ and BSD -Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz -Source2: scsi-rescan.8 +Name: sg3_utils +Version: 1.48 +Release: 1%{?dist} +License: GPL-2.0-or-later AND BSD-2-Clause +URL: https://sg.danny.cz/sg/sg3_utils.html +Source0: https://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz +Source1: scsi-rescan.8 -URL: http://sg.danny.cz/sg/sg3_utils.html Requires: %{name}-libs%{?_isa} = %{version}-%{release} BuildRequires: make BuildRequires: gcc @@ -43,9 +44,11 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release} This package contains the %{name} library and its header files for developing applications. + %prep %autosetup -p 1 + %build %configure --disable-static @@ -58,46 +61,65 @@ sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool %install %make_install -rm -rf $RPM_BUILD_ROOT/%{_libdir}/*.la +rm -rf %{buildroot}%{_libdir}/*.la -install -p -m 755 scripts/%{rescan_script} $RPM_BUILD_ROOT%{_bindir} -( cd $RPM_BUILD_ROOT%{_bindir}; ln -sf %{rescan_script} scsi-rescan ) +install -p -m 755 scripts/%{rescan_script} %{buildroot}%{_bindir} +( cd %{buildroot}%{_bindir}; ln -sf %{rescan_script} scsi-rescan ) -install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man8 +install -p -m 644 %{SOURCE1} %{buildroot}%{_mandir}/man8 # install all extra udev rules -mkdir -p $RPM_BUILD_ROOT%{_udevrulesdir} -mkdir -p $RPM_BUILD_ROOT/usr/lib/udev -install -p -m 644 scripts/40-usb-blacklist.rules $RPM_BUILD_ROOT%{_udevrulesdir} +mkdir -p %{buildroot}%{_udevrulesdir} +mkdir -p %{buildroot}%{_udevlibdir} +install -p -m 644 scripts/40-usb-blacklist.rules %{buildroot}%{_udevrulesdir} # need to run after 60-persistent-storage.rules -install -p -m 644 scripts/55-scsi-sg3_id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/61-scsi-sg3_id.rules +install -p -m 644 scripts/55-scsi-sg3_id.rules %{buildroot}%{_udevrulesdir}/61-scsi-sg3_id.rules # need to run after 62-multipath.rules -install -p -m 644 scripts/58-scsi-sg3_symlink.rules $RPM_BUILD_ROOT%{_udevrulesdir}/63-scsi-sg3_symlink.rules -install -p -m 644 scripts/59-scsi-cciss_id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/65-scsi-cciss_id.rules -install -p -m 644 scripts/59-fc-wwpn-id.rules $RPM_BUILD_ROOT%{_udevrulesdir}/63-fc-wwpn-id.rules -install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev +install -p -m 644 scripts/58-scsi-sg3_symlink.rules %{buildroot}%{_udevrulesdir}/63-scsi-sg3_symlink.rules +install -p -m 644 scripts/59-scsi-cciss_id.rules %{buildroot}%{_udevrulesdir}/65-scsi-cciss_id.rules +install -p -m 644 scripts/59-fc-wwpn-id.rules %{buildroot}%{_udevrulesdir}/63-fc-wwpn-id.rules +install -p -m 755 scripts/fc_wwpn_id %{buildroot}%{_udevlibdir} + %files -%doc AUTHORS BSD_LICENSE COPYING COVERAGE CREDITS ChangeLog README README.sg_start -%{_bindir}/* -%{_mandir}/man8/* +%license BSD_LICENSE COPYING +%doc AUTHORS COVERAGE CREDITS ChangeLog README README.sg_start +%{_bindir}/scsi_* +%{_bindir}/sg_* +%{_bindir}/rescan-scsi-bus.sh +%{_bindir}/scsi-rescan +%{_bindir}/sginfo +%{_bindir}/sgm_dd +%{_bindir}/sgp_dd +%{_mandir}/man8/scsi_*.8* +%{_mandir}/man8/sg_*.8* +%{_mandir}/man8/rescan-scsi-bus.sh.8* +%{_mandir}/man8/scsi-rescan.8* +%{_mandir}/man8/sginfo.8* +%{_mandir}/man8/sgm_dd.8* +%{_mandir}/man8/sgp_dd.8* +%{_mandir}/man8/%{name}.8* +%{_mandir}/man8/%{name}_json.8* %{_udevrulesdir}/61-scsi-sg3_id.rules %{_udevrulesdir}/63-scsi-sg3_symlink.rules %{_udevrulesdir}/63-fc-wwpn-id.rules %{_udevrulesdir}/65-scsi-cciss_id.rules %{_udevrulesdir}/40-usb-blacklist.rules -/usr/lib/udev/fc_wwpn_id +%{_udevlibdir}/fc_wwpn_id %files libs %doc BSD_LICENSE COPYING -%{_libdir}/*.so.* +%{_libdir}/libsgutils2-%{version}.so.* %files devel %{_includedir}/scsi/*.h -%{_libdir}/*.so +%{_libdir}/libsgutils2.so %changelog +* Fri Feb 09 2024 Dan Horák - 1.48-1 +- update to version 1.48 (rhbz#1944444) + * Sat Jan 27 2024 Fedora Release Engineering - 1.46-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild diff --git a/sources b/sources index bea802b..77279e3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (sg3_utils-1.46.tar.xz) = 0b4caab97ccc11fb45e88219e460b37c6ff69b8f3c79e513279aef51783ff22399d141253abdbf55db198db0815bc39d30e9b1e3bd7dda5e15c5f4dae3fe89cf +SHA512 (sg3_utils-1.48.tar.xz) = d4f586ac8a4ba9b5de5885657785e25251c8a42913332d6eca38f92b546c06e8e8aa0553c4b5c04f553cf2d0a9e4f34827f65ba596ef65e43dec36b4345f444a From 52ec43c3a6525bdb8a40ff8637368773fa7344ce Mon Sep 17 00:00:00 2001 From: Xose Vazquez Perez Date: Mon, 8 Apr 2024 15:53:17 +0200 Subject: [PATCH 19/23] fix three bugs in scripts/rescan-scsi-bus.sh from upstream --- ...sh-fix-multipath-resize-without-upda.patch | 27 +++++++++ ...sh-remove-tmp-rescan-scsi-mpath-info.patch | 58 +++++++++++++++++++ ...sh-fix-for-github.com-doug-gilbert-s.patch | 30 ++++++++++ sg3_utils.spec | 14 ++++- 4 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 0001-rescan-scsi-bus.sh-fix-multipath-resize-without-upda.patch create mode 100644 0002-rescan-scsi-bus.sh-remove-tmp-rescan-scsi-mpath-info.patch create mode 100644 0003-rescan-scsi-bus.sh-fix-for-github.com-doug-gilbert-s.patch diff --git a/0001-rescan-scsi-bus.sh-fix-multipath-resize-without-upda.patch b/0001-rescan-scsi-bus.sh-fix-multipath-resize-without-upda.patch new file mode 100644 index 0000000..ab0c83b --- /dev/null +++ b/0001-rescan-scsi-bus.sh-fix-multipath-resize-without-upda.patch @@ -0,0 +1,27 @@ +From 89427a6328a737b6a64104a6988e4ab319f239c7 Mon Sep 17 00:00:00 2001 +From: Douglas Gilbert +Date: Mon, 16 Oct 2023 14:59:21 +0000 +Subject: [PATCH 1/3] rescan-scsi-bus.sh: fix multipath resize without update, + https://github.com/doug-gilbert/sg3_utils/pull/43.diff +X-Patchwork-Bot: notify + +git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@1055 6180dd3e-e324-4e3e-922d-17de1ae2f315 +--- + scripts/rescan-scsi-bus.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh +index 0c25dbb1..7d74d90f 100755 +--- a/scripts/rescan-scsi-bus.sh ++++ b/scripts/rescan-scsi-bus.sh +@@ -1088,6 +1088,7 @@ findresized() + local mpathsize= + declare -a mpathsizes + ++ [ -e "$TMPLUNINFOFILE" ] || getallmultipathinfo + if [ -z "$lunsearch" ] ; then + devs=$(ls /sys/class/scsi_device/) + else +-- +2.44.0 + diff --git a/0002-rescan-scsi-bus.sh-remove-tmp-rescan-scsi-mpath-info.patch b/0002-rescan-scsi-bus.sh-remove-tmp-rescan-scsi-mpath-info.patch new file mode 100644 index 0000000..a17317a --- /dev/null +++ b/0002-rescan-scsi-bus.sh-remove-tmp-rescan-scsi-mpath-info.patch @@ -0,0 +1,58 @@ +From 593cb078d4e91591aa3be823715f11888b21f8e4 Mon Sep 17 00:00:00 2001 +From: Douglas Gilbert +Date: Tue, 17 Oct 2023 20:41:37 +0000 +Subject: [PATCH 2/3] rescan-scsi-bus.sh: remove + /tmp/rescan-scsi-mpath-info.txt; + https://github.com/doug-gilbert/sg3_utils/pull/44.diff +X-Patchwork-Bot: notify + +git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@1056 6180dd3e-e324-4e3e-922d-17de1ae2f315 +--- + scripts/rescan-scsi-bus.sh | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh +index 7d74d90f..188d071c 100755 +--- a/scripts/rescan-scsi-bus.sh ++++ b/scripts/rescan-scsi-bus.sh +@@ -7,7 +7,16 @@ + VERSION="20230413" + SCAN_WILD_CARD=4294967295 + +-TMPLUNINFOFILE="/tmp/rescan-scsi-mpath-info.txt" ++CLEANUP=: ++trap 'eval "$CLEANUP"' 0 ++TMPD=$(mktemp -d /tmp/rsb.XXXXXXXX) ++[ "$TMPD" ] || { ++ echo failed to create temporary directory >&2 ++ exit 1 ++} ++CLEANUP='rm -rf "$TMPD";'"$CLEANUP" ++ ++TMPLUNINFOFILE="$TMPD/rescan-scsi-mpath-info.txt" + + setcolor () + { +@@ -818,9 +827,9 @@ findremapped() + mpaths="" + local tmpfile= + +- tmpfile=$(mktemp /tmp/rescan-scsi-bus.XXXXXXXX 2> /dev/null) ++ tmpfile=$(mktemp "$TMPD/rescan-scsi-bus.XXXXXXXX" 2> /dev/null) + if [ -z "$tmpfile" ] ; then +- tmpfile="/tmp/rescan-scsi-bus.$$" ++ tmpfile="$TMPD/rescan-scsi-bus.$$" + rm -f $tmpfile + fi + +@@ -874,7 +883,6 @@ findremapped() + echo "$SCSISTR" + incrchgd "$hctl" + done < $tmpfile +- rm -f $tmpfile + + if [ -n "$mp_enable" ] && [ -n "$mpaths" ] ; then + echo "Updating multipath device mappings" +-- +2.44.0 + diff --git a/0003-rescan-scsi-bus.sh-fix-for-github.com-doug-gilbert-s.patch b/0003-rescan-scsi-bus.sh-fix-for-github.com-doug-gilbert-s.patch new file mode 100644 index 0000000..3f8caa9 --- /dev/null +++ b/0003-rescan-scsi-bus.sh-fix-for-github.com-doug-gilbert-s.patch @@ -0,0 +1,30 @@ +From bc99b8db2cf8afd04b1f9d68e9bd4f9d847b3c6f Mon Sep 17 00:00:00 2001 +From: Douglas Gilbert +Date: Thu, 21 Dec 2023 04:35:26 +0000 +Subject: [PATCH 3/3] rescan-scsi-bus.sh: fix for + github.com/doug-gilbert/sg3_utils/issues/46 +X-Patchwork-Bot: notify + +git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@1076 6180dd3e-e324-4e3e-922d-17de1ae2f315 +--- + scripts/rescan-scsi-bus.sh | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh +index 188d071c..52991e1e 100755 +--- a/scripts/rescan-scsi-bus.sh ++++ b/scripts/rescan-scsi-bus.sh +@@ -1240,7 +1240,9 @@ if [ -x /usr/bin/sg_inq ] ; then + if [ "$sg_turs_version" -gt 353 ] ; then + sg_turs_opt="--ascq=0x3a" + else +- sg_turs_opt="" ++ # Not really interested in timing a TUR but an empty string such as ++ # "" gets interpreted on the command line as a positional parameter. ++ sg_turs_opt="-t" + fi + else + echo "WARN: /usr/bin/sg_inq not present -- please install sg3_utils" +-- +2.44.0 + diff --git a/sg3_utils.spec b/sg3_utils.spec index 5737944..9897adb 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -4,11 +4,20 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.48 -Release: 1%{?dist} +Release: 2%{?dist} License: GPL-2.0-or-later AND BSD-2-Clause URL: https://sg.danny.cz/sg/sg3_utils.html Source0: https://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz Source1: scsi-rescan.8 +# https://github.com/doug-gilbert/sg3_utils/pull/43 +# scripts/rescan-scsi-bus.sh: fix multipath resize without update +Patch0: 0001-rescan-scsi-bus.sh-fix-multipath-resize-without-upda.patch +# https://github.com/doug-gilbert/sg3_utils/pull/44 +# scripts/rescan-scsi-bus.sh: remove /tmp/rescan-scsi-mpath-info.txt +Patch1: 0002-rescan-scsi-bus.sh-remove-tmp-rescan-scsi-mpath-info.patch +# https://github.com/doug-gilbert/sg3_utils/issues/46 +# scripts/rescan-scsi-bus.sh: -r flag unmounts active root disk +Patch2: 0003-rescan-scsi-bus.sh-fix-for-github.com-doug-gilbert-s.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} BuildRequires: make @@ -117,6 +126,9 @@ install -p -m 755 scripts/fc_wwpn_id %{buildroot}%{_udevlibdir} %changelog +* Mon Apr 8 2024 Xose Vazquez Perez - 1.48-2 +- fix three bugs in scripts/rescan-scsi-bus.sh from upstream + * Fri Feb 09 2024 Dan Horák - 1.48-1 - update to version 1.48 (rhbz#1944444) From ae2dddd56b1551878db5a7b2c4cc3e767d6257b2 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 20 Jul 2024 05:21:35 +0000 Subject: [PATCH 20/23] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- sg3_utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index 9897adb..bd3b0d2 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.48 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL-2.0-or-later AND BSD-2-Clause URL: https://sg.danny.cz/sg/sg3_utils.html Source0: https://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz @@ -126,6 +126,9 @@ install -p -m 755 scripts/fc_wwpn_id %{buildroot}%{_udevlibdir} %changelog +* Sat Jul 20 2024 Fedora Release Engineering - 1.48-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Mon Apr 8 2024 Xose Vazquez Perez - 1.48-2 - fix three bugs in scripts/rescan-scsi-bus.sh from upstream From 9d29ec19b2778c164f1ca83b35d3e073ae0df5da Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Fri, 1 Nov 2024 17:50:06 +0100 Subject: [PATCH 21/23] * Fri Nov 01 2024 Tomas Bzatek - 1.48-4 - udev rules: avoid spurious warning for non-SCSI devices - Install missing 00-scsi-sg3_config.rules - Fix file references to other udev rules --- sg3_utils.spec | 17 ++++++++++- ...purious_warning_for_non-SCSI_devices.patch | 29 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 udev_rules-avoid_spurious_warning_for_non-SCSI_devices.patch diff --git a/sg3_utils.spec b/sg3_utils.spec index bd3b0d2..4c3ebe1 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.48 -Release: 3%{?dist} +Release: 4%{?dist} License: GPL-2.0-or-later AND BSD-2-Clause URL: https://sg.danny.cz/sg/sg3_utils.html Source0: https://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz @@ -18,6 +18,8 @@ Patch1: 0002-rescan-scsi-bus.sh-remove-tmp-rescan-scsi-mpath-info.patch # https://github.com/doug-gilbert/sg3_utils/issues/46 # scripts/rescan-scsi-bus.sh: -r flag unmounts active root disk Patch2: 0003-rescan-scsi-bus.sh-fix-for-github.com-doug-gilbert-s.patch +# https://github.com/doug-gilbert/sg3_utils/pull/47 +Patch3: udev_rules-avoid_spurious_warning_for_non-SCSI_devices.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} BuildRequires: make @@ -65,6 +67,12 @@ developing applications. sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool +# Fix filename references to other udev rules +sed -i 's|55-scsi-sg3_id.rules|61-scsi-sg3_id.rules|' scripts/*.rules +sed -i 's|58-scsi-sg3_symlink.rules|63-scsi-sg3_symlink.rules|' scripts/*.rules +sed -i 's|59-scsi-cciss_id.rules|65-scsi-cciss_id.rules|' scripts/*.rules +sed -i 's|59-fc-wwpn-id.rules|63-fc-wwpn-id.rules|' scripts/*.rules + %make_build @@ -80,6 +88,7 @@ install -p -m 644 %{SOURCE1} %{buildroot}%{_mandir}/man8 # install all extra udev rules mkdir -p %{buildroot}%{_udevrulesdir} mkdir -p %{buildroot}%{_udevlibdir} +install -p -m 644 scripts/00-scsi-sg3_config.rules %{buildroot}%{_udevrulesdir} install -p -m 644 scripts/40-usb-blacklist.rules %{buildroot}%{_udevrulesdir} # need to run after 60-persistent-storage.rules install -p -m 644 scripts/55-scsi-sg3_id.rules %{buildroot}%{_udevrulesdir}/61-scsi-sg3_id.rules @@ -109,6 +118,7 @@ install -p -m 755 scripts/fc_wwpn_id %{buildroot}%{_udevlibdir} %{_mandir}/man8/sgp_dd.8* %{_mandir}/man8/%{name}.8* %{_mandir}/man8/%{name}_json.8* +%{_udevrulesdir}/00-scsi-sg3_config.rules %{_udevrulesdir}/61-scsi-sg3_id.rules %{_udevrulesdir}/63-scsi-sg3_symlink.rules %{_udevrulesdir}/63-fc-wwpn-id.rules @@ -126,6 +136,11 @@ install -p -m 755 scripts/fc_wwpn_id %{buildroot}%{_udevlibdir} %changelog +* Fri Nov 01 2024 Tomas Bzatek - 1.48-4 +- udev rules: avoid spurious warning for non-SCSI devices +- Install missing 00-scsi-sg3_config.rules +- Fix file references to other udev rules + * Sat Jul 20 2024 Fedora Release Engineering - 1.48-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/udev_rules-avoid_spurious_warning_for_non-SCSI_devices.patch b/udev_rules-avoid_spurious_warning_for_non-SCSI_devices.patch new file mode 100644 index 0000000..bd65db1 --- /dev/null +++ b/udev_rules-avoid_spurious_warning_for_non-SCSI_devices.patch @@ -0,0 +1,29 @@ +From 4957a561867b4f363b0711bb5e0a3292f3067ce7 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Tue, 9 Jan 2024 22:10:09 +0100 +Subject: [PATCH] udev rules: avoid spurious warning for non-SCSI devices + +The udev rules spit out lots of warnings like this: + +55-scsi-sg3_id.rules[15445]: WARNING: SCSI device loop0 has no device ID, consider changing .SCSI_ID_SERIAL_SRC in 00-scsi-sg3_config.rules + +Because the warning code had erroneously been inserted in the +"sg3_utils_id_end" clause. Fix it. + +Fixes: d7b8da0 ("udev rules: restrict use of ambiguous device IDs patchset") +--- + scripts/55-scsi-sg3_id.rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/55-scsi-sg3_id.rules b/scripts/55-scsi-sg3_id.rules +index 5e9732d6..f3ddb065 100644 +--- a/scripts/55-scsi-sg3_id.rules ++++ b/scripts/55-scsi-sg3_id.rules +@@ -147,6 +147,6 @@ ENV{SCSI_IDENT_SERIAL}=="?*", ENV{.SCSI_ID_SERIAL_SRC}=="*S*", \ + ENV{ID_SERIAL}="S$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_SERIAL}", \ + ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_SERIAL}" + +-LABEL="sg3_utils_id_end" + ENV{ID_SERIAL}!="?*", ENV{DEVTYPE}=="disk", \ + PROGRAM="/bin/logger -t 55-scsi-sg3_id.rules -p daemon.warning \"WARNING: SCSI device %k has no device ID, consider changing .SCSI_ID_SERIAL_SRC in 00-scsi-sg3_config.rules\"" ++LABEL="sg3_utils_id_end" From 9e81f4315bde8a98af3808dae61650be2d4601f8 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 19 Jan 2025 10:30:54 +0000 Subject: [PATCH 22/23] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- sg3_utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index 4c3ebe1..f5d28af 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.48 -Release: 4%{?dist} +Release: 5%{?dist} License: GPL-2.0-or-later AND BSD-2-Clause URL: https://sg.danny.cz/sg/sg3_utils.html Source0: https://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz @@ -136,6 +136,9 @@ install -p -m 755 scripts/fc_wwpn_id %{buildroot}%{_udevlibdir} %changelog +* Sun Jan 19 2025 Fedora Release Engineering - 1.48-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Fri Nov 01 2024 Tomas Bzatek - 1.48-4 - udev rules: avoid spurious warning for non-SCSI devices - Install missing 00-scsi-sg3_config.rules From dc8b19c8ee37e0596c446b334935dc197c6dadda Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Fri, 25 Jul 2025 18:12:13 +0000 Subject: [PATCH 23/23] Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild --- sg3_utils.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sg3_utils.spec b/sg3_utils.spec index f5d28af..d38a63d 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.48 -Release: 5%{?dist} +Release: 6%{?dist} License: GPL-2.0-or-later AND BSD-2-Clause URL: https://sg.danny.cz/sg/sg3_utils.html Source0: https://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz @@ -136,6 +136,9 @@ install -p -m 755 scripts/fc_wwpn_id %{buildroot}%{_udevlibdir} %changelog +* Fri Jul 25 2025 Fedora Release Engineering - 1.48-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + * Sun Jan 19 2025 Fedora Release Engineering - 1.48-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild