commit:     e51c5cfae41952f32a75c9e680785f4c1242f9b7
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 30 14:45:38 2019 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Tue Aug 13 03:00:28 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e51c5cfa

user.eclass: Use egetent in eget{user,group}name

Use egetent+cut to obtain user/group names rather than id(1).
The latter has no real advantage (besides being shorter to type),
and does not work correctly for getting groups.

Closes: https://bugs.gentoo.org/691056
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 eclass/user.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/user.eclass b/eclass/user.eclass
index a3cacb6d5f1..f433d32bf7e 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -358,7 +358,7 @@ enewgroup() {
 egetusername() {
        [[ $# -eq 1 ]] || die "usage: egetusername <uid>"
 
-       id -u -n "$1"
+       egetent passwd "$1" | cut -d: -f1
 }
 
 # @FUNCTION: egetgroupname
@@ -368,7 +368,7 @@ egetusername() {
 egetgroupname() {
        [[ $# -eq 1 ]] || die "usage: egetgroupname <gid>"
 
-       id -g -n "$1"
+       egetent group "$1" | cut -d: -f1
 }
 
 # @FUNCTION: egethome

Reply via email to