Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 703258

Summary: [Future EAPI] die instead of outputting QA warning when encountering unknown commands during phase processing
Product: Gentoo Hosted Projects Reporter: Tim Harder <radhermit>
Component: PMS/EAPIAssignee: PMS/EAPI <pms>
Status: CONFIRMED ---    
Severity: normal CC: dev-portage, esigra, ferringb, mgorny, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=662992
https://bugs.gentoo.org/show_bug.cgi?id=566738
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 174380    

Description Tim Harder gentoo-dev 2019-12-18 05:37:17 UTC
Currently it appears portage only outputs QA warnings (via the _check_build_log() function) before a pkg is merged for unknown commands encountered while running ebuild phases. This feels optimistic at best that someone will notice and fix such warnings.

One example would be the current version of guile-2.2.6 in the tree that uses the filter-flags function in src_configure() but doesn't inherit the flag-o-matic eclass anymore where the function is defined. It appears the eclass was properly inherited in 2.2.4, but was possibly removed from 2.2.6 after deeming it unnecessary since no failures occurred and/or the build log wasn't examined after a successful build.

There have been and mostly likely still are many other examples of this throughout the tree. I know because pkgcore calls die when it encounters this situation and I think portage should do the same.

In summary, I think portage should define the command_not_found_handle() hook that calls die with a relevant message for all ebuild phases forcing developers to fix this issue in their ebuilds and eclasses.
Comment 1 Tim Harder gentoo-dev 2019-12-18 05:53:36 UTC
For more inspiration, here is how pkgcore handles things: https://github.com/pkgcore/pkgcore/blob/master/ebd/ebuild.bash#L332
Comment 2 Zac Medico gentoo-dev 2019-12-19 04:11:27 UTC
Let's make it fatal for EAPI 8.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-02-21 07:14:45 UTC
(In reply to Zac Medico from comment #2)
> Let's make it fatal for EAPI 8.

Is this in EAPI 8?

Note that this is more of a pain for src_test where often there are false positives.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-02-21 08:19:22 UTC
No, it has not been proposed for EAPI 8.  However, I think it is still fine to add it at this point.  Not that anyone has time to push more of EAPI 8 forward.

I presume this is just about commands directly called by ebuild and not by external tools/scripts.
Comment 5 Ulrich Müller gentoo-dev 2021-02-21 13:37:17 UTC
Would this only catch commands called directly from a phase function, or also commands executed from within the package's build system?

For the latter, I've seen several false positives, so I'm sceptical if catching this would be feasible.
Comment 6 Arfrever Frehtes Taifersar Arahesis 2021-02-21 19:05:39 UTC
(In reply to Ulrich Müller from comment #5)
> Would this only catch commands called directly from a phase function

Yes. command_not_found_handle() function here is not exported.

> or also commands executed from within the package's build system?

No. Such behavior would require additional 'export -f command_not_found_handle'.