1 |
On Sat, 2019-07-27 at 10:40 +0200, Ulrich Müller wrote: |
2 |
> Fixed UIDs and GIDs are mostly located in the low range, therefore |
3 |
> going downwards from 999 to 101 will minimise collisions between fixed |
4 |
> and dynamically allocated IDs. |
5 |
> |
6 |
> Note that on Linux and other targets using "groupadd -r" from |
7 |
> sys-apps/shadow, GIDs are already allocated that way implicitly. |
8 |
> |
9 |
> Signed-off-by: Ulrich Müller <ulm@g.o> |
10 |
> --- |
11 |
> eclass/user.eclass | 8 ++++---- |
12 |
> 1 file changed, 4 insertions(+), 4 deletions(-) |
13 |
> |
14 |
> diff --git a/eclass/user.eclass b/eclass/user.eclass |
15 |
> index fdf98caa6099..6563a03a1505 100644 |
16 |
> --- a/eclass/user.eclass |
17 |
> +++ b/eclass/user.eclass |
18 |
> @@ -157,10 +157,10 @@ enewuser() { |
19 |
> euid="next" |
20 |
> fi |
21 |
> if [[ ${euid} == "next" ]] ; then |
22 |
> - for ((euid = 101; euid <= 999; euid++)); do |
23 |
> + for ((euid = 999; euid >= 101; euid--)); do |
24 |
> [[ -z $(egetent passwd ${euid}) ]] && break |
25 |
> done |
26 |
> - [[ ${euid} -le 999 ]] || die "${FUNCNAME}: no free UID found" |
27 |
> + [[ ${euid} -ge 101 ]] || die "${FUNCNAME}: no free UID found" |
28 |
> fi |
29 |
> opts+=( -u ${euid} ) |
30 |
> einfo " - Userid: ${euid}" |
31 |
> @@ -318,10 +318,10 @@ enewgroup() { |
32 |
> _enewgroup_next_gid() { |
33 |
> if [[ ${egid} == *[!0-9]* ]] ; then |
34 |
> # Non numeric |
35 |
> - for ((egid = 101; egid <= 999; egid++)) ; do |
36 |
> + for ((egid = 999; egid >= 101; egid--)) ; do |
37 |
> [[ -z $(egetent group ${egid}) ]] && break |
38 |
> done |
39 |
> - [[ ${egid} -le 999 ]] || die "${FUNCNAME}: no free GID found" |
40 |
> + [[ ${egid} -ge 101 ]] || die "${FUNCNAME}: no free GID found" |
41 |
> fi |
42 |
> } |
43 |
> |
44 |
|
45 |
LGTM. |
46 |
|
47 |
-- |
48 |
Best regards, |
49 |
Michał Górny |