Summary: | [tracker] ebuilds calling enewgroup/enewuser in pkg_setup() - probably not desired in many cases | ||
---|---|---|---|
Product: | Documentation | Reporter: | Gordon Malm (RETIRED) <gengor> |
Component: | Devmanual | Assignee: | Gentoo Devmanual Team <devmanual> |
Status: | RESOLVED OBSOLETE | ||
Severity: | normal | CC: | alexander, alex_y_xu, esycat, kensington, mjo, nimiux, pva, qa, solar, tcunha, xmw |
Priority: | High | Keywords: | Tracker |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | 487172 | ||
Bug Blocks: |
Description
Gordon Malm (RETIRED)
![]() We actually standardized on adding users in pkg_setup() for the simple fact that binary packages are broken when adding the users in pkg_preinst(). Basically because installing a binary package does not call the pkg_preinst() function, so your suggested fix would break packages instead of the current way which has an annoying side effect. Additionally, base-system has nothing to do with this. Allowing bug wrangler to properly assign the bug. solar, I'm only CCing you because I know you're interested in binary packages and have some valuable input. (In reply to comment #1) > We actually standardized on adding users in pkg_setup() for the simple fact > that binary packages are broken when adding the users in pkg_preinst(). > Basically because installing a binary package does not call the pkg_preinst() > function, so your suggested fix would break packages instead of the current way > which has an annoying side effect. > By binary package do you mean a package built with -b/-B/--buildpkg/--buildpkgonly? Those do run pkg_preinst() @ subsequent install. If not, could you give me an example of what you are referring to? > Additionally, base-system has nothing to do with this. Allowing bug wrangler to > properly assign the bug. I did, they assigned it to base-system. :) Examples of further issues with this are packages which require a user/group and then the src_install() step actually uses these users since the package's make install will chown/chgrp those files over to that user. There are many bugs in Bugzilla with that usage that have been fixed by moving the user creation to pkg_setup. Most mail setups, databases, and other packages suffer from this. Packages I know off the top of my head which would have this issue include, but are not limited to: dovecot, mysql, postgresql, postfix, dbus, hal, mythtv (In reply to comment #3) > Examples of further issues with this are packages which require a user/group > and then the src_install() step actually uses these users since the package's > make install will chown/chgrp those files over to that user. There are many > bugs in Bugzilla with that usage that have been fixed by moving the user > creation to pkg_setup. > Yes and that is why I stated: "I'd suggest any ebuilds not requiring the group/user to be installed in order to complete src_* functions..." Any ebuild that does the job of setting ownership/perms itself (rather than the make process) can do so after calling enew{group,user} from pkg_preinst(). Actually using pkg_setup is what devmanual suggests. I was about to modify ebuilds to fix pkg_preinstall to pkg_setup but found this bug. So what is the outcome? I'll CC qa may be they'll suggest us something. There is/was no outcome. just change the documentation and be done. both pkg_* functions are safe and really it's only a bug in the ebuild if it needs the user/group at compile time but created them in pkg_preinst rather than pkg_setup. *** Bug 237275 has been marked as a duplicate of this bug. *** (In reply to Peter Volkov from comment #5) > Actually using pkg_setup is what devmanual suggests. I was about to modify > ebuilds to fix pkg_preinstall to pkg_setup but found this bug. So what is > the outcome? I'll CC qa may be they'll suggest us something. Almost did the same thing with djbdns, five years later. First suggestion, https://devmanual.gentoo.org/ebuild-writing/functions/pkg_preinst/index.html: Adding users and groups. However, since pkg_preinst may be called after src_compile, pkg_setup is the more suitable location for user creation — see Users and Groups. Second suggestion, https://devmanual.gentoo.org/ebuild-writing/users-and-groups/index.html: Regardless of whether you are adding a group or a user, this should be performed in the pkg_setup function: pkg_setup is sandbox-safe, is called before the compile process so a build that requires the user to exist will have it, and is also called for both binary and source packages. It does say afterwards that you /may/ use pkg_preinst(), but it's bad practice to say something that may be wrong and count on the reader to keep reading long enough to get to the "but..." It seems like pkg_preinst is preferred, unless there is some necessity for pkg_setup? If so, we could list the reasons for preferring pkg_preinst and list the exceptions where pkg_setup is required. So should we re-assign this to the maintainers of the devmanual? Yeah, why is it assigned to you? Then if individual packages have problems, we can open bugs one-at-a-time and point people to the devmanual. Since this is assigned to the devmanual team pending a documentation update, and since user.eclass is now deprecated in favor of GLEP 81, I'm suggesting that we mark this whole thing obsolete. The devmanual is being updated for GLEP 81 and these problems will eventually fade away. GLEP81 is now in the devmanual, too. This problem will slowly go away as people migrate to acct-user packages. |