Summary: | eutils.eclass - enewuser/enewgroup adds users/groups to the build machine instead of the build target designed by $ROOT | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Hugo Chargois <hugo.chargois> |
Component: | Eclasses | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | ||
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Hugo Chargois
2010-07-21 15:13:47 UTC
Ebuild developers should take care to only add these users/groups to the build host when the build system (configure/compile/install phases) fail without them, and equally that the users/groups are added to the target system too. For the first purpose we have the pkg_setup() phase. The pkg_preinst() and pkg_postinst phases are there to introduce new users/groups to the target system. However, there is nothing wrong with the concepts of enewuser and enewgroup themselves - what you could provide instead are examples of where the use of these functions goes wrong, and file separate bugs for separate cat-egory/pkg's. (In reply to comment #1) You are right about making the distinction between the build-time and run-time, where new users/groups need to be added to the build system and to the target system, respectively. Yet, even compliant ebuilds (eg. net-misc/dhcp/dhcp-3.1.2_p1.ebuild) where enewuser/enewgroup are used in an install function (pkg_preinst in the case of dhcp) do not work properly. The group and user 'dhcp' get added on the build system. That is understandable and expected from the code of enew{user,group} since it doesn't check for the $EBUILD_PHASE if it is setup or preinst or postinst, and it just calls useradd and groupadd without any reference to $ROOT. btw, it checks if $EBUILD_PHASE is unpack|compile|test|install but not prepare which is a sandboxed function too, isn't that a mistake? Proposed fix: replace useradd (groupadd) with a wrapper that would check $EBUILD_PHASE and run useradd (groupadd) directly if it is setup, and run chroot $ROOT useradd (groupadd) if it is preinst or postinst. *** This bug has been marked as a duplicate of bug 266246 *** |