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

Bug#1056922: libairspyhf1: Move files into /usr (incl. DEP17 P7 mitigation)



Package: libairspyhf1
Version: 1.6.8-3
Severity: important
Tags: patch
User: helmutg@debian.org
Usertags: dep17p7
X-Debbugs-Cc: helmutg@debian.org

Dear Maintainer,

libairspyhf1 contains udev files which are installed to /lib; these
files need to be moved to /usr/lib as part of Debian's usr-merge effort.
Because your package is Multi-Arch: same, an unfortunate corner-case can
occur whereby shared files (such as the udev rules) may be erroneously
removed on upgrades (please see DEP17[1] P7: Shared multiarch file
loss).

You will find a patch attached to move the udev files, including the
mitigation for the file loss scenario.

Please consider applying this patch at your earliest convenience. This
bug will be upgraded to release critical soon, as it blocks the overall
usr-merge effort which is being undertaken for the trixie release.


Many thanks,
Chris


[1] https://wiki.debian.org/UsrMerge
diff -Nru airspyhf-1.6.8/debian/changelog airspyhf-1.6.8/debian/changelog
--- airspyhf-1.6.8/debian/changelog	2020-12-18 02:01:46.000000000 +0100
+++ airspyhf-1.6.8/debian/changelog	2023-11-26 20:07:43.000000000 +0100
@@ -1,3 +1,11 @@
+airspyhf (1.6.8-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Move udev files from /lib to /usr/lib, including protective diversion
+    against Multi-Arch: same file loss scenario (DEP17 P7 M10). (Closes: #-1)
+
+ -- Chris Hofstaedtler <zeha@debian.org>  Sun, 26 Nov 2023 20:07:43 +0100
+
 airspyhf (1.6.8-3) unstable; urgency=medium
 
   [ Debian Janitor ]
diff -Nru airspyhf-1.6.8/debian/libairspyhf1.lintian-overrides airspyhf-1.6.8/debian/libairspyhf1.lintian-overrides
--- airspyhf-1.6.8/debian/libairspyhf1.lintian-overrides	1970-01-01 01:00:00.000000000 +0100
+++ airspyhf-1.6.8/debian/libairspyhf1.lintian-overrides	2023-11-26 20:07:31.000000000 +0100
@@ -0,0 +1,4 @@
+# begin-remove-after: released:forky
+# protective diversion for upgrades of files moved from / to /usr
+libairspyhf1: diversion-for-unknown-file lib/udev/rules.d/60-libairspyhf1.rules [preinst:*]
+# end-remove-after
diff -Nru airspyhf-1.6.8/debian/libairspyhf1.postinst airspyhf-1.6.8/debian/libairspyhf1.postinst
--- airspyhf-1.6.8/debian/libairspyhf1.postinst	1970-01-01 01:00:00.000000000 +0100
+++ airspyhf-1.6.8/debian/libairspyhf1.postinst	2023-11-26 20:07:31.000000000 +0100
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+set -e
+
+# begin-remove-after: released:forky
+# protective diversion of files moved from / to /usr, to avoid file loss.
+# Only for upgrades.
+if [ "$1" = "configure" ]; then
+    # At this point, the package will have installed the same file in */usr*.
+    dpkg-divert --package usr-is-merged --no-rename \
+        --divert /lib/udev/rules.d/60-libairspyhf1.rules.usr-is-merged \
+        --remove /lib/udev/rules.d/60-libairspyhf1.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
diff -Nru airspyhf-1.6.8/debian/libairspyhf1.postrm airspyhf-1.6.8/debian/libairspyhf1.postrm
--- airspyhf-1.6.8/debian/libairspyhf1.postrm	1970-01-01 01:00:00.000000000 +0100
+++ airspyhf-1.6.8/debian/libairspyhf1.postrm	2023-11-26 20:07:31.000000000 +0100
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -e
+
+# begin-remove-after: released:forky
+# protective diversion of files moved from / to /usr, to avoid file loss.
+# Only for upgrades.
+if [ "$1" = "remove" ] && [ "$DPKG_MAINTSCRIPT_PACKAGE_REFCOUNT" = "1" ]; then
+    # Cleanup in case package is removed before upgrade is finished (postinst ran).
+    dpkg-divert --package usr-is-merged --no-rename \
+        --divert /lib/udev/rules.d/60-libairspyhf1.rules.usr-is-merged \
+        --remove /lib/udev/rules.d/60-libairspyhf1.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
diff -Nru airspyhf-1.6.8/debian/libairspyhf1.preinst airspyhf-1.6.8/debian/libairspyhf1.preinst
--- airspyhf-1.6.8/debian/libairspyhf1.preinst	1970-01-01 01:00:00.000000000 +0100
+++ airspyhf-1.6.8/debian/libairspyhf1.preinst	2023-11-26 20:07:31.000000000 +0100
@@ -0,0 +1,15 @@
+#!/bin/sh
+set -e
+
+# begin-remove-after: released:forky
+# protective diversion of files moved from / to /usr, to avoid file loss.
+# Only for upgrades.
+if [ "$1" = "upgrade" ]; then
+    dpkg-divert --package usr-is-merged --no-rename \
+        --divert /lib/udev/rules.d/60-libairspyhf1.rules.usr-is-merged \
+        --add /lib/udev/rules.d/60-libairspyhf1.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
diff -Nru airspyhf-1.6.8/debian/rules airspyhf-1.6.8/debian/rules
--- airspyhf-1.6.8/debian/rules	2020-08-11 04:59:21.000000000 +0200
+++ airspyhf-1.6.8/debian/rules	2023-11-26 20:07:43.000000000 +0100
@@ -11,3 +11,9 @@
 
 override_dh_auto_configure:
 	dh_auto_configure $@ -- -DLIB_SUFFIX=/$(DEB_HOST_MULTIARCH)
+
+override_dh_installudev:
+	dh_installudev
+	# This should be harmless when dh_installudev automatically installs to /usr/lib/udev/rules.d.
+	set -e; if test -d debian/libairspyhf1/lib/udev/rules.d; then mv debian/libairspyhf1/lib/udev debian/libairspyhf1/usr/lib; fi
+	set -e; if test -d debian/libairspyhf1/lib; then rmdir debian/libairspyhf1/lib; fi

Reply to: