commit:     8ba1318bc1779637a83319f05992a11e83b84069
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 27 03:13:52 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec 27 03:51:25 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ba1318b

sys-apps/shadow: check for invalid passwd entries

- In pkg_postinst, check for invalid ${EROOT}/etc/passwd entries
  by running 'pwck' in read-only mode.

  In the referenced bug, this manifested as the man cronjob failing.

- Also fix another check for empty ${EROOT} (broken since EAPI 7 port).

Closes: https://bugs.gentoo.org/829872
Signed-off-by: Sam James <sam <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/23534
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../shadow/{shadow-4.10-r3.ebuild => shadow-4.10-r4.ebuild}  | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/sys-apps/shadow/shadow-4.10-r3.ebuild 
b/sys-apps/shadow/shadow-4.10-r4.ebuild
similarity index 94%
rename from sys-apps/shadow/shadow-4.10-r3.ebuild
rename to sys-apps/shadow/shadow-4.10-r4.ebuild
index 020224692897..3cb7d9ff4aa7 100644
--- a/sys-apps/shadow/shadow-4.10-r3.ebuild
+++ b/sys-apps/shadow/shadow-4.10-r4.ebuild
@@ -234,12 +234,18 @@ pkg_preinst() {
 }
 
 pkg_postinst() {
+       # Missing entries from /etc/passwd can cause odd system blips.
+       # See bug #829872.
+       if ! pwck -r -q -R "${EROOT:-/}" &>/dev/null ; then
+               ewarn "Running 'pwck' returned errors. Please run it manually 
to fix any errors."
+       fi
+
        # Enable shadow groups.
        if [ ! -f "${EROOT}"/etc/gshadow ] ; then
-               if grpck -r -R "${EROOT}" 2>/dev/null ; then
-                       grpconv -R "${EROOT}"
+               if grpck -r -R "${EROOT:-/}" 2>/dev/null ; then
+                       grpconv -R "${EROOT:-/}"
                else
-                       ewarn "Running 'grpck' returned errors.  Please run it 
by hand, and then"
+                       ewarn "Running 'grpck' returned errors. Please run it 
by hand, and then"
                        ewarn "run 'grpconv' afterwards!"
                fi
        fi

Reply via email to