Package: libvpd-2.2-3
Version: 2.2.9-1
Severity: serious
Justification: file loss during upgrade
Tags: patch
User: helm...@debian.org
Usertags: dep17p7 dep17m10

Hi,

libvpd-2.2-3 contains a udev .rules file and installs it using
debhelper. In the bookworm build (+b1), it was installed to
/lib/udev/rules.d whereas in a later rebuild for trixie (+b2) it was
installed to /usr/lib/udev/rules.d due to the /usr-move (DEP17). As it
also is marked M-A:same, this file may be lost in upgrade scenarios from
bookworm (+b1) to trixie (+b2). For more information refer to
https://subdivi.de/~helmut/dep17.html sections P7 and M10 in particular.
I propose mitigating this problem by adding protective diversions for
the duration of the upgrade. Those diversions are no longer present once
the upgrade is completed. As a result, the changes can be fully reverted
once trixie is released. I am attaching a patch for your convenience. It
has marked all removable sections in such a way that the Debian janitor
(operated by Jelmer) can automatically file a merge request to perform
this deletion. I tested this patch by performing a cross build for
ppc64el and upgraded the package in a qemu-user environment. I
appreciate if you could do more testing on real hardware ahead of
upload. Let me know if you have any questions.

Helmut
diff --minimal -Nru libvpd-2.2.9/debian/changelog libvpd-2.2.9/debian/changelog
--- libvpd-2.2.9/debian/changelog       2022-04-22 13:05:19.000000000 +0200
+++ libvpd-2.2.9/debian/changelog       2024-12-30 19:52:52.000000000 +0100
@@ -1,3 +1,11 @@
+libvpd (2.2.9-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Mitigate M-A:same shared file loss due to /usr-move (DEP17 P7 M10, Closes:
+    #-1).
+
+ -- Helmut Grohne <hel...@subdivi.de>  Mon, 30 Dec 2024 19:52:52 +0100
+
 libvpd (2.2.9-1) unstable; urgency=medium
 
   * Update to new upstream version 2.2.9.
diff --minimal -Nru libvpd-2.2.9/debian/libvpd-2.2-3.lintian-overrides 
libvpd-2.2.9/debian/libvpd-2.2-3.lintian-overrides
--- libvpd-2.2.9/debian/libvpd-2.2-3.lintian-overrides  1970-01-01 
01:00:00.000000000 +0100
+++ libvpd-2.2.9/debian/libvpd-2.2-3.lintian-overrides  2024-12-30 
19:52:52.000000000 +0100
@@ -0,0 +1,5 @@
+# begin-remove-after: released:trixie
+# DEP17 P7 M10
+diversion-for-unknown-file lib/udev/rules.d/60-libvpd-2.2-3.rules [preinst:*]
+systemd-diversion lib/udev/rules.d/60-libvpd-2.2-3.rules [preinst:*]
+# end-remove-after
diff --minimal -Nru libvpd-2.2.9/debian/libvpd-2.2-3.postinst 
libvpd-2.2.9/debian/libvpd-2.2-3.postinst
--- libvpd-2.2.9/debian/libvpd-2.2-3.postinst   1970-01-01 01:00:00.000000000 
+0100
+++ libvpd-2.2.9/debian/libvpd-2.2-3.postinst   2024-12-30 19:52:52.000000000 
+0100
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+# begin-remove-after: released:trixie
+# DEP17 P7 M10
+if [ "$1" = "configure" ]; then
+       dpkg-divert --package usr-is-merged --no-rename \
+               --divert /lib/udev/rules.d/60-libvpd-2.2-3.rules.usr-is-merged \
+               --remove /lib/udev/rules.d/60-libvpd-2.2-3.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
+exit 0
diff --minimal -Nru libvpd-2.2.9/debian/libvpd-2.2-3.postrm 
libvpd-2.2.9/debian/libvpd-2.2-3.postrm
--- libvpd-2.2.9/debian/libvpd-2.2-3.postrm     1970-01-01 01:00:00.000000000 
+0100
+++ libvpd-2.2.9/debian/libvpd-2.2-3.postrm     2024-12-30 19:52:52.000000000 
+0100
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+
+# begin-remove-after: released:trixie
+# DEP17 P7 M10
+remove_diversion() {
+       dpkg-divert --package usr-is-merged --no-rename \
+               --divert /lib/udev/rules.d/60-libvpd-2.2-3.rules.usr-is-merged \
+               --remove /lib/udev/rules.d/60-libvpd-2.2-3.rules
+}
+case "$1" in
+       abort-upgrade|failed-upgrade)
+               remove_diversion
+       ;;
+       remove)
+               if [ "$DPKG_MAINTSCRIPT_PACKAGE_REFCOUNT" = "1" ]; then
+                       remove_diversion
+               fi
+       ;;
+esac
+# end-remove-after
+
+#DEBHELPER#
+
+exit 0
diff --minimal -Nru libvpd-2.2.9/debian/libvpd-2.2-3.preinst 
libvpd-2.2.9/debian/libvpd-2.2-3.preinst
--- libvpd-2.2.9/debian/libvpd-2.2-3.preinst    1970-01-01 01:00:00.000000000 
+0100
+++ libvpd-2.2.9/debian/libvpd-2.2-3.preinst    2024-12-30 19:52:52.000000000 
+0100
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+# begin-remove-after: released:trixie
+# DEP17 P7 M10
+if [ "$1" = "upgrade" ]; then
+       dpkg-divert --package usr-is-merged --no-rename \
+               --divert /lib/udev/rules.d/60-libvpd-2.2-3.rules.usr-is-merged \
+               --add /lib/udev/rules.d/60-libvpd-2.2-3.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
+exit 0
diff --minimal -Nru libvpd-2.2.9/debian/libvpd-2.2-3.prerm 
libvpd-2.2.9/debian/libvpd-2.2-3.prerm
--- libvpd-2.2.9/debian/libvpd-2.2-3.prerm      1970-01-01 01:00:00.000000000 
+0100
+++ libvpd-2.2.9/debian/libvpd-2.2-3.prerm      2024-12-30 19:52:52.000000000 
+0100
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+# begin-remove-after: released:trixie
+# DEP17 P7 M10
+if [ "$1" = "failed-upgrade" ]; then
+       dpkg-divert --package usr-is-merged --no-rename \
+               --divert /lib/udev/rules.d/60-libvpd-2.2-3.rules.usr-is-merged \
+               --remove /lib/udev/rules.d/60-libvpd-2.2-3.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
+exit 0
diff --minimal -Nru libvpd-2.2.9/debian/rules libvpd-2.2.9/debian/rules
--- libvpd-2.2.9/debian/rules   2022-04-22 13:05:19.000000000 +0200
+++ libvpd-2.2.9/debian/rules   2024-12-30 19:52:52.000000000 +0100
@@ -5,3 +5,10 @@
 
 %:
        dh $@
+
+# begin-remove-after: released:trixie
+execute_after_dh_installudev:
+       if [ -e debian/libvpd-2.2-3/lib/udev/rules.d/60-libvpd-2.2-3.rules ] || 
! [ -e debian/libvpd-2.2-3/usr/lib/udev/rules.d/60-libvpd-2.2-3.rules ]; then \
+               echo "DEP17 mitigations must be removed in backport"; exit 1; \
+       fi
+# end-remove-after

Reply via email to