Package: libhamlib4
Version: 4.5.5-2
Severity: important
Tags: patch
User: helm...@debian.org
Usertags: dep17p7
X-Debbugs-Cc: helm...@debian.org

Dear Maintainer,

libhamlib4 contains udev rules which are installed to /lib; these files
need to be moved to /usr/lib as part of Debian's usr-merge effort.
Because libhamlib4 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).

I attached a patch which avoids the problem by implementating
DEP17 M10 (Protective diversions for shared files) for the affected files.

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.

Best regards,
Miguel.

1. https://subdivi.de/~helmut/dep17.html



diff -Nru hamlib-4.5.5/debian/changelog hamlib-4.5.5/debian/changelog
--- hamlib-4.5.5/debian/changelog       2023-06-18 20:00:08.000000000 +0100
+++ hamlib-4.5.5/debian/changelog       2023-11-24 14:19:21.000000000 +0000
@@ -1,3 +1,9 @@
+hamlib (4.5.5-3) UNRELEASED; urgency=medium
+
+  * Install libhamlib4.rules into /usr, with protective diversion.
+
+ -- Miguel Landaeta <nomad...@debian.org>  Fri, 24 Nov 2023 14:19:21 +0000
+
 hamlib (4.5.5-2) unstable; urgency=medium
 
   * Remove transitional packages libhamlib2-perl, libhamlib2-tcl,
diff -Nru hamlib-4.5.5/debian/libhamlib4.install 
hamlib-4.5.5/debian/libhamlib4.install
--- hamlib-4.5.5/debian/libhamlib4.install      2021-01-01 23:20:20.000000000 
+0000
+++ hamlib-4.5.5/debian/libhamlib4.install      2023-11-24 14:19:21.000000000 
+0000
@@ -1 +1,2 @@
 usr/lib/*/libhamlib.so.*
+debian/60-libhamlib4.rules     usr/lib/udev/rules.d
diff -Nru hamlib-4.5.5/debian/libhamlib4.postinst 
hamlib-4.5.5/debian/libhamlib4.postinst
--- hamlib-4.5.5/debian/libhamlib4.postinst     1970-01-01 01:00:00.000000000 
+0100
+++ hamlib-4.5.5/debian/libhamlib4.postinst     2023-11-24 14:19:21.000000000 
+0000
@@ -0,0 +1,23 @@
+#!/bin/sh
+# postinst script for lihamlib
+
+set -e
+
+dpkg-maintscript-helper rm_conffile /etc/udev/60-libhamlib4.rules -- "$@"
+
+rm -f /etc/udev/rules.d/60-libhamlib4.rules
+
+# 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-libhamlib4.rules.usr-is-merged \
+        --remove /lib/udev/rules.d/60-libhamlib4.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
+exit 0
diff -Nru hamlib-4.5.5/debian/libhamlib4.postrm 
hamlib-4.5.5/debian/libhamlib4.postrm
--- hamlib-4.5.5/debian/libhamlib4.postrm       1970-01-01 01:00:00.000000000 
+0100
+++ hamlib-4.5.5/debian/libhamlib4.postrm       2023-11-24 14:19:21.000000000 
+0000
@@ -0,0 +1,21 @@
+#!/bin/sh
+# postrm script for libhamlib
+
+set -e
+
+dpkg-maintscript-helper rm_conffile /etc/udev/60-libhamlib4.rules -- "$@"
+
+# 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-libhamlib4.rules.usr-is-merged \
+        --remove /lib/udev/rules.d/60-libhamlib4.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
+exit 0
diff -Nru hamlib-4.5.5/debian/libhamlib4.preinst 
hamlib-4.5.5/debian/libhamlib4.preinst
--- hamlib-4.5.5/debian/libhamlib4.preinst      1970-01-01 01:00:00.000000000 
+0100
+++ hamlib-4.5.5/debian/libhamlib4.preinst      2023-11-24 14:19:21.000000000 
+0000
@@ -0,0 +1,20 @@
+#!/bin/sh
+# preinst script for libhamlib
+
+set -e
+
+dpkg-maintscript-helper rm_conffile /etc/udev/60-libhamlib4.rules -- "$@"
+
+# 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-libhamlib4.rules.usr-is-merged \
+        --add /lib/udev/rules.d/60-libhamlib4.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
+exit 0
diff -Nru hamlib-4.5.5/debian/60-libhamlib4.rules 
hamlib-4.5.5/debian/60-libhamlib4.rules
--- hamlib-4.5.5/debian/60-libhamlib4.rules     1970-01-01 01:00:00.000000000 
+0100
+++ hamlib-4.5.5/debian/60-libhamlib4.rules     2021-01-02 00:27:23.000000000 
+0000
@@ -0,0 +1,12 @@
+#
+# Enable uaccess for common embedded USB-serial converters so that
+# applications which call usb_detach_kernel_driver_np() won't need sudo.
+#
+# This file was installed by the package 'libhamlib4'
+
+# FTDI USB Serial Device converter
+ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0403", 
ATTR{idProduct}=="6001", TAG+="uaccess"
+
+# VOTI USBasp AVR Programmer
+ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", 
ATTR{idProduct}=="05dc", TAG+="uaccess"
+
diff -Nru hamlib-4.5.5/debian/libhamlib4.udev 
hamlib-4.5.5/debian/libhamlib4.udev
--- hamlib-4.5.5/debian/libhamlib4.udev 2021-01-02 00:27:23.000000000 +0000
+++ hamlib-4.5.5/debian/libhamlib4.udev 1970-01-01 01:00:00.000000000 +0100
@@ -1,12 +0,0 @@
-#
-# Enable uaccess for common embedded USB-serial converters so that
-# applications which call usb_detach_kernel_driver_np() won't need sudo.
-#
-# This file was installed by the package 'libhamlib4'
-
-# FTDI USB Serial Device converter
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0403", 
ATTR{idProduct}=="6001", TAG+="uaccess"
-
-# VOTI USBasp AVR Programmer
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", 
ATTR{idProduct}=="05dc", TAG+="uaccess"
-


-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.5.0-4-amd64 (SMP w/1 CPU thread; PREEMPT)
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_IE:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libhamlib4 depends on:
ii  libc6           2.37-12
ii  libgcc-s1       13.2.0-6
ii  libindiclient1  1.9.9+dfsg-3
ii  libstdc++6      13.2.0-6
ii  libusb-1.0-0    2:1.0.26-1

libhamlib4 recommends no packages.

libhamlib4 suggests no packages.
diff -Nru hamlib-4.5.5/debian/changelog hamlib-4.5.5/debian/changelog
--- hamlib-4.5.5/debian/changelog       2023-06-18 20:00:08.000000000 +0100
+++ hamlib-4.5.5/debian/changelog       2023-11-24 14:19:21.000000000 +0000
@@ -1,3 +1,9 @@
+hamlib (4.5.5-3) UNRELEASED; urgency=medium
+
+  * Install libhamlib4.rules into /usr, with protective diversion.
+
+ -- Miguel Landaeta <nomad...@debian.org>  Fri, 24 Nov 2023 14:19:21 +0000
+
 hamlib (4.5.5-2) unstable; urgency=medium
 
   * Remove transitional packages libhamlib2-perl, libhamlib2-tcl,
diff -Nru hamlib-4.5.5/debian/libhamlib4.install 
hamlib-4.5.5/debian/libhamlib4.install
--- hamlib-4.5.5/debian/libhamlib4.install      2021-01-01 23:20:20.000000000 
+0000
+++ hamlib-4.5.5/debian/libhamlib4.install      2023-11-24 14:19:21.000000000 
+0000
@@ -1 +1,2 @@
 usr/lib/*/libhamlib.so.*
+debian/60-libhamlib4.rules     usr/lib/udev/rules.d
diff -Nru hamlib-4.5.5/debian/libhamlib4.postinst 
hamlib-4.5.5/debian/libhamlib4.postinst
--- hamlib-4.5.5/debian/libhamlib4.postinst     1970-01-01 01:00:00.000000000 
+0100
+++ hamlib-4.5.5/debian/libhamlib4.postinst     2023-11-24 14:19:21.000000000 
+0000
@@ -0,0 +1,23 @@
+#!/bin/sh
+# postinst script for lihamlib
+
+set -e
+
+dpkg-maintscript-helper rm_conffile /etc/udev/60-libhamlib4.rules -- "$@"
+
+rm -f /etc/udev/rules.d/60-libhamlib4.rules
+
+# 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-libhamlib4.rules.usr-is-merged \
+        --remove /lib/udev/rules.d/60-libhamlib4.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
+exit 0
diff -Nru hamlib-4.5.5/debian/libhamlib4.postrm 
hamlib-4.5.5/debian/libhamlib4.postrm
--- hamlib-4.5.5/debian/libhamlib4.postrm       1970-01-01 01:00:00.000000000 
+0100
+++ hamlib-4.5.5/debian/libhamlib4.postrm       2023-11-24 14:19:21.000000000 
+0000
@@ -0,0 +1,21 @@
+#!/bin/sh
+# postrm script for libhamlib
+
+set -e
+
+dpkg-maintscript-helper rm_conffile /etc/udev/60-libhamlib4.rules -- "$@"
+
+# 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-libhamlib4.rules.usr-is-merged \
+        --remove /lib/udev/rules.d/60-libhamlib4.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
+exit 0
diff -Nru hamlib-4.5.5/debian/libhamlib4.preinst 
hamlib-4.5.5/debian/libhamlib4.preinst
--- hamlib-4.5.5/debian/libhamlib4.preinst      1970-01-01 01:00:00.000000000 
+0100
+++ hamlib-4.5.5/debian/libhamlib4.preinst      2023-11-24 14:19:21.000000000 
+0000
@@ -0,0 +1,20 @@
+#!/bin/sh
+# preinst script for libhamlib
+
+set -e
+
+dpkg-maintscript-helper rm_conffile /etc/udev/60-libhamlib4.rules -- "$@"
+
+# 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-libhamlib4.rules.usr-is-merged \
+        --add /lib/udev/rules.d/60-libhamlib4.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
+exit 0
diff -Nru hamlib-4.5.5/debian/60-libhamlib4.rules 
hamlib-4.5.5/debian/60-libhamlib4.rules
--- hamlib-4.5.5/debian/60-libhamlib4.rules     1970-01-01 01:00:00.000000000 
+0100
+++ hamlib-4.5.5/debian/60-libhamlib4.rules     2021-01-02 00:27:23.000000000 
+0000
@@ -0,0 +1,12 @@
+#
+# Enable uaccess for common embedded USB-serial converters so that
+# applications which call usb_detach_kernel_driver_np() won't need sudo.
+#
+# This file was installed by the package 'libhamlib4'
+
+# FTDI USB Serial Device converter
+ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0403", 
ATTR{idProduct}=="6001", TAG+="uaccess"
+
+# VOTI USBasp AVR Programmer
+ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", 
ATTR{idProduct}=="05dc", TAG+="uaccess"
+
diff -Nru hamlib-4.5.5/debian/libhamlib4.udev 
hamlib-4.5.5/debian/libhamlib4.udev
--- hamlib-4.5.5/debian/libhamlib4.udev 2021-01-02 00:27:23.000000000 +0000
+++ hamlib-4.5.5/debian/libhamlib4.udev 1970-01-01 01:00:00.000000000 +0100
@@ -1,12 +0,0 @@
-#
-# Enable uaccess for common embedded USB-serial converters so that
-# applications which call usb_detach_kernel_driver_np() won't need sudo.
-#
-# This file was installed by the package 'libhamlib4'
-
-# FTDI USB Serial Device converter
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0403", 
ATTR{idProduct}=="6001", TAG+="uaccess"
-
-# VOTI USBasp AVR Programmer
-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", 
ATTR{idProduct}=="05dc", TAG+="uaccess"
-

Reply via email to