forked from pool/util-linux
Accepting request 181637 from Base:System
Correct condition for Conflicts of sysvinit-tools. (forwarded request 181632 from bernhard-voelker) OBS-URL: https://build.opensuse.org/request/show/181637 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/util-linux?expand=0&rev=163
This commit is contained in:
parent
962b426e1b
commit
737a0b0c2e
77
eject-scsi-check-host_status-and-driver_status.patch
Normal file
77
eject-scsi-check-host_status-and-driver_status.patch
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
From 90a0e97c7be9da39fd54600228e006b98667ad56 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Karel Zak <kzak@redhat.com>
|
||||||
|
Date: Tue, 18 Jun 2013 12:24:28 +0200
|
||||||
|
Subject: [PATCH 1/2] eject: Check host_status and driver_status when using
|
||||||
|
SG_IO.
|
||||||
|
|
||||||
|
Based on Suse patch, originally from
|
||||||
|
Anna Bernathova <anicka@suse.cz>, May 2008
|
||||||
|
|
||||||
|
SG_IO completion status is weird but still well defined. You'll need
|
||||||
|
to check both host_status, driver_status and status to determine that
|
||||||
|
a command actually succeeded. -- Tejun Heo, May 2008
|
||||||
|
|
||||||
|
Note that we also need to check driver_status and sense_buffer to
|
||||||
|
detect situation when there is no medium. It's valid request to call
|
||||||
|
eject(8) for device with no medium.
|
||||||
|
|
||||||
|
References: https://bugzilla.novell.com/show_bug.cgi?id=358033
|
||||||
|
Signed-off-by: Anna Bernathova <anicka@suse.cz>
|
||||||
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||||
|
---
|
||||||
|
sys-utils/eject.c | 24 +++++++++++++++++++++---
|
||||||
|
1 file changed, 21 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sys-utils/eject.c b/sys-utils/eject.c
|
||||||
|
index 4ec69e7..f98f227 100644
|
||||||
|
--- a/sys-utils/eject.c
|
||||||
|
+++ b/sys-utils/eject.c
|
||||||
|
@@ -53,6 +53,14 @@
|
||||||
|
#include "pathnames.h"
|
||||||
|
#include "sysfs.h"
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * sg_io_hdr_t driver_status -- see kernel include/scsi/scsi.h
|
||||||
|
+ */
|
||||||
|
+#ifndef DRIVER_SENSE
|
||||||
|
+# define DRIVER_SENSE 0x08
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+
|
||||||
|
#define EJECT_DEFAULT_DEVICE "/dev/cdrom"
|
||||||
|
|
||||||
|
|
||||||
|
@@ -604,17 +612,27 @@ static int eject_scsi(int fd)
|
||||||
|
|
||||||
|
io_hdr.cmdp = allowRmBlk;
|
||||||
|
status = ioctl(fd, SG_IO, (void *)&io_hdr);
|
||||||
|
- if (status < 0)
|
||||||
|
+ if (status < 0 || io_hdr.host_status || io_hdr.driver_status)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
io_hdr.cmdp = startStop1Blk;
|
||||||
|
status = ioctl(fd, SG_IO, (void *)&io_hdr);
|
||||||
|
- if (status < 0)
|
||||||
|
+ if (status < 0 || io_hdr.host_status)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ /* Ignore errors when there is not medium -- in this case driver sense
|
||||||
|
+ * buffer sets MEDIUM NOT PRESENT (3a) bit. For more details see:
|
||||||
|
+ * http://www.tldp.org/HOWTO/archived/SCSI-Programming-HOWTO/SCSI-Programming-HOWTO-22.html#sec-sensecodes
|
||||||
|
+ * -- kzak Jun 2013
|
||||||
|
+ */
|
||||||
|
+ if (io_hdr.driver_status != 0 &&
|
||||||
|
+ !(io_hdr.driver_status == DRIVER_SENSE && io_hdr.sbp &&
|
||||||
|
+ io_hdr.sbp[12] == 0x3a))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
io_hdr.cmdp = startStop2Blk;
|
||||||
|
status = ioctl(fd, SG_IO, (void *)&io_hdr);
|
||||||
|
- if (status < 0)
|
||||||
|
+ if (status < 0 || io_hdr.host_status || io_hdr.driver_status)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* force kernel to reread partition table when new disc inserted */
|
||||||
|
--
|
||||||
|
1.8.1.4
|
||||||
|
|
@ -1,3 +1,26 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jul 1 13:43:23 UTC 2013 - mail@bernhard-voelker.de
|
||||||
|
|
||||||
|
- Correct condition for Conflicts of sysvinit-tools.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jul 1 07:08:46 UTC 2013 - werner@suse.de
|
||||||
|
|
||||||
|
- Correct version in source URL path.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jun 28 17:42:14 CEST 2013 - sbrabec@suse.cz
|
||||||
|
|
||||||
|
- Fix Provides and Obsoletes of eject.
|
||||||
|
- Conflict with old coreutils and sysvinit-tools with conflicting
|
||||||
|
files to guarantee seamless upgrade.
|
||||||
|
- Remove Provides and Obsoletes of packages that do not exist since
|
||||||
|
SuSE Linux 8.
|
||||||
|
- Include upstreamed patch from SUSE eject package:
|
||||||
|
Check eject host_status and driver_status when using SG_IO
|
||||||
|
(eject-scsi-check-host_status-and-driver_status.patch,
|
||||||
|
bnc#358033).
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jun 19 10:58:17 UTC 2013 - coolo@suse.com
|
Wed Jun 19 10:58:17 UTC 2013 - coolo@suse.com
|
||||||
|
|
||||||
|
@ -16,12 +16,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Following package should be fixed:
|
|
||||||
# coreutils ... do not install su and kill
|
|
||||||
# sysvinit-tools ... do not install sulogin and utmpdump
|
|
||||||
# eject ... simply drop this package
|
|
||||||
#
|
|
||||||
%bcond_without sysvinit_tools
|
%bcond_without sysvinit_tools
|
||||||
%bcond_without enable_su
|
%bcond_without enable_su
|
||||||
%bcond_without enable_eject
|
%bcond_without enable_eject
|
||||||
@ -59,7 +53,7 @@ Recommends: %{name}-lang = %{version}
|
|||||||
Summary: A collection of basic system utilities
|
Summary: A collection of basic system utilities
|
||||||
License: GPL-2.0+
|
License: GPL-2.0+
|
||||||
Group: System/Base
|
Group: System/Base
|
||||||
Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.21/%{name}-%{version}.tar.bz2
|
Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.23/%{name}-%{version}.tar.bz2
|
||||||
Source1: util-linux-rpmlintrc
|
Source1: util-linux-rpmlintrc
|
||||||
# XXX: make nologin part of util-linux upstream
|
# XXX: make nologin part of util-linux upstream
|
||||||
Source2: nologin.c
|
Source2: nologin.c
|
||||||
@ -95,7 +89,8 @@ Patch2: util-linux-2.23.1-eject-fpie.patch
|
|||||||
Patch3: fdisk-tinfo.patch
|
Patch3: fdisk-tinfo.patch
|
||||||
# PATCH-EXTEND-UPSTREAM: Let `su' handle /sbin and /usr/sbin in path
|
# PATCH-EXTEND-UPSTREAM: Let `su' handle /sbin and /usr/sbin in path
|
||||||
Patch4: make-sure-sbin-resp-usr-sbin-are-in-PATH.diff
|
Patch4: make-sure-sbin-resp-usr-sbin-are-in-PATH.diff
|
||||||
|
# PATCH-FIX-UPSTREAM eject-scsi-check-host_status-and-driver_status.patch bnc358033 anicka@suse.cz -- Check eject host_status and driver_status when using SG_IO.
|
||||||
|
Patch5: eject-scsi-check-host_status-and-driver_status.patch
|
||||||
# disable encryption
|
# disable encryption
|
||||||
Patch12: util-linux-2.23.1-noenc-suse.diff
|
Patch12: util-linux-2.23.1-noenc-suse.diff
|
||||||
|
|
||||||
@ -115,20 +110,25 @@ Patch61: mkfs.bfs_cleanup_endian.patch
|
|||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
PreReq: %insserv_prereq %fillup_prereq /bin/sed
|
PreReq: %insserv_prereq %fillup_prereq /bin/sed
|
||||||
#
|
#
|
||||||
Provides: base = %{version}-%{release}
|
%if %{with enable_eject}
|
||||||
Provides: eject = %{version}-%{release}
|
Provides: eject = 2.1.0-166.8
|
||||||
|
%endif
|
||||||
Provides: login = 4.0-33.7
|
Provides: login = 4.0-33.7
|
||||||
Provides: raw = %{version}-%{release}
|
%if %{with enable_eject}
|
||||||
Provides: rawio = %{version}-%{release}
|
# File conflict of eject (up to 12.3 and SLE11).
|
||||||
Provides: util = %{version}-%{release}
|
Obsoletes: eject < 2.1.0-166.8
|
||||||
Provides: uuid-runtime = %{version}-%{release}
|
%endif
|
||||||
Obsoletes: base < %{version}-%{release}
|
# File conflict of login (up to 12.1 and SLE11).
|
||||||
Obsoletes: eject < %{version}-%{release}
|
|
||||||
Obsoletes: login < 4.0-33.7
|
Obsoletes: login < 4.0-33.7
|
||||||
Obsoletes: raw < %{version}-%{release}
|
%if %{with enable_su}
|
||||||
Obsoletes: rawio < %{version}-%{release}
|
# File conflict of su and kill (up to 12.3 and SLE11).
|
||||||
Obsoletes: util < %{version}-%{release}
|
# It should be coreutils < 8.21-4, but coreutils provide Release-less symbol.
|
||||||
Obsoletes: uuid-runtime < %{version}-%{release}
|
Conflicts: coreutils < 8.21
|
||||||
|
%endif
|
||||||
|
%if %{with sysvinit_tools}
|
||||||
|
# File conflict of sulogin and utmpdump (up to 12.3 and SLE11).
|
||||||
|
Conflicts: sysvinit-tools < 2.88+-87
|
||||||
|
%endif
|
||||||
#
|
#
|
||||||
# Using "Requires" here would lend itself to help upgrading, but since
|
# Using "Requires" here would lend itself to help upgrading, but since
|
||||||
# util-linux is in the initial bootstrap, that is not a good thing to do:
|
# util-linux is in the initial bootstrap, that is not a good thing to do:
|
||||||
@ -210,6 +210,7 @@ Files to develop applications using the libmount library.
|
|||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
|
%patch5 -p1
|
||||||
%patch12 -p1
|
%patch12 -p1
|
||||||
#
|
#
|
||||||
%patch20 -p1
|
%patch20 -p1
|
||||||
@ -795,6 +796,7 @@ fi
|
|||||||
%dir %{_datadir}/getopt
|
%dir %{_datadir}/getopt
|
||||||
%attr (755,root,root) %{_datadir}/getopt/getopt-parse.bash
|
%attr (755,root,root) %{_datadir}/getopt/getopt-parse.bash
|
||||||
%attr (755,root,root) %{_datadir}/getopt/getopt-parse.tcsh
|
%attr (755,root,root) %{_datadir}/getopt/getopt-parse.tcsh
|
||||||
|
# FIXME: Fix directory ownership.
|
||||||
%{_datadir}/bash-completion
|
%{_datadir}/bash-completion
|
||||||
%ifnarch ia64
|
%ifnarch ia64
|
||||||
#XXX: post our patches upstream
|
#XXX: post our patches upstream
|
||||||
|
Loading…
Reference in New Issue
Block a user