Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:Update
python-libmount
util-linux-libblkid-cdrom-autoclose-2.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-libblkid-cdrom-autoclose-2.patch of Package python-libmount
From dc30fd4383e57a0440cdb0e16ba5c4336a43b290 Mon Sep 17 00:00:00 2001 From: Karel Zak <kzak@redhat.com> Date: Tue, 7 Jan 2020 16:48:34 +0100 Subject: [PATCH] libblkid: check for medium on CDMROMs probing The commit 39f5af25982d8b0244000e92a9d0e0e6557d0e17 introduces O_NONBLOCK to avoid the tray close on open(). The side effect is that open() is successful when there is no medium. This is usually no problem for standard tools because the next read() will fail. Unfortunately, libblkid ignores I/O errors for (and only for) CDROMs to support some crazy hybrid data+audio disks. The final result is many I/O errors in system log when O_NONBLOCK is enabled. This patch add CDROM_DRIVE_STATUS to stop probing when there is no disk or when the tray is open. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1787973 Signed-off-by: Karel Zak <kzak@redhat.com> --- libblkid/src/probe.c | 8 ++++++++ misc-utils/blkid.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) Index: util-linux-2.29.2/libblkid/src/probe.c =================================================================== --- util-linux-2.29.2.orig/libblkid/src/probe.c +++ util-linux-2.29.2/libblkid/src/probe.c @@ -880,6 +880,14 @@ int blkid_probe_set_device(blkid_probe p blkid_probe_is_wholedisk(pr) && ioctl(fd, CDROM_GET_CAPABILITY, NULL) >= 0) { +# ifdef CDROM_DRIVE_STATUS + switch (ioctl(fd, CDROM_DRIVE_STATUS, 0)) { + case CDS_TRAY_OPEN: + case CDS_NO_DISC: + errno = ENOMEDIUM; + goto err; + } +# endif pr->flags |= BLKID_FL_CDROM_DEV; cdrom_size_correction(pr); } Index: util-linux-2.29.2/misc-utils/blkid.c =================================================================== --- util-linux-2.29.2.orig/misc-utils/blkid.c +++ util-linux-2.29.2/misc-utils/blkid.c @@ -490,8 +490,12 @@ static int lowprobe_device(blkid_probe p fprintf(stderr, "error: %s: %m\n", devname); return BLKID_EXIT_NOTFOUND; } - if (blkid_probe_set_device(pr, fd, offset, size)) + errno = 0; + if (blkid_probe_set_device(pr, fd, offset, size)) { + if (errno) + warn(_("error: %s"), devname); goto done; + } if (chain & LOWPROBE_TOPOLOGY) rc = lowprobe_topology(pr);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor