Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 629106 - kernel-2.eclass: detect_arch calls 'tr' in global scope
Summary: kernel-2.eclass: detect_arch calls 'tr' in global scope
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal critical (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 629222 702280
  Show dependency tree
 
Reported: 2017-08-27 20:52 UTC by Michał Górny
Modified: 2021-02-10 23:46 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 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-08-27 20:52:50 UTC
PMS is quite clear here:

> When an ebuild is being sourced for metadata querying rather than for a build
> (that is to say, when none of the src_ or pkg_ functions are to be called), no
> external command may be executed. The package manager may take steps to enforce
> this.

You have to do with pure bash. This is triggering breakage for a lot of overlays now and preventing me from looking for more specific breakages. Please fix ASAP.
Comment 1 dwfreed 2017-08-27 21:20:54 UTC
While you're fixing this function, tc-arch-kernel can't be used in global scope either, because it depends on CTARGET/CHOST.  From PMS (section 7.1):

> Globally defined ebuild variables without a special meaning must similarly
> not rely upon variable data.

ARCH_PATCH is only used by xbox-sources in the gentoo tree, and even there it's not actually needed, so it could just be dropped.
Comment 2 Mike Pagano gentoo-dev 2017-08-28 10:44:09 UTC
(In reply to Michał Górny from comment #0)
> PMS is quite clear here:
> 
> > When an ebuild is being sourced for metadata querying rather than for a build
> > (that is to say, when none of the src_ or pkg_ functions are to be called), no
> > external command may be executed. The package manager may take steps to enforce
> > this.
> 
> You have to do with pure bash. This is triggering breakage for a lot of
> overlays now and preventing me from looking for more specific breakages.
> Please fix ASAP.

Overlay and example of the breakage for me, please.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-08-28 11:17:01 UTC
https://gitweb.gentoo.org/report/repos.git/tree/ShyPixie.txt?id=c3559203e8cb232fe20c2c3faac2fadf13631057

However, gentoo-sources::gentoo fail the same.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-08-28 18:28:17 UTC
Example ::gentoo error:

 *   External commands disallowed during metadata regen: tr [:lower:] [:upper:]
 * 
 * Call stack:
 *       isolated-functions.lib, line  345:  Called source '/home/mgorny/tmp/gentoo/sys-kernel/ck-sources/ck-sources-4.11.12.ebuild'
 *    ck-sources-4.11.12.ebuild, line   21:  Called detect_arch
 *              kernel-2.eclass, line 1430:  Called command_not_found_handle 'tr' '[:lower:]' '[:upper:]'
 *           ebuild-daemon.bash, line  383:  Called die


Applies to:
sys-kernel/ck-sources
sys-kernel/gentoo-sources
sys-kernel/raspberrypi-sources
sys-kernel/tuxonice-sources
sys-kernel/xbox-sources
Comment 5 Ulrich Müller gentoo-dev 2017-09-05 19:30:09 UTC
(In reply to dwfreed from comment #1)
> While you're fixing this function, tc-arch-kernel can't be used in global
> scope either, because it depends on CTARGET/CHOST.  From PMS (section 7.1):
> 
> > Globally defined ebuild variables without a special meaning must similarly
> > not rely upon variable data.
> 
> ARCH_PATCH is only used by xbox-sources in the gentoo tree, and even there
> it's not actually needed, so it could just be dropped.

Right, none of the ebuilds in sys-kernel/*-sources actually sets ${ARCH}_URI, which means that detect_arch is a no-op and ARCH_URI and ARCH_PATCH will end up empty.
Comment 6 Mike Pagano gentoo-dev 2017-09-06 18:32:44 UTC
(In reply to Ulrich Müller from comment #5)
> (In reply to dwfreed from comment #1)
> > While you're fixing this function, tc-arch-kernel can't be used in global
> > scope either, because it depends on CTARGET/CHOST.  From PMS (section 7.1):
> > 
> > > Globally defined ebuild variables without a special meaning must similarly
> > > not rely upon variable data.
> > 
> > ARCH_PATCH is only used by xbox-sources in the gentoo tree, and even there
> > it's not actually needed, so it could just be dropped.
> 
> Right, none of the ebuilds in sys-kernel/*-sources actually sets
> ${ARCH}_URI, which means that detect_arch is a no-op and ARCH_URI and
> ARCH_PATCH will end up empty.

Right. So we lose a feature that an ebuild could use because PMS makes us do a hack since we can't easily lowercase a variable.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-09-06 20:13:45 UTC
If no ebuild needs it right now, why not require EAPI 6 for it? Then you can uppercase/lowercase easily.
Comment 8 Mike Pagano gentoo-dev 2017-09-06 22:29:59 UTC
(In reply to Michał Górny from comment #7)
> If no ebuild needs it right now, why not require EAPI 6 for it? Then you can
> uppercase/lowercase easily.

That's a useful and sane recommendation.   I will do that.
Comment 9 Mike Pagano gentoo-dev 2021-02-10 23:46:15 UTC
fixed awhile ago.

tr is not used anywhere in kernel-2.eclass