#1010291 postgresql-common: Does /var/log/postgresql really need chmod +t?

#1010291#5
Date:
2022-04-27 23:23:40 UTC
From:
To:
Hello,

/var/log/postgresql has the sticky bit set, starting I think with
bullseye:

  # ls -lad /var/log/postgresql/
  drwxrwxr-t 2 root postgres 4096 Apr 27 23:11 /var/log/postgresql/

This causes some pain with file-based backups.  In particular, `rsync -a
--inplace` is affected.  Since the dir is sticky, rsync makes the backup
dir sticky.  But since the files are not owned by root on the backup
target, even root will be prevented from overwriting them.  A more
careful explanation can be found at [1].

Is the sticky bit really necessary here?  I've worked around this with
dpkg-statoverride, but I don't understand why this dir is +t anyhow.

Thanks,
Ross

[1] https://superuser.com/questions/1708317/rsync-permissions-errors-at-destination-even-though-root-possibly-due-to-sticky

#1010291#10
Date:
2023-06-26 05:03:01 UTC
From:
To:
After upgrading to bookworm, I was reminded of this bug when
/var/log/postgresql's sticky bit re-appeared.  So I dug a bit more.

postgresql-common's postinst unconditionally changes owners and modes on
/var/log/postgresql.  The patch below makes it respect dpkg-statoverride.

Thanks,
Ross

diff --git a/debian/postgresql-common.postinst b/debian/postgresql-common.postinst
old mode 100644
new mode 100755
index 545146a..638c8b8
--- a/debian/postgresql-common.postinst
+++ b/debian/postgresql-common.postinst
@@ -65,8 +65,10 @@ Please fix this and reinstall this package." >&2

     # nicer log directory permissions
     mkdir -p /var/log/postgresql
-    chmod 1775 /var/log/postgresql
-    chown root:postgres /var/log/postgresql
+    if ! dpkg-statoverride --list /var/log/postgresl > /dev/null; then
+        chmod "$LOG_MODE" /var/log/postgresql
+        chown root:postgres /var/log/postgresql
+    fi

     # create socket directory
     [ -d /var/run/postgresql ] || \

#1010291#15
Date:
2026-09-04 13:34:27 UTC
From:
To:
Hello,

Bug #1010291 in postgresql-common reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/postgresql/postgresql-common/-/commit/8cedc919532bf50b43a507d5c2186f4ac4f5766d

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1010291

#1010291#22
Date:
2026-11-12 12:12:43 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
postgresql-common, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1010291@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Christoph Berg <myon@debian.org> (supplier of updated postgresql-common package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Tue, 10 Nov 2026 11:10:39 +0100
Source: postgresql-common
Architecture: source
Version: 294
Distribution: unstable
Urgency: medium
Maintainer: Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org>
Changed-By: Christoph Berg <myon@debian.org>
Closes: 1010291
Changes:
 postgresql-common (294) unstable; urgency=medium
 .
   [ Christoph Berg ]
   * server/postgresql.mk: Add noperl and notcl build profiles.
   * Drop sticky bit on /var/log/postgresql/ and set owner to postgres.
     (Closes: #1010291)
   * Add explicit dependencies on tmpfiles and sysusers. At least tmpfiles
     isn't always autogenerated by debhelper in backports.
   * pg_buildext, /etc/postgresql-common/minor_versions: Set minimum server
     versions to depend on when extensions are built. Start with the current
     minor versions just being released.
   * Move pg_buildext.1 to postgresql-common-dev.
   * pg_config: Work around broken `ls -v` on Ubuntu's rust coreutils.
   * pg_upgradecluster: Remove array_nulls in PG 20.
   * pg_virtualenv: Always disable fakeroot, some tests were still failing
     because of it.
   * t/085_pg_ctl.conf.t: Skip tests if we can't raise limits.
   * Disable plperl plpython pltcl tests on 8.x/9.x.
 .
   [ Luca Boccassi ]
   * pg_createcluster: use 1000 as system uid threshold.
   * Install and use sysusers.d/tmpfiles.d config files.
Checksums-Sha1:
 19278cbb8282574589232a5661c5a8ed12114319 2383 postgresql-common_294.dsc
 00018c490d89015eaa762849e220294da680beb2 220124 postgresql-common_294.tar.xz
Checksums-Sha256:
 b42942e0ad5266d4154de9ed80ff0c944e9297e4a8beca959acbd2f8ec7f7446 2383 postgresql-common_294.dsc
 8f4ea53a7d340048b93497b08090281fcc09de54e558dabae86c89e1903084b6 220124 postgresql-common_294.tar.xz
Files:
 1df676eb4a092829596580a5561769a7 2383 database optional postgresql-common_294.dsc
 f5c6d3c7a19d59924778a153a2402bac 220124 database optional postgresql-common_294.tar.xz
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEXEj+YVf0kXlZcIfGTFprqxLSp64FAmr1qe0ACgkQTFprqxLS
p66u3w/8CtK40bTgN+ONPyr7VwK6d0aQbvoouPqyOPP8wxLlJJMU50jc1VqOHwKa
IKCvsiuc25EhpIrAwXdH26DzRIyAO1dUn5kustLtWLusyo2yKHoKjZeJlJZASyd3
Q+aQpkJ2Lf9tUG4SpQq5N99PANnKE+1kOJThR2VKZfhwwVIaoL6I4I6IPUPSlTAG
teadBa5HVmiMnX0SNyKQt4ueIdILd7LKsXkGfqCgQR04eRkLDW6ARAW7Xw7YowKR
T9/AW2Dw2QkL2bbZoyckKJ88+HNe+TJNX6dhvkteG0JCTPTQRHE0IVRfMr21gZgA
oFqwwUhtnCP1vO/qChR4BP2fdloA1voaga026R3gFDYhCu4KkB2jYwjd6TXWN8re
+iqiuH8KzCmj/mrZaErTWSFAa87NWygABoQ/NULMFiLdp8DABGM4AkPJQ2IdkeVN
ljIe/7w+8d9HJaYqRys4NPIAwskRvgl66tg9vOYhiLx5ljoApL/Gy3BpK+Jn4Cfe
ENVE5l2Sk+MNYSQpzTbDxXhOnCruikFxMjxXvVOcAsv0lhVXHOBDGGUqv20y8kQV
n5uHp1S+g3AolNb9M76S8S0oWm4I+/ltF3DcF1Ssa3PoeX7IW4z41GlevaRcWCF5
gEfOv30Qz3dnoh2HBKEEbtoVpQACAa3PxwtjeIrj6zDPZigMfn0=
=WGbU
-----END PGP SIGNATURE-----