Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: addtional output in rpmspec with -q #3413

Closed
xsuchy opened this issue Oct 30, 2024 · 4 comments
Closed

Regression: addtional output in rpmspec with -q #3413

xsuchy opened this issue Oct 30, 2024 · 4 comments

Comments

@xsuchy
Copy link
Member

xsuchy commented Oct 30, 2024

Describe the bug
When I run:

rpmspec -q --qf '%{license}\n' '--define=_sourcedir .' ~/spdx/cfn-lint/cfn-lint.spec 2>/dev/null

on this spec file https://src.fedoraproject.org/rpms/cfn-lint/blob/rawhide/f/cfn-lint.spec

I get:

Reading /var/tmp/rpm-tmp.bSC32X
MIT-0 AND MIT
MIT-0 AND MIT
MIT-0 AND MIT
MIT-0 AND MIT
MIT-0 AND MIT

which is more lines than expected and contains line that should be on stderr (or not printed at all because of -q)

To Reproduce
Steps to reproduce the behavior:

  1. fedpkg clone cfn-lint
  2. cd cfn-lint
  3. rpmspec -q --qf '%{license}\n' '--define=_sourcedir .' cfn-lint.spec 2>/dev/null

Please link or attach the packages or spec files involved.

Expected behavior

I expected that the line Reading /var/tmp/rpm-tmp.bSC32X is not present, because I used -q option.
And I would expect the line with the license printed only once.

Output

Environment

  • Fedora 41
  • rpm-build-4.20.0-1.fc41.x86_64

Additional context
I believe this did not happened a week ago (when I used F41 Beta).

@pmatilai
Copy link
Member

This will happen with any spec using Buildsystem, there's no difference from any 4.20 preversion to upstream git master so it's not a regression within Buildsystem-using packages, but for rpmspec in general yes.

Luckily it's also trivial to fix.

pmatilai added a commit to pmatilai/rpm that referenced this issue Oct 30, 2024
Dynamic spec parsing emits "Reading <path>" messages to make it clear
something out of the ordinary is going on, but this is undesireable
on rpmspeq queries. Luckily there's a trivial solution: rpmbuild where
you want these messages runs in verbose mode by default whereas rpmspec
does not. So just moving the message to INFO level does exactly the
right thing in both the above cases and as an added bonus,
rpmbuild --quiet too. Add a test to go.

Fies: rpm-software-management#3413
@pmatilai
Copy link
Member

I expected that the line Reading /var/tmp/rpm-tmp.bSC32X is not present, because I used -q option.

In rpmspec, -q means query, not quiet. rpmbuild is verbose by default, rpmspec is not, it's just that the "Reading..." message was in the "wrong" level for this purpose, in the original context dynamic spec parsing only occurred during builds and not plain spec parsing.

And I would expect the line with the license printed only once.

rpmspec queries the binary packages by default, so you get one line of output per each subpackage, this is how it's always been and not a bug. If you want to query the source rpm instead (of which there will obviously only be one), use rpmspec --srpm.

pmatilai added a commit to pmatilai/rpm that referenced this issue Oct 30, 2024
Dynamic spec parsing emits "Reading <path>" messages to make it clear
something out of the ordinary is going on, but this is undesireable
on rpmspec queries. Luckily there's a trivial solution: rpmbuild where
you want these messages runs in verbose mode by default whereas rpmspec
does not. So just moving the message to INFO level does exactly the
right thing in both the above cases. Add a test to go.

Fies: rpm-software-management#3413
pmatilai added a commit to pmatilai/rpm that referenced this issue Oct 30, 2024
Dynamic spec parsing emits "Reading <path>" messages to make it clear
something out of the ordinary is going on, but this is undesireable
on rpmspec queries. Luckily there's a trivial solution: rpmbuild where
you want these messages runs in verbose mode by default whereas rpmspec
does not. So just moving the message to INFO level does exactly the
right thing in both the above cases. Add a test to go.

Fies: rpm-software-management#3413
dmnks pushed a commit that referenced this issue Oct 30, 2024
Dynamic spec parsing emits "Reading <path>" messages to make it clear
something out of the ordinary is going on, but this is undesireable
on rpmspec queries. Luckily there's a trivial solution: rpmbuild where
you want these messages runs in verbose mode by default whereas rpmspec
does not. So just moving the message to INFO level does exactly the
right thing in both the above cases. Add a test to go.

Fies: #3413
@pmatilai
Copy link
Member

Fixed by #3414, just a typo in the Fixes clause, doh.

@pmatilai
Copy link
Member

Oh and thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants