From da8a3dd33201f3592a55df29c938b5957d0f995ec5f4d8fcab96ac2bd1978b12 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Sat, 29 Jun 2013 10:05:39 +0000 Subject: [PATCH 1/3] Accepting request 181367 from home:sbrabec:branches:Base:System - 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). It works-around the second-build "unresolvable" status in request id 181063: http://lists.opensuse.org/opensuse-buildservice/2013-06/msg00246.html OBS-URL: https://build.opensuse.org/request/show/181367 OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=174 --- ...-check-host_status-and-driver_status.patch | 77 +++++++++++++++++++ util-linux.changes | 13 ++++ util-linux.spec | 40 +++++----- 3 files changed, 111 insertions(+), 19 deletions(-) create mode 100644 eject-scsi-check-host_status-and-driver_status.patch diff --git a/eject-scsi-check-host_status-and-driver_status.patch b/eject-scsi-check-host_status-and-driver_status.patch new file mode 100644 index 0000000..6347102 --- /dev/null +++ b/eject-scsi-check-host_status-and-driver_status.patch @@ -0,0 +1,77 @@ +From 90a0e97c7be9da39fd54600228e006b98667ad56 Mon Sep 17 00:00:00 2001 +From: Karel Zak +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 , 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 +Signed-off-by: Karel Zak +--- + 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 + diff --git a/util-linux.changes b/util-linux.changes index fe6c6cb..5fcc15c 100644 --- a/util-linux.changes +++ b/util-linux.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +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 diff --git a/util-linux.spec b/util-linux.spec index ca119b0..4c3a1f3 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -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 enable_su %bcond_without enable_eject @@ -95,7 +89,8 @@ Patch2: util-linux-2.23.1-eject-fpie.patch Patch3: fdisk-tinfo.patch # PATCH-EXTEND-UPSTREAM: Let `su' handle /sbin and /usr/sbin in path 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 Patch12: util-linux-2.23.1-noenc-suse.diff @@ -115,20 +110,25 @@ Patch61: mkfs.bfs_cleanup_endian.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build PreReq: %insserv_prereq %fillup_prereq /bin/sed # -Provides: base = %{version}-%{release} -Provides: eject = %{version}-%{release} +%if %{with enable_eject} +Provides: eject = 2.1.0-166.8 +%endif Provides: login = 4.0-33.7 -Provides: raw = %{version}-%{release} -Provides: rawio = %{version}-%{release} -Provides: util = %{version}-%{release} -Provides: uuid-runtime = %{version}-%{release} -Obsoletes: base < %{version}-%{release} -Obsoletes: eject < %{version}-%{release} +%if %{with enable_eject} +# File conflict of eject (up to 12.3 and SLE11). +Obsoletes: eject < 2.1.0-166.8 +%endif +# File conflict of login (up to 12.1 and SLE11). Obsoletes: login < 4.0-33.7 -Obsoletes: raw < %{version}-%{release} -Obsoletes: rawio < %{version}-%{release} -Obsoletes: util < %{version}-%{release} -Obsoletes: uuid-runtime < %{version}-%{release} +%if %{with enable_su} +# File conflict of su and kill (up to 12.3 and SLE11). +# It should be coreutils < 8.21-4, but coreutils provide Release-less symbol. +Conflicts: coreutils < 8.21 +%endif +%if %{with enable_su} +# 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 # 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 %patch3 -p1 %patch4 -p1 +%patch5 -p1 %patch12 -p1 # %patch20 -p1 @@ -795,6 +796,7 @@ fi %dir %{_datadir}/getopt %attr (755,root,root) %{_datadir}/getopt/getopt-parse.bash %attr (755,root,root) %{_datadir}/getopt/getopt-parse.tcsh +# FIXME: Fix directory ownership. %{_datadir}/bash-completion %ifnarch ia64 #XXX: post our patches upstream From bb25658a8afc32e1364ebc2f2d94af25f3e4c58e423cea4e6de65e3650783bcf Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Mon, 1 Jul 2013 07:09:23 +0000 Subject: [PATCH 2/3] . OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=175 --- util-linux.changes | 5 +++++ util-linux.spec | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/util-linux.changes b/util-linux.changes index 5fcc15c..d73a92c 100644 --- a/util-linux.changes +++ b/util-linux.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +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 diff --git a/util-linux.spec b/util-linux.spec index 4c3a1f3..f31bd3f 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -53,7 +53,7 @@ Recommends: %{name}-lang = %{version} Summary: A collection of basic system utilities License: GPL-2.0+ 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 # XXX: make nologin part of util-linux upstream Source2: nologin.c From 4f8a3a75b44dfdbaf99e30a8fb7b4e9e8b765bd7cd82f8f057d6dc11763a2ad6 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Mon, 1 Jul 2013 14:31:56 +0000 Subject: [PATCH 3/3] Accepting request 181632 from home:bernhard-voelker:branches:Base:System Correct condition for Conflicts of sysvinit-tools. OBS-URL: https://build.opensuse.org/request/show/181632 OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=176 --- util-linux.changes | 7 ++++++- util-linux.spec | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/util-linux.changes b/util-linux.changes index d73a92c..b0154a4 100644 --- a/util-linux.changes +++ b/util-linux.changes @@ -1,7 +1,12 @@ +------------------------------------------------------------------- +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 +- Correct version in source URL path. ------------------------------------------------------------------- Fri Jun 28 17:42:14 CEST 2013 - sbrabec@suse.cz diff --git a/util-linux.spec b/util-linux.spec index f31bd3f..bfb2abf 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -125,7 +125,7 @@ Obsoletes: login < 4.0-33.7 # It should be coreutils < 8.21-4, but coreutils provide Release-less symbol. Conflicts: coreutils < 8.21 %endif -%if %{with enable_su} +%if %{with sysvinit_tools} # File conflict of sulogin and utmpdump (up to 12.3 and SLE11). Conflicts: sysvinit-tools < 2.88+-87 %endif