1 |
commit: e51c5cfae41952f32a75c9e680785f4c1242f9b7 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jul 30 14:45:38 2019 +0000 |
4 |
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Aug 13 03:00:28 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e51c5cfa |
7 |
|
8 |
user.eclass: Use egetent in eget{user,group}name |
9 |
|
10 |
Use egetent+cut to obtain user/group names rather than id(1). |
11 |
The latter has no real advantage (besides being shorter to type), |
12 |
and does not work correctly for getting groups. |
13 |
|
14 |
Closes: https://bugs.gentoo.org/691056 |
15 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
16 |
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> |
17 |
|
18 |
eclass/user.eclass | 4 ++-- |
19 |
1 file changed, 2 insertions(+), 2 deletions(-) |
20 |
|
21 |
diff --git a/eclass/user.eclass b/eclass/user.eclass |
22 |
index a3cacb6d5f1..f433d32bf7e 100644 |
23 |
--- a/eclass/user.eclass |
24 |
+++ b/eclass/user.eclass |
25 |
@@ -358,7 +358,7 @@ enewgroup() { |
26 |
egetusername() { |
27 |
[[ $# -eq 1 ]] || die "usage: egetusername <uid>" |
28 |
|
29 |
- id -u -n "$1" |
30 |
+ egetent passwd "$1" | cut -d: -f1 |
31 |
} |
32 |
|
33 |
# @FUNCTION: egetgroupname |
34 |
@@ -368,7 +368,7 @@ egetusername() { |
35 |
egetgroupname() { |
36 |
[[ $# -eq 1 ]] || die "usage: egetgroupname <gid>" |
37 |
|
38 |
- id -g -n "$1" |
39 |
+ egetent group "$1" | cut -d: -f1 |
40 |
} |
41 |
|
42 |
# @FUNCTION: egethome |