eclass/user-info: Sync with Gentoo

It's from Gentoo commit e1d6ed10e8d940901f9ccef283f21b7383141bda.
This commit is contained in:
Flatcar Buildbot 2023-07-17 07:12:26 +00:00 committed by Sayan Chowdhury
parent fba10f7d6d
commit 80f3e36887
No known key found for this signature in database
GPG Key ID: B02399319CD05C8B

View File

@ -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