RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1139805 - rpm badly handles failed write() to stdout
Summary: rpm badly handles failed write() to stdout
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: rpm
Version: 6.5
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Packaging Maintenance Team
QA Contact: Marek Marusic
URL:
Whiteboard:
Depends On: 1139444
Blocks: 1075802
TreeView+ depends on / blocked
 
Reported: 2014-09-09 16:40 UTC by Karl Hastings
Modified: 2019-07-11 08:11 UTC (History)
12 users (show)

Fixed In Version: rpm-4.8.0-46.el6
Doc Type: Bug Fix
Doc Text:
If the standard output of the rpm utility was redirected to a file and the file system was full, rpm failed without writing any error messages. Now, rpm prints an error message as a standard error output if the described scenario occurs.
Clone Of: 1139444
: 1202753 1597274 (view as bug list)
Environment:
Last Closed: 2015-07-22 07:03:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1452 0 normal SHIPPED_LIVE rpm bug fix and enhancement update 2015-07-20 18:43:47 UTC

Description Karl Hastings 2014-09-09 16:40:06 UTC
+++ This bug was initially created as a clone of Bug #1139444 +++

Description of problem:

If stdout is being redirected to a file, and the filesystem is full, rpm will silently fail despite write() returning -ENOSPC

<much snippage from strace>
write(1, "grep-2.18-1.fc20.x86_64\n", 24) = -1 ENOSPC (No space left on device)

Version-Release number of selected component (if applicable):

rpm-4.11.2-2.fc20.x86_64

How reproducible: 100%

Steps to Reproduce:
1. Make a filesystem, fill it up (I used a small loopback filesystem to reproduce)
2. rpm -qa > testfile
3. Watch the file either not have all of the expected output (i.e. writes succeeded prior to -ENOSPC) or be 0 bytes

rpm should inform the user about the error, as other utilities do. For example:

$ id  > /mnt/test/test14
id: write error: No space left on device

--- Additional comment from Jon Stanley on 2014-09-08 19:04:50 EDT ---

Forgot to list the actual problematic sequence of commands, but you could probably figure it out. But for completeness sake:

$ rpm -qa > /mnt/test/test15 ; echo $?
0
$ ls -l /mnt/test/test15
-rw-rw-r--. 1 jstanley jstanley 0 Sep  8 19:02 /mnt/test/test15

--- Additional comment from Panu Matilainen on 2014-09-09 06:25:23 EDT ---

Yup... from the rpm logging function:

    (void) fputs(rpmlogLevelPrefix(rec->pri), msgout);

    (void) fputs(rec->message, msgout);
    (void) fflush(msgout);

These go back 14 years almost to date, the (void) warning silencers are half a year younger so its not exactly a new bug :) Thanks for reporting though.

--- Additional comment from Panu Matilainen on 2014-09-09 06:40:31 EDT ---

Just FWIW, rpmlog() does not return an error code, so without API-changes this is fixable only to the extent of logging an error from the logger function ... unless the error came from writing to stderr, in which case reporting an error is going to be a bit difficult anyway.

--- Additional comment from Jon Stanley on 2014-09-09 11:19:13 EDT ---

Hmm, if I'm reading this correctly that means that there's no way for the rpm command to exit with a non-zero exit code without API changes?

Comment 3 Florian Festi 2014-12-15 15:14:46 UTC
ACK to issuing an error message (if the problem is not stderr). As stated above changing the API to pass a return code is out of question.

Comment 9 errata-xmlrpc 2015-07-22 07:03:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1452.html


Note You need to log in before you can comment on or make changes to this bug.