Date: Sun, 27 Dec 2020 20:53:09 GMT From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: cd7da1deb581 - stable/11 - MFC freebsd-update: unconditionally regenerate passwd/login.conf files Message-ID: <202012272053.0BRKr9I8065656@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/11 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=cd7da1deb581122c94c3735b78fafdd04ce77b67 commit cd7da1deb581122c94c3735b78fafdd04ce77b67 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2020-12-17 03:42:54 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2020-12-27 20:52:37 +0000 MFC freebsd-update: unconditionally regenerate passwd/login.conf files The existing logic is nice in theory, but in practice freebsd-update will not preserve the timestamps on these files. When doing a major upgrade, e.g. from 12.1-RELEASE -> 12.2-RELEASE, pwd.mkdb et al. appear in the INDEX and we clobber the timestamp several times in the process of packaging up the existing system into /var/db/freebsd-update/files and extracting for comparisons. This leads to these files not getting regenerated when they're most likely to be needed. Measures could be taken to preserve timestamps, but it's unclear whether the complexity and overhead of doing so is really outweighed by the marginal benefit. I observed this issue when pkg subsequently failed to install a package that wanted to add a user, claiming that the user was removed in the process. bapt@ pointed to this pre-existing bug with freebsd-update as the cause. PR: 234014, 232921 (cherry picked from commit ebebc41e4cfe44b8e8fd881badf2fa2c4be65aa4) --- usr.sbin/freebsd-update/freebsd-update.sh | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 9f8f00082491..97df3e274925 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -2949,17 +2949,9 @@ Kernel updates have been installed. Please reboot and run env DESTDIR=${BASEDIR} certctl rehash fi - # Rebuild generated pwd files. - if [ ${BASEDIR}/etc/master.passwd -nt ${BASEDIR}/etc/spwd.db ] || - [ ${BASEDIR}/etc/master.passwd -nt ${BASEDIR}/etc/pwd.db ] || - [ ${BASEDIR}/etc/master.passwd -nt ${BASEDIR}/etc/passwd ]; then - pwd_mkdb -d ${BASEDIR}/etc -p ${BASEDIR}/etc/master.passwd - fi - - # Rebuild /etc/login.conf.db if necessary. - if [ ${BASEDIR}/etc/login.conf -nt ${BASEDIR}/etc/login.conf.db ]; then - cap_mkdb ${BASEDIR}/etc/login.conf - fi + # Rebuild generated pwd files and /etc/login.conf.db. + pwd_mkdb -d ${BASEDIR}/etc -p ${BASEDIR}/etc/master.passwd + cap_mkdb ${BASEDIR}/etc/login.conf # Rebuild man page databases, if necessary. for D in /usr/share/man /usr/share/openssl/man; do
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012272053.0BRKr9I8065656>