Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 829837 - app-portage/portage-utils-0.93 breaks sys-kernel/genkernel initramfs with zfs
Summary: app-portage/portage-utils-0.93 breaks sys-kernel/genkernel initramfs with zfs
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Fabian Groffen
URL: https://pastebin.com/zmxDgNJM
Whiteboard:
Keywords:
: 829811 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-12-22 21:06 UTC by Jan Schermer
Modified: 2021-12-23 14:27 UTC (History)
6 users (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 Jan Schermer 2021-12-22 21:06:31 UTC
After upgrading to portage-utils-0.93 the next run of genkernel all (including initramfs) fails with:

"ERROR: Something went wrong: Did not found any udev-related files for sys-fs/zfs"

the code in question is this:

        local udevdir=$(get_udevdir)
        local udevdir_initramfs="/usr/lib/udev"
        local udev_files=( $(qlist -e sys-fs/zfs:0 \
                | grep -E -- "^${udevdir}")
        )

        if [ ${#udev_files[@]} -eq 0 ]
        then
                gen_die "Something went wrong: Did not found any udev-related files for sys-fs/zfs!"
        fi


I think the error lies in the colorization that 0.93 does which 0.92 didn't - I dumped what is being returned by qlist into a file and it looks like this:
.[00;32m/lib/udev/vdev_id.[00;00m

This breaks the grep condition as it doesn't really begin with the path (/lib/udev in my case)

I think it needs to check whether it's running without a terminal or something like that...

Reproducible: Always

Steps to Reproduce:
1. upgrade to portage-utils-0.93
2. genkernel --zfs all (?)

Actual Results:  
"ERROR: Something went wrong: Did not found any udev-related files for sys-fs/zfs"


Expected Results:  
No error :)

genkernel is invoked from a simple script that I use to upgrade to new kernels

#!/bin/bash

VER=$1

cp ~/kernconf /usr/src/linux/.config
pushd /usr/src/linux >/dev/null
make oldconfig
echo Press enter or break now
read
cp ~/kernconf ~/kernconf-$(date +%Y%m%d%H%M)
cp .config ~/kernconf
genkernel --no-clean --kernel-config=/root/kernconf --kernel-append-localversion=-${VER:-1} all && grub-mkconfig -o /boot/grub/grub.cfg


My terminal is bash inside screen running under mosh session, in case this is what somehow forces the colorization...
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-22 23:50:52 UTC
*** Bug 829811 has been marked as a duplicate of this bug. ***
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-12-22 23:52:12 UTC
Not clear to me if this is portage-utils needing to detect non-interactive terminals better or genkernel needing to invoke portage-utils differently.
Comment 3 Fabian Groffen gentoo-dev 2021-12-23 08:08:11 UTC
I've noticed colour differences before.  This seems like a regression afterall.
Comment 4 Thomas Arnett 2021-12-23 08:17:55 UTC
This also breaks package resources in app-admin/puppet-7.13.1. lib/puppet/provider/package/portage.rb parses the output of qatom, which is part of portage-utils. The query method passes a parsed category and name to eix, which returns code 1 because the color codes prevent a match. (Puppet then tries to pass the resulting exception to a method that requires a string, so the error message is "Could not evaluate: undefined method `scrub' for #<Puppet::ExecutionFailure:0xXXXXXXXXXXXXXXXX>".) Reverting to portage-utils 0.92 fixes it.
Comment 5 Larry the Git Cow gentoo-dev 2021-12-23 09:04:41 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8bd86794a2d48395fe27f39571badf3614afeb5e

commit 8bd86794a2d48395fe27f39571badf3614afeb5e
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2021-12-23 09:04:08 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2021-12-23 09:04:08 +0000

    package.mask: mask portage-utils-0.93 for colour breakage
    
    Bug: https://bugs.gentoo.org/829837
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 profiles/package.mask | 5 +++++
 1 file changed, 5 insertions(+)
Comment 6 Fabian Groffen gentoo-dev 2021-12-23 09:05:02 UTC
masked until this is sorted out
Comment 7 Joakim Tjernlund 2021-12-23 10:12:45 UTC
Option --nocolor to qlist seems to address this. I guess apps like above should
always pass that to avoid matching problems.
Comment 8 Fabian Groffen gentoo-dev 2021-12-23 10:40:37 UTC
Well, yes they can work around it (either setting NOCOLOR=1 in env, or passing --nocolor/-C) but in this case, it was never intended to produce colours when the output is not a terminal.
Comment 9 Larry the Git Cow gentoo-dev 2021-12-23 12:55:36 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=297e49f62a6520fce353b8e82f3bba430f1ea613

commit 297e49f62a6520fce353b8e82f3bba430f1ea613
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2021-12-23 12:53:42 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2021-12-23 12:53:42 +0000

    main: ensure default colouring is respected
    
    Introduced in v0.93, a regression on picking up colour default.
    
    We were setting nocolor variable, but before it was acted on, it was
    overwritten with a default.  So now instead set the default based on
    having a tty or not, and let profiles, env and flags override from
    there.
    
    Bug: https://bugs.gentoo.org/829837
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 applets.h | 14 +++++++++++---
 main.c    | 13 ++++++++++---
 2 files changed, 21 insertions(+), 6 deletions(-)

https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=95abc1123af8697a97425f515c9efa7d3259487f

commit 95abc1123af8697a97425f515c9efa7d3259487f
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2021-12-23 11:42:04 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2021-12-23 11:42:04 +0000

    Revert "tests/init: force colours off for all tests"
    
    This reverts commit 704a36ae325d8cbd3cee5b40cd4ad7bf937ab724.
    It actually hides a problem (as seen in bug #829837)
    
    Bug: https://bugs.gentoo.org/829837
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 tests/init.sh.in | 2 --
 1 file changed, 2 deletions(-)
Comment 10 Larry the Git Cow gentoo-dev 2021-12-23 13:14:06 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=53146fd0c56c99034b4e2dcf68c8ff7754393b46

commit 53146fd0c56c99034b4e2dcf68c8ff7754393b46
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2021-12-23 13:11:56 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2021-12-23 13:14:04 +0000

    app-portage/portage-utils-0.93.1: version bump to fix regression
    
    Closes: https://bugs.gentoo.org/829837
    Package-Manager: Portage-3.0.28, Repoman-3.0.3
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 app-portage/portage-utils/Manifest                                      | 2 +-
 .../{portage-utils-0.93.ebuild => portage-utils-0.93.1.ebuild}          | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
Comment 11 Jan Schermer 2021-12-23 14:27:10 UTC
I can confirm that 0.93.1 fixes it while keeping colors in terminal. Thank you.