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 <mgo...@gentoo.org>
---
 eclass/user.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/user.eclass b/eclass/user.eclass
index a3cacb6d5f10..f433d32bf7ed 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
-- 
2.22.0


Reply via email to