Bug 1327509 - [rfe] colorize output (e.g., to better distinguish between standard "dnf update" content and lines spewed in the scriptlets)
Summary: [rfe] colorize output (e.g., to better distinguish between standard "dnf upda...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: rawhide
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
Assignee: Martin Hatina
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-15 09:28 UTC by Jan Pokorný [poki]
Modified: 2017-08-14 06:24 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-14 06:24:45 UTC
Type: Bug


Attachments (Terms of Use)

Description Jan Pokorný [poki] 2016-04-15 09:28:03 UTC
The lines emitted from %post et al. scriptlets may require attention
of the administrator.

Real world example (with admittedly not so important messages burried
in the surrounding lines):

# dnf update -y
> [...]
>   Cleanup     : java-1.8.0-openjdk-headless-1:1.8.0.72-1.b15.fc22.x86_64                                                                                              422/543 
> warning: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-1.b15.fc22.x86_64/jre/lib/security/local_policy.jar saved as /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-1.b15.fc22.x86_64/jre/lib/security/local_policy.jar.rpmsave
> warning: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-1.b15.fc22.x86_64/jre/lib/security/US_export_policy.jar saved as /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.72-1.b15.fc22.x86_64/jre/lib/security/US_export_policy.jar.rpmsave
> [...]
>   Cleanup     : acpid-2.0.23-4.fc22.x86_64                                                                                                                            543/543 
> Disabling early microcode, because kernel does not support it. CONFIG_MICROCODE_[AMD|INTEL]_EARLY!=y
>   Verifying   : kernel-core-4.4.6-201.fc22.x86_64                                                                                                                       1/543 
>   Verifying   : kernel-4.4.6-201.fc22.x86_64      
> [...]

Would be nice if the type of information on the line would be indicated
by different colors (or default vs. colorized) if attached to a terminal,
so a quick scan through scroll-back buffer would make it clear what may
require further investigation/intervention.

Note that parametrizing the colors for the output does not necessarily
have to be in proper dnf configuration files, there is at least a single
alternative schema (utilized by linux-utils that also introduced that):
https://github.com/karelzak/util-linux/blob/master/lib/terminal-colors.d.5
and it might be actually a good idea to standardize on that as such
settings are merely non-functional.

(for that java-1.8.0-openjdk-headless output, there's [1142153]
 ... as a reminder that packaging bugs do happen and the more blatant
 the possible signs of that are, the better)

Comment 1 Honza Silhan 2016-04-18 11:52:15 UTC
Thanks for the report

Comment 2 Fedora Admin XMLRPC Client 2016-07-08 09:26:40 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 Jan Pokorný [poki] 2016-07-28 17:00:55 UTC
To follow up on this, I think I am going to write some easy parser of
files per TERMINAL_COLORS.D(5) convention for clufter[1].  But indeed,
it would be nice if there was some common library for that so if anyone
wants to beat me in this effort, I'd happily use that (if not too
bloaty and GPLv2+ license compatible).  Conversely, I'll try to write
it in a way it could be separated from clufter project if desirable.

[1] https://pagure.io/clufter (in fact, there is some colors handling
    already implemented in utils_prog.py, but in another context)

Comment 4 Martin Hatina 2017-08-14 06:24:45 UTC
Fixed by https://github.com/rpm-software-management/dnf/pull/858


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