From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C0A9B138334 for ; Fri, 31 May 2019 08:02:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 608EFE08C3; Fri, 31 May 2019 08:02:21 +0000 (UTC) Received: from othala.iewc.co.za (othala.iewc.co.za [IPv6:2c0f:f720:0:1:21e:67ff:fe14:6ae5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E3F71E089D for ; Fri, 31 May 2019 08:02:20 +0000 (UTC) Received: from [165.16.203.61] (helo=tauri) by othala.iewc.co.za with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1hWcUS-0001yp-P8 for gentoo-dev@lists.gentoo.org; Fri, 31 May 2019 10:02:17 +0200 Received: from plastiekpoot.dhcp.uls.co.za ([192.168.42.155]) by tauri with esmtp (Exim 4.91) (envelope-from ) id 1hWcUS-00064e-92 for gentoo-dev@lists.gentoo.org; Fri, 31 May 2019 10:02:16 +0200 Subject: Re: [gentoo-dev] [PATCH 5/9] user.eclass: Die if no free UID/GID is found To: gentoo-dev@lists.gentoo.org References: <20190530125039.15591-1-mgorny@gentoo.org> <20190530125039.15591-6-mgorny@gentoo.org> From: Jaco Kroon Organization: Ultimate Linux Solutions (Pty) Ltd Message-ID: <14477f42-06d6-83b3-72e4-47fdbae2e6cd@uls.co.za> Date: Fri, 31 May 2019 10:02:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 In-Reply-To: <20190530125039.15591-6-mgorny@gentoo.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-report: Relay access (othala.iewc.co.za). X-Archives-Salt: cc6aadd6-c74f-4731-8c52-b0fa57f32f49 X-Archives-Hash: 07a3283cc824a4f51afab1db7b6b8a84 Hi, Why not utilize -r or --system as per useradd(8) in order to add system users? The limits for the allocated user ids comes from /etc/login.defs. Kind Regards, Jaco On 2019/05/30 14:50, Michał Górny wrote: > Signed-off-by: Michał Górny > --- > eclass/user.eclass | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/eclass/user.eclass b/eclass/user.eclass > index 1ffeaae29569..b16c4c6d69b7 100644 > --- a/eclass/user.eclass > +++ b/eclass/user.eclass > @@ -160,6 +160,7 @@ enewuser() { > for ((euid = 101; euid <= 999; euid++)); do > [[ -z $(egetent passwd ${euid}) ]] && break > done > + [[ ${euid} -le 999 ]] || die "${FUNCNAME}: no free UID found" > fi > opts+=( -u ${euid} ) > einfo " - Userid: ${euid}" > @@ -344,6 +345,7 @@ enewgroup() { > for ((egid = 101; egid <= 999; egid++)) ; do > [[ -z $(egetent group ${egid}) ]] && break > done > + [[ ${egid} -le 999 ]] || die "${FUNCNAME}: no free GID found" > fi > } >