Your message dated Sun, 26 Nov 2023 14:41:38 +0000
with message-id <[email protected]>
and subject line Bug#1056725: fixed in sane-backends 1.2.1-6
has caused the Debian Bug report #1056725,
regarding libsane1: Move files into /usr (incl. DEP17 P7 mitigation)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1056725: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1056725
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: libsane1
Version: 1.2.1-5
Severity: important
Tags: patch
User: [email protected]
Usertags: dep17p7
X-Debbugs-Cc: [email protected]

Dear Maintainer,

libsane1 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 libsane1 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. Alternatively, you can also find
the commit in this git repository[2].

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://subdivi.de/~helmut/dep17.html
2. 
https://salsa.debian.org/zeha/sane-backends/-/commits/zeha-usrmerge-move-rules
From 852ece16e1935d3b2e186783799a9c545704bbd6 Mon Sep 17 00:00:00 2001
From: Chris Hofstaedtler <[email protected]>
Date: Wed, 22 Nov 2023 13:21:49 +0100
Subject: [PATCH] Move udev files to /usr

---
 debian/changelog                              |  8 +++++
 debian/libsane1.dirs                          |  2 +-
 debian/libsane1.install                       |  3 +-
 debian/libsane1.lintian-overrides             |  6 ++++
 debian/libsane1.postinst                      | 17 ++++++++++
 debian/libsane1.postrm                        | 23 +++++++++++++
 debian/libsane1.preinst                       | 22 +++++++++++++
 .../0725-fix_link_60-libsane_rule.patch       | 33 -------------------
 debian/patches/series                         |  1 -
 debian/rules                                  | 30 ++++++++---------
 10 files changed, 93 insertions(+), 52 deletions(-)
 create mode 100644 debian/libsane1.lintian-overrides
 create mode 100644 debian/libsane1.postrm
 create mode 100644 debian/libsane1.preinst
 delete mode 100644 debian/patches/0725-fix_link_60-libsane_rule.patch

diff --git a/debian/changelog b/debian/changelog
index e6466d2..4d5aa9e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+sane-backends (1.2.1-6~) UNRELEASED; urgency=medium
+
+  * libsane1: move udev files to /usr, with protective diversion
+    against m-a: same file loss on upgrades (DEP17 P7 M10). Diversion can be
+    removed in forky+1. (Closes: #-1)
+
+ -- Chris Hofstaedtler <[email protected]>  Wed, 22 Nov 2023 13:20:54 +0100
+
 sane-backends (1.2.1-5) unstable; urgency=medium
 
   * debian/rules:
diff --git a/debian/libsane1.dirs b/debian/libsane1.dirs
index ad3a3cc..a2b7938 100644
--- a/debian/libsane1.dirs
+++ b/debian/libsane1.dirs
@@ -1 +1 @@
-/lib/udev/hwdb.d/
+/usr/lib/udev/hwdb.d/
diff --git a/debian/libsane1.install b/debian/libsane1.install
index ba37095..bd940fe 100644
--- a/debian/libsane1.install
+++ b/debian/libsane1.install
@@ -1,3 +1,4 @@
 usr/lib/*/*.so.*
 usr/lib/*/sane/*.so.*
-debian/99-libsane1.rules /lib/udev/rules.d/
+debian/60-libsane1.rules /usr/lib/udev/rules.d/
+debian/99-libsane1.rules /usr/lib/udev/rules.d/
diff --git a/debian/libsane1.lintian-overrides 
b/debian/libsane1.lintian-overrides
new file mode 100644
index 0000000..df62ec5
--- /dev/null
+++ b/debian/libsane1.lintian-overrides
@@ -0,0 +1,6 @@
+# begin-remove-after: released:forky
+# protective diversion for upgrades of files moved from / to /usr
+libsane1: diversion-for-unknown-file lib/udev/hwdb.d/20-sane.hwdb [preinst:*]
+libsane1: diversion-for-unknown-file lib/udev/rules.d/60-libsane1.rules 
[preinst:*]
+libsane1: diversion-for-unknown-file lib/udev/rules.d/99-libsane1.rules 
[preinst:*]
+# end-remove-after
diff --git a/debian/libsane1.postinst b/debian/libsane1.postinst
index 971103e..d327aa0 100644
--- a/debian/libsane1.postinst
+++ b/debian/libsane1.postinst
@@ -1,6 +1,23 @@
 #!/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/hwdb.d/20-sane.hwdb.usr-is-merged \
+        --remove /lib/udev/hwdb.d/20-sane.hwdb
+    dpkg-divert --package usr-is-merged --no-rename \
+        --divert /lib/udev/rules.d/60-libsane1.rules.usr-is-merged \
+        --remove /lib/udev/rules.d/60-libsane1.rules
+    dpkg-divert --package usr-is-merged --no-rename \
+        --divert /lib/udev/rules.d/99-libsane1.rules.usr-is-merged \
+        --remove /lib/udev/rules.d/99-libsane1.rules
+fi
+# end-remove-after
+
 case "$1" in
     configure)
     # Add the scanner system group if it doesn't exist
diff --git a/debian/libsane1.postrm b/debian/libsane1.postrm
new file mode 100644
index 0000000..6fbd208
--- /dev/null
+++ b/debian/libsane1.postrm
@@ -0,0 +1,23 @@
+#!/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/hwdb.d/20-sane.hwdb.usr-is-merged \
+        --remove /lib/udev/hwdb.d/20-sane.hwdb
+    dpkg-divert --package usr-is-merged --no-rename \
+        --divert /lib/udev/rules.d/60-libsane1.rules.usr-is-merged \
+        --remove /lib/udev/rules.d/60-libsane1.rules
+    dpkg-divert --package usr-is-merged --no-rename \
+        --divert /lib/udev/rules.d/99-libsane1.rules.usr-is-merged \
+        --remove /lib/udev/rules.d/99-libsane1.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
diff --git a/debian/libsane1.preinst b/debian/libsane1.preinst
new file mode 100644
index 0000000..9ca1e19
--- /dev/null
+++ b/debian/libsane1.preinst
@@ -0,0 +1,22 @@
+#!/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/hwdb.d/20-sane.hwdb.usr-is-merged \
+        --add /lib/udev/hwdb.d/20-sane.hwdb
+    dpkg-divert --package usr-is-merged --no-rename \
+        --divert /lib/udev/rules.d/60-libsane1.rules.usr-is-merged \
+        --add /lib/udev/rules.d/60-libsane1.rules
+    dpkg-divert --package usr-is-merged --no-rename \
+        --divert /lib/udev/rules.d/99-libsane1.rules.usr-is-merged \
+        --add /lib/udev/rules.d/99-libsane1.rules
+fi
+# end-remove-after
+
+#DEBHELPER#
+
diff --git a/debian/patches/0725-fix_link_60-libsane_rule.patch 
b/debian/patches/0725-fix_link_60-libsane_rule.patch
deleted file mode 100644
index 0b424e2..0000000
--- a/debian/patches/0725-fix_link_60-libsane_rule.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-Description: Fix directory for 20-sane.hwdb
-Author: Jörg Frings-Fürst <[email protected]>
-Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916239
-Forwarded: not-needed
-Last-Update: 2019-04-27
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
-Index: trunk/tools/sane-desc.c
-===================================================================
---- trunk.orig/tools/sane-desc.c
-+++ trunk/tools/sane-desc.c
-@@ -3649,7 +3649,7 @@ print_udevhwdb_header (void)
-     ("#\n"
-      "# udev rules file for supported USB and SCSI devices\n"
-      "#\n"
--     "# For the list of supported USB devices see 
/usr/lib/udev/hwdb.d/20-sane.hwdb\n"
-+     "# For the list of supported USB devices see 
/lib/udev/hwdb.d/20-sane.hwdb\n"
-      "#\n"
-      "# The SCSI device support is very basic and includes only\n"
-      "# scanners that mark themselves as type \"scanner\" or\n"
-Index: trunk/testsuite/tools/data/udev+hwdb.ref
-===================================================================
---- trunk.orig/testsuite/tools/data/udev+hwdb.ref
-+++ trunk/testsuite/tools/data/udev+hwdb.ref
-@@ -3,7 +3,7 @@
- #
- # udev rules file for supported USB and SCSI devices
- #
--# For the list of supported USB devices see /usr/lib/udev/hwdb.d/20-sane.hwdb
-+# For the list of supported USB devices see /lib/udev/hwdb.d/20-sane.hwdb
- #
- # The SCSI device support is very basic and includes only
- # scanners that mark themselves as type "scanner" or
diff --git a/debian/patches/series b/debian/patches/series
index 81eddad..ac4a4b6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,7 +5,6 @@
 0140-avahi.patch
 0145-avahi.patch
 0705-kfreebsd.patch
-0725-fix_link_60-libsane_rule.patch
 0150-i386-test.patch
 0155-hurd_PATH_MAX.patch
 0050-Use-python3-shebang.patch
diff --git a/debian/rules b/debian/rules
index 03d63c3..d4168f2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -85,12 +85,26 @@ override_dh_auto_install-indep:
        $(RM) debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/sane/libsane-dll.*
 
 override_dh_install-arch:
+ifeq (linux,$(DEB_HOST_ARCH_OS))
+       # udev support
+       # Generate the udev rules file
+       $(SANE_DESC) -s $(CURDIR)/doc/descriptions -m udev+hwdb > 
$(CURDIR)/debian/60-libsane1.rules
+       $(SANE_DESC) -s $(CURDIR)/doc/descriptions -m hwdb > 
$(CURDIR)/debian/20-sane.hwdb
+
+       cp $(CURDIR)/debian/20-sane.hwdb 
$(CURDIR)/debian/libsane1/usr/lib/udev/hwdb.d/
+endif
+
        dh_install
        # Install the pkg-config file
        mkdir -p debian/libsane-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/
        cp tools/sane-backends.pc 
debian/libsane-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/
        cp debian/sane-utils.logrotate 
debian/sane-utils/etc/logrotate.d/sane-utils
 
+       # remove rpath from the binaries (wonderful tool !)
+       chrpath -d debian/sane-utils/usr/sbin/saned
+       chrpath -d debian/sane-utils/usr/bin/scanimage
+       chrpath -d debian/sane-utils/usr/bin/sane-find-scanner
+
 override_dh_install-indep:
        dh_install
 
@@ -126,22 +140,6 @@ ifeq (linux,$(DEB_HOST_ARCH_OS))
        cp README.linux debian/libsane-common/usr/share/doc/libsane-common/
 endif
 
-override_dh_installudev-arch:
-ifeq (linux,$(DEB_HOST_ARCH_OS))
-       # udev support
-       # Generate the udev rules file
-       $(SANE_DESC) -s $(CURDIR)/doc/descriptions -m udev+hwdb > 
$(CURDIR)/debian/libsane1.udev
-       $(SANE_DESC) -s $(CURDIR)/doc/descriptions -m hwdb > 
$(CURDIR)/debian/20-sane.hwdb
-
-       cp $(CURDIR)/debian/20-sane.hwdb 
$(CURDIR)/debian/libsane1/lib/udev/hwdb.d/
-       dh_installudev
-endif
-
-       # remove rpath from the binaries (wonderful tool !)
-       chrpath -d debian/sane-utils/usr/sbin/saned
-       chrpath -d debian/sane-utils/usr/bin/scanimage
-       chrpath -d debian/sane-utils/usr/bin/sane-find-scanner
-
 override_dh_installinit-arch:
        dh_installinit -psane-utils --name=saned
 
-- 
2.39.2


--- End Message ---
--- Begin Message ---
Source: sane-backends
Source-Version: 1.2.1-6
Done: Jörg Frings-Fürst <[email protected]>

We believe that the bug you reported is fixed in the latest version of
sane-backends, 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 [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Jörg Frings-Fürst <[email protected]> (supplier of updated sane-backends 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 [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sat, 25 Nov 2023 19:52:57 +0100
Source: sane-backends
Architecture: source
Version: 1.2.1-6
Distribution: unstable
Urgency: medium
Maintainer: Jörg Frings-Fürst <[email protected]>
Changed-By: Jörg Frings-Fürst <[email protected]>
Closes: 1056725
Changes:
 sane-backends (1.2.1-6) unstable; urgency=medium
 .
   * libsane1: move udev files to /usr, with protective diversion
     against m-a: same file loss on upgrades (DEP17 P7 M10). Diversion can be
     removed in Forky (Closes: #1056725).
     Thanks to Chris Hofstaedtler <[email protected]>.
Checksums-Sha1:
 314d00db5b541a906087dd75e531a75379cac275 2428 sane-backends_1.2.1-6.dsc
 b41bd4bc602f2466e4183a6900adba5469d4675f 70616 
sane-backends_1.2.1-6.debian.tar.xz
 ae80a67b46b7f8539aa818cef631119f9eafad93 12858 
sane-backends_1.2.1-6_arm64.buildinfo
Checksums-Sha256:
 b679c7639027f57446855b4d4c47561d237d00f848e0e80c36a1377d54a8d81a 2428 
sane-backends_1.2.1-6.dsc
 13909704f4289bbc001b4f571057a29ee2eae19be0dabd6684cc1280203ac5d4 70616 
sane-backends_1.2.1-6.debian.tar.xz
 39e92cd20cb6243f2a397305fcf01e201f502fa613d5e9adfb83f463c928b616 12858 
sane-backends_1.2.1-6_arm64.buildinfo
Files:
 bc5091a81b930656ad1fe3e973698e9c 2428 graphics optional 
sane-backends_1.2.1-6.dsc
 98250fc6e223d1d7e9a33c4176158b14 70616 graphics optional 
sane-backends_1.2.1-6.debian.tar.xz
 faac061a0523a21e5faae4ccae2ed45e 12858 graphics optional 
sane-backends_1.2.1-6_arm64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEfRrP+tnggGycTNOSXBPW25MFLgMFAmVjVREACgkQXBPW25MF
LgP6Ew/+NEyu0w6GEirE+2xigcsRBRCjMMWWY9Yt9R8Lv0sgA0TRZcKdmhgpnuWW
xWahIT5taBHxkxntADDAk+WApsRD6wSN9BPhFUL5LSV0Ye5EjdBMeg1itS6GAnZx
KJnDH9ZlFrrtXG1Qpel+EUQ5jGVMcjXzG7mYieJB1KBe/9phanPp/Bu8M94AAcA2
YNx87y1re8kSa3q9n5hkYn76PrhRgYvOILVpjYXx7Z6C4Pg5XgqYNcpICyP6BHqY
QLEK9/W16KSbYhqQA6cpLnpawqo95/g3LKHF9p6X0bgq4DOwUGUcCOdN/KdPhhUJ
Om2i0028J+u3ZEdGF3OzHrzJq1v7QiQyVZu0EpuuMMtF9BtO+VRAVMEy+CankZ3Z
86770wgTM7GcXHqaF+atjdBmRhZu6uODBHBfPXVfb5zSxBrsenVIeVEJHvG/d8zl
gRcBzoYNcp56O1L1P0Ti6RjLHNU9mZVngG893uK/5u9AfUzTIyIavAwbXiB/RJ5X
E+szhTN1vyGncL9AF+72r1CF9hEf5R8pX0fZMfqyZM0eMc9EIVg4jQSTr/iOTIKb
IE9nAF4kjFmLVDfsvSzXlurGa/to861eY+xwD4HKh6PAz+vQramiXyK0pJjc7zMc
dfrgWO0A3uhmw0kyeYpLk4wobltCoEUsmfbRpgy+bYUiQ48LlB8=
=LFrp
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to