Bug 1074461 - error messages in stdout when using rpm as a library
Summary: error messages in stdout when using rpm as a library
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Packaging Maintenance Team
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-10 10:09 UTC by Ales Kozumplik
Modified: 2014-03-25 10:34 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-03-25 10:34:06 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ales Kozumplik 2014-03-10 10:09:20 UTC
There's the following script:

#! /usr/bin/python

import rpm

if __name__ == '__main__':
    spec = rpm.spec(__file__)

That outputs:

error: line 3: Unknown tag: import rpm

In the stdout.

If one creates an empty dir and points the rpm.spec call to it there's even more:
error: Name field must be present in package: (main package)
error: Version field must be present in package: (main package)
error: Release field must be present in package: (main package)
error: Summary field must be present in package: (main package)
error: License field must be present in package: (main package)

If the lib outputs these into stdout, the output of client programs like DNF can look overly dramatic and confusing.

Comment 1 Ales Kozumplik 2014-03-10 10:13:08 UTC
Related DNF bug 1074461.

Comment 2 Ales Kozumplik 2014-03-10 10:13:44 UTC
(In reply to Ales Kozumplik from comment #1)
> Related DNF bug 1074461.

Should be bug 1074436.

Comment 3 Panu Matilainen 2014-03-10 13:18:40 UTC
rpm libraries output to rpmlog() which defaults to stderr (not stdout), but which you can redirect to another file, including of course /dev/null:

sink = open("/dev/null", "w")
rpm.setLogFile(sink)

Comment 4 Ales Kozumplik 2014-03-10 13:48:46 UTC
Thanks Panu, updated our code.

Comment 5 Panu Matilainen 2014-03-25 10:34:06 UTC
NOTABUG as per comment #3, the output is not to stdout/stderr but to a client controllable log.


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