Bug 1794856 - DNF sometimes produces hard to parse/hard to read output when not running in an interactive terminal
Summary: DNF sometimes produces hard to parse/hard to read output when not running in ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf
Version: 8.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: 8.0
Assignee: Jaroslav Mracek
QA Contact: Jan Blazek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-01-24 21:55 UTC by Frank Hirtz
Modified: 2020-04-28 16:49 UTC (History)
4 users (show)

Fixed In Version: dnf-4.2.17-3.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-28 16:49:13 UTC
Type: Bug
Target Upstream Version:
jblazek: needinfo-


Attachments (Terms of Use)
Reverts the colum handling for 'arch' to default (1.49 KB, patch)
2020-01-24 21:55 UTC, Frank Hirtz
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1823 None None None 2020-04-28 16:49:22 UTC

Description Frank Hirtz 2020-01-24 21:55:54 UTC
Created attachment 1655154 [details]
Reverts the colum handling for 'arch' to default

Description of problem:

dnf, when not running inside a real terminal, assumes output should be 80 characters long. This causes problems when the package names/versions are long, resulting in not having any whitespace left between the architecture and the  package version:

Last metadata expiration check: 0:00:05 ago on Tue Nov  5 20:49:31 2019.
Dependencies resolved.
================================================================================
 Package                         ArchVersion                                Repository        Size
================================================================================
Installing:
 ccm                             noarch18.12.0-rc9_SNAPSHOT20191105091101     bootstrap         133 k
 ms-systemd_persistent_eth       noarch2-1ms5.el8                             bootstrap         12 k
 ncm-cdispd                      noarch18.12.0-rc9_SNAPSHOT20191030222418     bootstrap         31 k
 ncm-ncd                         noarch18.12.0-rc7_SNAPSHOT20191030222534     bootstrap         52 k
 ncm-spma                        noarch18.6.1-SNAPSHOT20191030140314          bootstrap         47 k
 afsclient                       x86_641234567890:1.8.5-c1.msdw.rh8.el8       afs               14 k
 kmod-openafs-4.18.0-80.11.2     x86_641.8.5-c1.msdw.rh8.el8                  afs               390 k
 man-pages-overrides             noarch8.0.0-1.el8                            appstream         7.9 k
 hunspell-en                     noarch0.20140811.1-12.el8                    appstream         200 k
 ipmitool                        x86_641.8.18-10.el8                          appstream         393 k
 nmap-ncat                       x86_642:7.70-4.el8                           appstream         236 k
 tuned-utils                     noarch2.10.0-15.el8                          appstream         40 k
...

Such an output is hard to read for humans, but even harder to parse from scripts.

I'd expect dnf to ensure at least one space between the columns. 

Version-Release number of selected component (if applicable):
dnf-4.2.7-7.el8_1.noarch

How reproducible:
Do an install and pipe the output through something. If there are packages with long names/versions the arch loses its seperation and is just part of the string 

Steps to Reproduce:
[root@lab-rhel8-1 fmhirtz]# yum remove --assumeno bind-utils | grep -v fhoihf | head -15
Updating Subscription Management repositories.
Dependencies resolved.
================================================================================
 Package                  ArchVersion                               Repository                        Size
================================================================================
Removing:
 bind-utils               x86_6432:9.11.4-26.P2.el8                   @rhel-8-for-x86_64-appstream-rpms 1.4 M
Removing dependent packages:
 ipa-client               x86_644.8.0-10.module+el8.1.0+4107+4a66eb87 @rhel-8-for-x86_64-appstream-rpms 345 k
Removing unused dependencies:
 augeas-libs              x86_641.12.0-2.el8                          @rhel-8-for-x86_64-baseos-rpms    1.5 M
 autofs                   x86_641:5.1.4-35.el8                        @rhel-8-for-x86_64-baseos-rpms    4.0 M
 bind-libs                x86_6432:9.11.4-26.P2.el8                   @rhel-8-for-x86_64-appstream-rpms 267 k
 bind-libs-lite           x86_6432:9.11.4-26.P2.el8                   @rhel-8-for-x86_64-appstream-rpms 3.6 M
 bind-license             noarch32:9.11.4-26.P2.el8                   @rhel-8-for-x86_64-appstream-rpms 29 k
Operation aborted.
</control>


Expected results:
<test>
[root@lab-rhel8-1 ~]# rpm -q dnf
dnf-4.2.7-7test2.el8_1.noarch
[root@lab-rhel8-1 ~]# yum remove --assumeno bind-utils | grep -v fhoihf | head -15
Updating Subscription Management repositories.
Dependencies resolved.
================================================================================
 Package                  Arch   Version                               Repository                        Size
================================================================================
Removing:
 bind-utils               x86_64 32:9.11.4-26.P2.el8                   @rhel-8-for-x86_64-appstream-rpms 1.4 M
Removing dependent packages:
 ipa-client               x86_64 4.8.0-10.module+el8.1.0+4107+4a66eb87 @rhel-8-for-x86_64-appstream-rpms 345 k
Removing unused dependencies:
 augeas-libs              x86_64 1.12.0-2.el8                          @rhel-8-for-x86_64-baseos-rpms    1.5 M
 autofs                   x86_64 1:5.1.4-35.el8                        @rhel-8-for-x86_64-baseos-rpms    4.0 M
 bind-libs                x86_64 32:9.11.4-26.P2.el8                   @rhel-8-for-x86_64-appstream-rpms 267 k
 bind-libs-lite           x86_64 32:9.11.4-26.P2.el8                   @rhel-8-for-x86_64-appstream-rpms 3.6 M
 bind-license             noarch 32:9.11.4-26.P2.el8                   @rhel-8-for-x86_64-appstream-rpms 29 k
Operation aborted.


Additional info:

I worked up a quick patch which removes the special handling for the arch here and thus it's padded as all other fields are, but that might not be the best approach. I'll attach it as an option.

Comment 4 amatej 2020-02-19 13:37:07 UTC
I have created a dedicated test for this bug: https://github.com/rpm-software-management/ci-dnf-stack/pull/792

Comment 9 errata-xmlrpc 2020-04-28 16:49:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1823


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