public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] user-info.eclass: egetent: fix lookup by id when ROOT != /
@ 2023-07-09  1:11 Mike Gilbert
  2023-07-09  7:32 ` Ulrich Mueller
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Gilbert @ 2023-07-09  1:11 UTC (permalink / raw
  To: gentoo-dev

Previous to this change, egetent would match any id that starts with the
id given as input. For example:

egetent group 1

bin::1:root,bin,daemon
wheel::10:root
floppy::11:root
news::13:news
uucp::14:uucp
console::17:
audio::18:
cdrom::19:
users::100:

Adding a colon to the grep expression yeilds the desired result:

egetent group 1

bin::1:root,bin,daemon

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
 eclass/user-info.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/user-info.eclass b/eclass/user-info.eclass
index b18f280c1022..1cc7b8250309 100644
--- a/eclass/user-info.eclass
+++ b/eclass/user-info.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: user-info.eclass
@@ -64,7 +64,7 @@ egetent() {
 			getent "${db}" "${key}"
 		else
 			if [[ ${key} =~ ^[[:digit:]]+$ ]]; then
-				grep -E "^([^:]*:){2}${key}" "${ROOT}/etc/${db}"
+				grep -E "^([^:]*:){2}${key}:" "${ROOT}/etc/${db}"
 			else
 				grep "^${key}:" "${ROOT}/etc/${db}"
 			fi
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] [PATCH] user-info.eclass: egetent: fix lookup by id when ROOT != /
  2023-07-09  1:11 [gentoo-dev] [PATCH] user-info.eclass: egetent: fix lookup by id when ROOT != / Mike Gilbert
@ 2023-07-09  7:32 ` Ulrich Mueller
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Mueller @ 2023-07-09  7:32 UTC (permalink / raw
  To: Mike Gilbert; +Cc: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 114 bytes --]

LGTM except for a typo in the commit message:

> Adding a colon to the grep expression yeilds the desired result:

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-09  7:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-09  1:11 [gentoo-dev] [PATCH] user-info.eclass: egetent: fix lookup by id when ROOT != / Mike Gilbert
2023-07-09  7:32 ` Ulrich Mueller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox