This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=2c19f7c630d965be1ca82c5995200df70a8ff289 commit 2c19f7c630d965be1ca82c5995200df70a8ff289 (HEAD -> master) Author: Guillem Jover <guil...@debian.org> AuthorDate: Wed Oct 10 00:09:29 2018 +0200 debian: Create the log file in postinst only if it does not exist There's no point in creating and messing with the owner and permissions for this file on each upgrade. This also makes it possible to workaround a problem when installing dpkg with --force-not-root, as pre-creating the log file will diasrm the failing chown and chmod calls. Prompted-by: Johannes Schauer <jo...@debian.org> --- debian/changelog | 3 +++ debian/dpkg.postinst | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index ec6605f90..e92749012 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,9 @@ dpkg (1.19.3) UNRELEASED; urgency=medium - run-script: Add «set -e». - Build.PL: Set environment variables only for CPAN tests. - Build.PL: Set locale for CPAN tests to C. Foxes CPAN#127314. + * Packaging: + - Create the log file in postinst only if it does not exist. + Prompted by Johannes Schauer <jo...@debian.org>. * Test suite: - Add new shellcheck author test. diff --git a/debian/dpkg.postinst b/debian/dpkg.postinst index 5447d99a4..7b2582dda 100755 --- a/debian/dpkg.postinst +++ b/debian/dpkg.postinst @@ -18,9 +18,12 @@ create_database() { # Create log file and set default permissions if possible create_logfile() { logfile=$DPKG_ROOT/var/log/dpkg.log - touch "$logfile" - chmod 644 "$logfile" - chown root:root "$logfile" 2>/dev/null || chown 0:0 "$logfile" + + if [ ! -f "$logfile" ]; then + touch "$logfile" + chmod 644 "$logfile" + chown root:root "$logfile" 2>/dev/null || chown 0:0 "$logfile" + fi } -- Dpkg.Org's dpkg