From 971f326949216a7edf673bf1b26c644ef20b072d Mon Sep 17 00:00:00 2001 From: Janusz Krzysztofik Date: Sat, 4 Nov 2023 08:34:11 +0100 Subject: [PATCH] scripts/bootstrap-prefix: match user/group more precise Avoid over-matching on entries from /etc/{passwd,group}. Bug: https://bugs.gentoo.org/766417 Signed-off-by: Fabian Groffen --- scripts/bootstrap-prefix.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index b08a497f41..041acf1b1f 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -305,7 +305,7 @@ bootstrap_setup() { if is-rap ; then if [[ ! -f ${ROOT}/etc/passwd ]]; then - if grep -q $(id -un) /etc/passwd; then + if grep -q "^$(id -un):" /etc/passwd; then ln -sf {,"${ROOT}"}/etc/passwd else getent passwd > "${ROOT}"/etc/passwd @@ -314,7 +314,7 @@ bootstrap_setup() { fi fi if [[ ! -f ${ROOT}/etc/group ]]; then - if grep -q $(id -gn) /etc/group; then + if grep -q "^$(id -gn):" /etc/group; then ln -sf {,"${ROOT}"}/etc/group else getent group > "${ROOT}"/etc/group