Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1358245 - repoquery: valid use of stderr and stdout, use stdout only for requested data
Summary: repoquery: valid use of stderr and stdout, use stdout only for requested data
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 24
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-20 10:40 UTC by Pavel Raiskup
Modified: 2017-10-09 06:16 UTC (History)
9 users (show)

Fixed In Version: dnf-2.0.1-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-10 10:57:33 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 1499623 None CLOSED Mishandling stderr vs stdout (dnf search, dnf repoquery) 2019-01-17 10:50:31 UTC

Internal Links: 1499623

Description Pavel Raiskup 2016-07-20 10:40:11 UTC
This should ease writing maintainer's scripts.

See the command output:
$ dnf repoquery --disablerepo=* --enablerepo hell \
--repofrompath=hell,http://ftp.fi.muni.cz/pub/linux/fedora/linux/development/rawhide/Everything/x86_64/os/ \
--whatrequires postgresql-jdbc 2>/dev/null
Added hell repo from http://ftp.fi.muni.cz/pub/linux/fedora/linux/development/rawhide/Everything/x86_64/os/
Last metadata expiration check: 4:43:42 ago on Wed Jul 20 07:54:15 2016.
libreoffice-base-1:5.2.0.1-1.fc25.x86_64
weka-0:3.6.14-1.fc25.noarch

While I would expect:
$ dnf repoquery --disablerepo=* --enablerepo hell \
--repofrompath=hell,http://ftp.fi.muni.cz/pub/linux/fedora/linux/development/rawhide/Everything/x86_64/os/ \
--whatrequires postgresql-jdbc 2>/dev/null
libreoffice-base-1:5.2.0.1-1.fc25.x86_64
weka-0:3.6.14-1.fc25.noarch

Comment 1 Jaroslav Mracek 2016-08-01 12:54:46 UTC
I would like to inform you about possibility to use -q or --quiet option. In combination with a non-interactive command it shows just the relevant content. It suppresses messages notifying about current state or actions of DNF.

It should solve the problem, therefore I am closing the bug. Please if you will find any further problem, don't hesitate to report it.

Comment 2 Igor Gnatenko 2016-08-05 06:20:07 UTC
I'm thinking that reporter is correct.

Comment 3 Jaroslav Mracek 2016-12-02 15:57:40 UTC
Fixed in PR: https://github.com/rpm-software-management/dnf/pull/673
If anything else appear in stdout, please report it again.

Comment 4 Neal Gompa 2016-12-07 13:32:13 UTC
This seems like a terrible idea. It might just be better to have a flag for suppressing info messages as well as warnings, etc. (I thought we do with --quiet?)

Warnings are for potential problems, not informational messages. The behavior done in PR 673 should be reverted.

Comment 5 Pavel Raiskup 2016-12-07 14:42:58 UTC
(In reply to Neal Gompa from comment #4)
> This seems like a terrible idea. It might just be better to have a flag for
> suppressing info messages as well as warnings, etc. (I thought we do with
> --quiet?)

Well, that's different thing.  The idea was about moving some writes from
stdout to stderr, so stdout is (ideally) easily parseable.

> Warnings are for potential problems, not informational messages. The
> behavior done in PR 673 should be reverted.

Thanks for the point, I tend to agree - this is not the ideal fix.

Comment 6 Jaroslav Mracek 2016-12-09 07:46:07 UTC
Ok, but this is not the first change of that kind. The information about Last metadate ... is now also on stderr. Also -q option behave differently. Now it suppress all (info, debud, warning, error, critical), but originally it only suppress info. From my point of view if output of repoquery is used for any script, it should use -q option, therefore any adjustments are nonsense. 
We can really play with it, but one user will request that and another something different.

Comment 7 Pavel Raiskup 2016-12-09 08:04:00 UTC
I took this bug as an advice only.
That's how things work in our GNU/Linux ecosystem (at least) .. data goes
to stdout, and warnings/errors go to stderr -> which makes it trivial to parse
what I ask for and to suppress warnings by '2>/dev/null' (-q is not important
usually, unless you want to suppress some stdout output, too).

> We can really play with it, but one user will request that and another
> something different.

I believe that the behavior I explained is what random hacker would expect,
but that's really just a matter of quality of implementation, not a huge deal.
Neither a blocker of any kind for me - with a bit of carefulness I can
parse the output anyway or hack my own repoquery-like script in python
as a replacement for repoquery, it is just not that convenient.
So pick the resolution arbitrarily.

Comment 8 Panu Matilainen 2016-12-09 08:29:13 UTC
My 5c:

The original yum-based repoquery was first and foremost designed for as a scripting tool in the traditional unix sense - zero extra output *by default*, errors to stderr and none of the interactive-text-ui-thing that yum itself is/was. Like yum, dnf provides list and search etc commands for interactive work, with progress reports and all that. So please preserve the hardcore scripting orientation in repoquery, it always was a specialized tool just for that.

Comment 9 Jaroslav Mracek 2016-12-09 12:47:02 UTC
Well here is the new solution: https://github.com/rpm-software-management/dnf/pull/681

Comment 10 Jaroslav Mracek 2017-03-10 10:57:33 UTC
Fixed in dnf-2.0.1-1 and released into rawhide


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