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
Moving unnecessary notice about empty rpm packages to debug message. #615
Moving unnecessary notice about empty rpm packages to debug message. #615
Conversation
This notice makes a problem when you want to process an output of rpm -ql of an empty rpm package in a shell script.
Isn't that what the |
No, definitely no. Because --quiet switch suppresses all output, so the output of rpm -ql of a normal package with a set of files included in will be also empty. Example: So you can't use --quiet switch to get number of package's files in a shell script. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This (spewing "helpful" messages into stdout) is a much broader problem than just this one message, and we should address them all at once or not at all. As much as mostly everybody hates these "helpful" messages, changing them will break some scripts that expect them there, so if/when breakage is necessary it's better to break clean once than a little bit here in one release and some other bit in the next etc. |
You can use rpm -q --qf='%{FILENAMES:arraysize}\n' to get the number of files. |
No, you can't even rely on this behavior in scripts, because this message (contains no files) is locale-dependent. You can't use it. Example: |
Ok. And what about getting a list of included files? Do you have a dirty trick for that? And why we can't just trust |
if the problem is an empty file being queried, why not solve teh problem where the action occurs (before the test), with something simple like: [ -s $ARG ] && ... I don't see that this is the rpm binary's issue |
I completely disagree with this imprisonment. You (or your team ) made strange, unpopular decision that makes problems for simple (popular, expected) case. Other software put this warning to stderr or just return nothing with success code. You forced developers to produce hardcode that forces bugs with different behaviors in environments. Software shouldn't force you to write bad code. @ignatenkobrain makes same pr previusly. |
You can get the list of files with rpm -q --qf='[%{FILENAMES}\n]'. There is nothing dirty about that, those are the building blocks. |
So, for what And, as example same behaviour of $ mkdir empty_dir
$ cd empty_dir/
$ ls
$ echo $?
0 |
For the same reason there is ls when a script uses *. |
I think that the patch fixes an ERROR in user interface of rpm utility. Also look at PO files of the project. Some of translators understand this issue and got rid of this message from translations (i.e. po/sl.po, po/da.po, po/id.po and some others). |
Like said, this is a generic problem in rpm where diagnostic messages are dumped on stdout. Other similar examples include (but not limited to):
All spewed into stdout against core unix principles. But the world is full of scripts that grep specifically for these messages because they've always been there. And so there are scripts that test for empty packages by grepping specifically for that "(contains no files)" message, and changing it would break those scripts. Ditto for all the other similar cases. And that's exactly why we need to address the generic problem rather than individual messages so we can do a clean break that people can also then adjust to, once. I fully agree the rpm behavior is in error, but this is not the right fix to the overall problem. NAK. |
This notice makes a problem when you want to process an output of rpm -ql of an empty rpm package in a shell script.
Example:
$ rpm -ql gpg-pubkey-f2ee9d55-560cfc0a
(contains no files)
$ rpm -ql gpg-pubkey-f2ee9d55-560cfc0a | wc -l
1
But the package is empty!