Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 835460 - dev-python/twisted-22.1.0: twisted-regen-cache in pkg_postinst fails when ROOT != /
Summary: dev-python/twisted-22.1.0: twisted-regen-cache in pkg_postinst fails when ROO...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-17 04:32 UTC by Matt Whitlock
Modified: 2022-03-17 08:54 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 Matt Whitlock 2022-03-17 04:32:18 UTC
Installing dev-python/twisted into a separate ROOT causes a failure in pkg_postinst because it's trying to run "twisted-regen-cache" in the build sysroot (/), not in the host sysroot (${ROOT}).

Example:

# ROOT=/host emerge dev-python/twisted

Result:

 * python3_9: running python_postinst
/var/tmp/portage/dev-python/twisted-22.1.0/temp/environment: line 3092: twisted-regen-cache: command not found
 * ERROR: dev-python/twisted-22.1.0::gentoo failed (postinst phase):
 *   (no error message)
 * 
 * Call stack:
 *     ebuild.sh, line  127:  Called pkg_postinst
 *   environment, line 2625:  Called python_foreach_impl 'python_postinst'
 *   environment, line 2859:  Called multibuild_foreach_variant '_python_multibuild_wrapper' 'python_postinst'
 *   environment, line 2388:  Called _multibuild_run '_python_multibuild_wrapper' 'python_postinst'
 *   environment, line 2386:  Called _python_multibuild_wrapper 'python_postinst'
 *   environment, line  950:  Called python_postinst
 *   environment, line 3092:  Called die
 * The specific snippet of code:
 *       twisted-regen-cache || die

This happens because "twisted-regen-cache" is installed into ${ROOT}/usr/bin/, which is not in ${PATH} in the case that ROOT != /.

Even if "twisted-regen-cache" were to be invoked from its installed location beneath ${ROOT}, it still wouldn't do the right thing, as it would try to regenerate /usr/lib/${EPYTHON}/site-packages/twisted/plugins/dropin.cache, which is not the correct path unless ROOT == /.

I'm not aware of any way that an ebuild's pkg_postinst() function could chroot into ${ROOT} to run "twisted-regen-cache" to rebuild the *host* system's Twisted plugin caches (rather than the *build* system's), but that seems like it would work if it were possible. Maybe twisted-regen-cache could be improved so that it respects the ROOT environment variable.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-03-17 08:47:03 UTC
I don't really know enough about Twisted to know how to improve it.  I suppose the best I Can do is disable the cache update when ROOT!=/.
Comment 2 Larry the Git Cow gentoo-dev 2022-03-17 08:54:34 UTC
The bug has been referenced in the following commit(s):

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

commit dc0b1763c0ed633ec11a3b7bffa5cf87df5dc2f0
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2022-03-17 08:54:01 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2022-03-17 08:54:01 +0000

    dev-python/twisted: Do not update twisted cache for ROOT != /
    
    Bug: https://bugs.gentoo.org/835460
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 dev-python/twisted/twisted-22.2.0.ebuild | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)