From: Mike Gilbert <floppym@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH] user-info.eclass: egetent: fix lookup by id when ROOT != /
Date: Sat, 8 Jul 2023 21:11:41 -0400 [thread overview]
Message-ID: <20230709011141.61136-1-floppym@gentoo.org> (raw)
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
next reply other threads:[~2023-07-09 1:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-09 1:11 Mike Gilbert [this message]
2023-07-09 7:32 ` [gentoo-dev] [PATCH] user-info.eclass: egetent: fix lookup by id when ROOT != / Ulrich Mueller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230709011141.61136-1-floppym@gentoo.org \
--to=floppym@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox