[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#1040915: bookworm-pu: package dbus/1.14.8-2~deb12u1



On Wed, 12 Jul 2023 at 12:12:47 +0100, Simon McVittie wrote:
> [ Reason ]
> https://bugs.debian.org/1040790
> [ Changes ]
> All changes are part of resolving or testing #1040790.

Debdiff attached.

> [ Tests ]

I should also have mentioned that I'm running the proposed package on
a bookworm desktop system and it works normally.

    smcv
diffstat for dbus-1.14.8 dbus-1.14.8

 changelog            |   16 +++++++++++++
 dbus-daemon.postinst |    4 +--
 tests/control        |    9 +++++++
 tests/machine-id     |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 87 insertions(+), 2 deletions(-)

diff -Nru dbus-1.14.8/debian/changelog dbus-1.14.8/debian/changelog
--- dbus-1.14.8/debian/changelog	2023-06-11 12:42:56.000000000 +0100
+++ dbus-1.14.8/debian/changelog	2023-07-11 20:59:33.000000000 +0100
@@ -1,3 +1,19 @@
+dbus (1.14.8-2~deb12u1) bookworm; urgency=medium
+
+  * Rebuild for bookworm
+
+ -- Simon McVittie <smcv@debian.org>  Tue, 11 Jul 2023 20:59:33 +0100
+
+dbus (1.14.8-2) unstable; urgency=high
+
+  * dbus-daemon.postinst: Stop trying to take DPKG_ROOT into account.
+    This unintentionally disabled the code path that would copy systemd's
+    /etc/machine-id in preference to creating an entirely new machine ID.
+    (Closes: #1040790)
+  * d/tests: Add test coverage for #1040790
+
+ -- Simon McVittie <smcv@debian.org>  Tue, 11 Jul 2023 18:38:22 +0100
+
 dbus (1.14.8-1~deb12u1) bookworm; urgency=medium
 
   * Rebuild for bookworm
diff -Nru dbus-1.14.8/debian/dbus-daemon.postinst dbus-1.14.8/debian/dbus-daemon.postinst
--- dbus-1.14.8/debian/dbus-daemon.postinst	2023-06-11 12:42:56.000000000 +0100
+++ dbus-1.14.8/debian/dbus-daemon.postinst	2023-07-11 20:59:33.000000000 +0100
@@ -7,8 +7,8 @@
     # script does this anyway, but you also have to do this before a session
     # bus will work on non-systemd systems, so we do this here for the
     # benefit of people starting a temporary session bus in a chroot.
-    mkdir -p "${DPKG_ROOT:-/}var/lib/dbus"
-    dbus-uuidgen --ensure="${DPKG_ROOT:-/}var/lib/dbus/machine-id"
+    mkdir -p /var/lib/dbus
+    dbus-uuidgen --ensure
 fi
 
 #DEBHELPER#
diff -Nru dbus-1.14.8/debian/tests/control dbus-1.14.8/debian/tests/control
--- dbus-1.14.8/debian/tests/control	2023-06-11 12:42:56.000000000 +0100
+++ dbus-1.14.8/debian/tests/control	2023-07-11 20:59:33.000000000 +0100
@@ -25,6 +25,15 @@
 Restrictions: allow-stderr, superficial
 Depends: dbus-daemon
 
+Tests: machine-id
+Restrictions: allow-stderr, needs-root, superficial
+Depends: dbus-daemon
+
+Test-Command: debian/tests/machine-id with-systemd
+Features: test-name=machine-id_with_systemd
+Restrictions: allow-stderr, needs-root, superficial
+Depends: dbus-daemon, systemd
+
 Tests: dbus-session-bus-common
 Restrictions: allow-stderr, superficial
 Depends: dbus-session-bus-common
diff -Nru dbus-1.14.8/debian/tests/machine-id dbus-1.14.8/debian/tests/machine-id
--- dbus-1.14.8/debian/tests/machine-id	1970-01-01 01:00:00.000000000 +0100
+++ dbus-1.14.8/debian/tests/machine-id	2023-07-11 20:59:33.000000000 +0100
@@ -0,0 +1,60 @@
+#!/bin/sh
+set -eu
+
+# Regression test for https://bugs.debian.org/1040790
+
+mode="${1-}"
+
+export LC_ALL=C.UTF-8
+fail=
+set -x
+
+# dbus-daemon.deb provides a machine ID
+ls -l /etc/machine-id /var/lib/dbus/machine-id || :
+head /etc/machine-id /var/lib/dbus/machine-id || :
+uuid="$(dbus-uuidgen --get)"
+test -n "$uuid" || fail=yes
+# The machine ID consists of 32 lower-case hex digits (and the file
+# also has a newline)
+test "$uuid" = "$(perl -pe 'print "wrong: " unless /\A[a-z0-9]{32}\n\z/' /var/lib/dbus/machine-id)" || fail=yes
+
+# Intentionally not asserting that /etc/machine-id matches
+# /var/lib/dbus/machine-id: if the test container has both dbus and
+# systemd, and it was generated with a version of dbus that has #1040790,
+# then that assertion could fail.
+
+# If there is a systemd machine ID, installing dbus-daemon should
+# make the D-Bus machine ID be the same as it.
+# Unfortunately nothing currently guarantees that a Debian
+# system will have a machine ID, so this has to be conditional. (See
+# also #745876, #783716).
+if [ -e /etc/machine-id ] || [ "$mode" = with-systemd ]; then
+    rm -f /var/lib/dbus/machine-id
+    # This is for its side-effect of running the postinst, emulating
+    # a fresh installation
+    dpkg-reconfigure -fnoninteractive -pcritical dbus-daemon
+    ls -l /etc/machine-id /var/lib/dbus/machine-id || :
+    head /etc/machine-id /var/lib/dbus/machine-id || :
+    uuid="$(dbus-uuidgen --get)"
+    test -n "$uuid" || fail=yes
+    test "$uuid" = "$(perl -pe 'print "wrong: " unless /\A[a-z0-9]{32}\n\z/' /var/lib/dbus/machine-id)" || fail=yes
+    test "$uuid" = "$(perl -pe 'print "wrong: " unless /\A[a-z0-9]{32}\n\z/' /etc/machine-id)" || fail=yes
+fi
+
+# Similarly, if there is a D-Bus machine ID but no systemd machine ID
+# (for example if dbus-daemon happened to be installed before systemd),
+# then we expect systemd-machine-id-setup to copy ours.
+if [ "$mode" = with-systemd ]; then
+    rm -f /etc/machine-id
+    systemd-machine-id-setup
+    ls -l /etc/machine-id /var/lib/dbus/machine-id || :
+    head /etc/machine-id /var/lib/dbus/machine-id || :
+    uuid="$(dbus-uuidgen --get)"
+    test -n "$uuid" || fail=yes
+    test "$uuid" = "$(perl -pe 'print "wrong: " unless /\A[a-z0-9]{32}\n\z/' /var/lib/dbus/machine-id)" || fail=yes
+    test "$uuid" = "$(perl -pe 'print "wrong: " unless /\A[a-z0-9]{32}\n\z/' /etc/machine-id)" || fail=yes
+fi
+
+test -z "$fail"
+
+# vim:set sw=4 sts=4 et:

Reply to: