Skip to content

Commit

Permalink
scripts/bootstrap-prefix: match user/group more precise
Browse files Browse the repository at this point in the history
Avoid over-matching on entries from /etc/{passwd,group}.

Bug: https://bugs.gentoo.org/766417
Signed-off-by: Fabian Groffen <[email protected]>
  • Loading branch information
jkrzyszt authored and grobian committed Nov 4, 2023
1 parent 39ebcce commit 971f326
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/bootstrap-prefix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 971f326

Please sign in to comment.