* Fri Jan 03 2020 Tomas Bzatek <tbzatek@redhat.com> - 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.
This commit is contained in:
Tomas Bzatek 2020-01-03 18:07:38 +01:00
parent 4c2f4400c6
commit 37e37b2965
11 changed files with 1577 additions and 171 deletions

1
.gitignore vendored
View File

@ -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

14
40-usb-blacklist.rules Normal file
View File

@ -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"

17
59-fc-wwpn-id.rules Normal file
View File

@ -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"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
From 37b8af8278bba0b116b579950218f2e610a2ab2b Mon Sep 17 00:00:00 2001
From: jtpittman195 <jpittman@redhat.com>
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"

View File

@ -1,27 +0,0 @@
From a0569d83929d98c0a175bc3992352c2c8d09ffa4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
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

View File

@ -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 <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h> /* to define 'major' */
+#ifndef major
+#include <sys/types.h>
+#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 <inttypes.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/sysmacros.h>
#include <sys/time.h>
#include <sys/file.h>
-#include <linux/major.h>
+#include <sys/sysmacros.h>
+#ifndef major
+#include <sys/types.h>
+#endif
#include <linux/fs.h> /* <sys/mount.h> */
+#include <linux/major.h>
#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 <dirent.h>
#include <libgen.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h> /* new location for major + minor */
+#ifndef major
+#include <sys/types.h>
+#endif
#include <linux/major.h>
#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 <inttypes.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
+#ifndef major
+#include <sys/types.h>
+#endif
#include <sys/mman.h>
#include <sys/time.h>
#include <linux/major.h>
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 <inttypes.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/sysmacros.h>
#include <sys/time.h>
#include <sys/file.h>
+#include <sys/sysmacros.h>
+#ifndef major
+#include <sys/types.h>
+#endif
#include <linux/major.h>
#include <linux/fs.h> /* <sys/mount.h> */
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 <inttypes.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/sysmacros.h>
-#include <sys/mman.h>
#include <sys/time.h>
+#include <sys/mman.h>
+#include <sys/sysmacros.h>
+#ifndef major
+#include <sys/types.h>
+#endif
#include <linux/major.h>
#include <linux/fs.h> /* <sys/mount.h> */
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 <inttypes.h>
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
+#ifndef major
+#include <sys/types.h>
+#endif
#include <sys/time.h>
#include <linux/major.h>
#include <linux/fs.h> /* <sys/mount.h> */

View File

@ -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 <tbzatek@redhat.com> - 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 <releng@fedoraproject.org> - 1.42-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

28
sg_raw-version.patch Normal file
View File

@ -0,0 +1,28 @@
From c683e6e2bc62b43c140934b919323d107b0a48cb Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
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;

24
sg_turs-help.patch Normal file
View File

@ -0,0 +1,24 @@
From 116e665ddb7b38bb8f7065ddb08192bd3551897d Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
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;

View File

@ -1 +1 @@
SHA512 (sg3_utils-1.42.tar.xz) = 7672a9f2ed5064b6a528d1777510704d72a076bc45f7e92b16f70246ab75212078feb485f88674483a9157883516c20ae76d14d6e0fb80e38da105c0b24ff3b8
SHA512 (sg3_utils-1.44.tar.xz) = 4f4d5536ebed62f2c81c55741043d9ac3f4610a4dd6ef2e3125f041afd57aae03a32c2affe84a960c9f61fb6f84784bc901c756a8c36c1bc97082fa61e73ae8d