When using dnf
and yum
on rpm based Linux distros (RHEL/Red Hat, Fedora, CentOS, etc) the utility will automatically wrap lines to make it more friendly for the user to read. This is problematic as it makes it extremely annoying to work with the data through pipelining.
For example:
$ dnf search jenkins-ssh-credentials-plugin-javadoc
Last metadata expiration check: 6 days, 15:30:08 ago on Thu Sep 1 21:09:10 2016.
============= N/S Matched: jenkins-ssh-credentials-plugin-javadoc =============
jenkins-ssh-credentials-plugin-javadoc.noarch : Javadoc for jenkins-ssh-credentials-plugin
$ dnf search jenkins-ssh-credentials-plugin-javadoc | grep ssh
====== N/S Matched: jenkins-ssh-credentials-plugin-javadoc =======
jenkins-ssh-credentials-plugin-javadoc.noarch : Javadoc for
: jenkins-ssh-credentials-plugin
You can see that once the output for DNF is put through grep
it decides to wrap the data in a completely different way then when normally displayed to the user.
Multiple issues have been filed about this behavior ( #584525, #986740 ) and consistently the issues are closed as CLOSED NOTABUG
because "Yum is an interactive text-based ui which is not suited, nor intended for piping.". The solution as per the Red Hat developers is to "use a different tool for the job."
It seems unreasonable to have to do this, especially when the methods supplied (install repoquery
for example) don't even exist within the dnf
utilities and require installing a dozen more packages just to parse the output of this data.
Ideally a user would be able to just use the data in pipelining. In lieu of that, it would be nice to have a simple one-liner which could be used to make the data usable.