Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 861116 - app-portage/gentoolkit-0.6.1-r3 (and r2, presumably all 0.6 to date) equery -N switch ignored
Summary: app-portage/gentoolkit-0.6.1-r3 (and r2, presumably all 0.6 to date) equery -...
Status: IN_PROGRESS
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-26 05:47 UTC by Duncan
Modified: 2022-07-28 15:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan 2022-07-26 05:47:37 UTC
I have a script that equery lists installed versions of a few packages, checking them against a stored list.[1]  It pipes equery -N output to a sed filter, with the -N there to keep full colored output despite the pipe to sed.

Running the script today I noticed the output wasn't colored any longer for the current output.[1]  Testing the bare equery -N at the commandline revealed that it kept colored output, while feeding it to cat to test the piped output without the sed complicating things killed the color.

So equery -N no longer seems to do what it says on the tin (aka in the manpage).  The installed gentoolkit was 0.6.1-r3.

I checked my binpkgs and still had 0.6.1-r2 and 0.5.1-r1.  Reverting to 0.6.1-r2 yielded the same result, while reverting to 0.5.1-r1 gave me back a working equery -N with my expected colored output.

---
[1] The script is to compare installed versions against those I had when I last updated my initramfs, as well as against the versions for the previous (backup) initramfs.  On the initial run today, it didn't color the current installed but was still coloring both stored lists.  After the initramfs update it failed to color both the current installed and the newest stored list, which of course had just been generated by the update, but the backup list was still colored.  Presumably running it again (if I hadn't reverted to 0.5.1-r1) would kill the color on the backup list as well.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-26 07:27:56 UTC
Could you bisect?
Comment 2 Duncan 2022-07-26 10:58:14 UTC
(In reply to Sam James from comment #1)
> Could you bisect?

Bisects to (unsurprisingly given the description)...

commit 84ffe42e5 (refs/git-r3/app-portage/gentoolkit/0/__old__, refs/git-r3/app-portage/gentoolkit/0/__main__)
Author:     Brian Dolbec <dolsen@>
AuthorDate: Sat Jul 9 18:06:50 2022 -0700
Commit:     Brian Dolbec <dolsen@>
CommitDate: Sat Jul 9 18:06:50 2022 -0700

equery: Turn off color when piping is set

Bug: https://bugs.gentoo.org/506394

Signed-off-by: Brian Dolbec <dolsen@>
---
pym/gentoolkit/equery/__init__.py | 2 ++
1 file changed, 2 insertions(+)

diff --git a/pym/gentoolkit/equery/__init__.py b/pym/gentoolkit/equery/__init__.py
index cecb5bee3..56b2caaad 100644
--- a/pym/gentoolkit/equery/__init__.py
+++ b/pym/gentoolkit/equery/__init__.py
@@ -228,6 +228,8 @@ def initialize_configuration():
# set extra wide, should disable wrapping unless
# there is some extra long text
CONFIG["termWidth"] = 600
+        # turn off color
+        pp.output.nocolor()

CONFIG["debug"] = bool(os.getenv("DEBUG", False))


I've not looked at the larger context but apparently that's unconditional re: -N, and shouldn't be.
Comment 3 Larry the Git Cow gentoo-dev 2022-07-28 15:29:05 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=9a402fba0d63240685a2326926060c3c8c523101

commit 9a402fba0d63240685a2326926060c3c8c523101
Author:     Brian Dolbec <dolsen@gentoo.org>
AuthorDate: 2022-07-28 15:22:55 +0000
Commit:     Brian Dolbec <dolsen@gentoo.org>
CommitDate: 2022-07-28 15:22:55 +0000

    equery: Set nocolor for piping to after options are parsed
    
    Fixes commit 84ffe42e5 which set nocolor before options were parsed.
    
    Bug: https://bugs.gentoo.org/861116
    
    Signed-off-by: Brian Dolbec <dolsen@gentoo.org>

 pym/gentoolkit/equery/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)