Gentoo Archives: gentoo-dev

From: Michael Orlitzky <mjo@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH v2 6/9] acct-{group,user}.eclass: WIP eclasses to maintain users/groups
Date: Wed, 05 Jun 2019 21:14:24
Message-Id: 7abcd69f-cee8-0acd-db7a-c88268902e17@gentoo.org
In Reply to: [gentoo-dev] [PATCH v2 6/9] acct-{group,user}.eclass: WIP eclasses to maintain users/groups by "Michał Górny"
1 On 6/5/19 5:12 AM, Michał Górny wrote:
2 > +
3 > + # check for ACCT_USER_ID collisions early
4 > + if [[ -n ${ACCT_USER_ENFORCE_ID} ]]; then
5 > + local pwd=$(egetent passwd "${ACCT_USER_ID}")
6 > + if [[ -n ${pwd} ]]; then
7 > + eerror "The required UID is already taken by another user."
8 > + eerror " UID: ${ACCT_USER_ID} (needed for ${PN})"
9 > + eerror " current user: ${pwd}"
10 > + die "UID ${ACCT_USER_ID} taken already"
11 > + fi
12 > + fi
13 > +}
14
15 If we set ACCT_USER_ENFORCE_ID=true in ftp-0.ebuild and then "emerge
16 acct-user/ftp" again, the second one dies with
17
18 * The required UID is already taken by another user.
19 * UID: 21 (needed for ftp)
20
21 This prevents "emerge -e @world" from working, and would prevent an
22 upgrade to ftp-1.ebuild in the future.
23
24 We could augment the checks to ignore the existing user/group if its
25 name agrees with the one we're trying to create, but now I'm having deja
26 vu. I think this is another reason why I decided to go with a dummy file
27 installed under /var/lib to catch collisions: the PM will necessarily
28 ignore collisions from the same package.

Replies