The Portage user.eclass script does not respect the values for SYS_UID_MIN and SYS_UID_MAX when selecting the UID of a new user, always explicitly passing the '-u <UID>' option to 'useradd' with a value selected from the hard-coded range 101-999, even calling it on targets that support allowing useradd to choose a UID for us. This hard-coded range is in the general case unnecessary: in the absence of the '-u' option, 'useradd' will read /etc/login.defs and choose an appropriate allocation from the ranges therein defined for the caller. There exist machines where the values for SYS_UID_MIN and SYS_UID_MAX set in /etc/login.defs differ from conventional practice (e.g., enterprise environments, wherein the ranges of available system UIDs may be dictated by network mappings). It is preferable to respect these values in such environments where possible. One also observes that user.eclass already behaves in the desired manner with respect to groups when calling 'groupadd' and falls back on the hard-coded GID range 101-999 only for targets that require it. The attached patch for user.eclass conservatively modifies the enewuser function to behave similarly to the enewgroup function, following its example, such that a manually set UID is provided by the internal function _enewgroup_next_uid only for targets that require it and where no pre-defined UID is chosen by the ebuild; otherwise, it allows useradd to choose an appropriate UID for us. Reproducible: Always Steps to Reproduce: 1. Alter SYS_UID_MIN and SYS_UID_MAX in /etc/login.defs to suitable values outside the range 101-999. 2. Emerge a package that installs a user via the 'enewuser' function. Actual Results: The user has been installed with an UID from the range 101-999. Expected Results: The user has been installed with an UID from the range defined by SYS_UID_MIN and SYS_UID_MAX in /etc/login.defs.
Created attachment 529806 [details, diff] proposed patch
Created attachment 529808 [details, diff] proposed patch Replaces nonsensical _enewgroup_next_uid function name with _enewuser_next_uid as intended.
user.eclass has been removed from the gentoo repo.