mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-08-24 18:58:08 -07:00
user-info.eclass: egetent: fix lookup by id when ROOT != /
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:💯 Adding a colon to the grep expression yields the desired result: egetent group 1 bin::1:root,bin,daemon Signed-off-by: Mike Gilbert <floppym@gentoo.org>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user