[Pkg-samba-maint] Bug#1072102: samba-ad-dc: ineffective replaces due to /usr-move (DEP17)

Helmut Grohne helmut at subdivi.de
Tue May 28 15:39:47 BST 2024


Package: samba-ad-dc
Version: 2:4.20.1+dfsg-3
Severity: serious
Tags: patch
User: helmutg at debian.org
Usertags: dep17p1
Control: affects -1 + samba

Hi,

/lib/systemd/system/samba-ad-dc.service is part of the samba package
in the following versions:
 * 2:4.13.13+dfsg-1~deb11u5: bullseye                                                 
 * 2:4.13.13+dfsg-1~deb11u6: bullseye-security|bullseye-proposed-updates              
 * 2:4.17.12+dfsg-0+deb12u1: bookworm|bookworm-security                               
 * 2:4.17.12+dfsg-0+deb12u1~bpo11+1: bullseye-backports                               
 * 2:4.17.9+dfsg-0+deb12u3: bookworm-updates                                          
 * 2:4.19.6+dfsg-3~bpo12+1: bookworm-backports                                        

/usr/lib/systemd/system/samba-ad-dc.service is now part of samba-ad-dc.
Since these actually refer to the same file via different paths (due to
/usr-move), we produce a DEP17 P1 problem and the declared Replaces are
ineffective leading to file loss in an upgrade scenario (what the file
move moratorium meant to prevent). This needs to be mitigated and I am
attaching the necessary patch.

Helmut
-------------- next part --------------
diff -Nru samba-4.20.1+dfsg/debian/changelog samba-4.20.1+dfsg/debian/changelog
--- samba-4.20.1+dfsg/debian/changelog	2024-05-26 17:48:17.000000000 +0200
+++ samba-4.20.1+dfsg/debian/changelog	2024-05-28 13:37:34.000000000 +0200
@@ -1,3 +1,10 @@
+samba (2:4.20.1+dfsg-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Mitigate ineffective replaces due to /usr-move (DEP17 P1). (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Tue, 28 May 2024 13:37:34 +0200
+
 samba (2:4.20.1+dfsg-3) unstable; urgency=medium
 
   * d/rules: move samba-common install to d/samba-common.install
diff -Nru samba-4.20.1+dfsg/debian/control samba-4.20.1+dfsg/debian/control
--- samba-4.20.1+dfsg/debian/control	2024-05-26 14:33:25.000000000 +0200
+++ samba-4.20.1+dfsg/debian/control	2024-05-28 12:36:04.000000000 +0200
@@ -203,8 +203,10 @@
 Enhances: bind9, ntp
 Breaks:   samba-ad-provision (<< ${source:Upstream-Version}),
 # files moved from samba & samba-common-bin in 4.20.1-2:
-	  samba (<< 2:4.20.1+dfsg-2~), samba-common-bin (<< 2:4.20.1+dfsg-2~),
-Replaces: samba (<< 2:4.20.1+dfsg-2~), samba-common-bin (<< 2:4.20.1+dfsg-2~),
+	  samba-common-bin (<< 2:4.20.1+dfsg-2~),
+Replaces: samba-common-bin (<< 2:4.20.1+dfsg-2~),
+# Breaks+Replaces upgraded to Conflicts for DEP17 + /usr-move
+Conflicts: samba (<< 2:4.20.1+dfsg-2~),
 Description: Samba control files to run AD Domain Controller
  Samba is an implementation of the SMB/CIFS protocol for Unix systems,
  providing support for cross-platform file and printer sharing with
diff -Nru samba-4.20.1+dfsg/debian/samba-ad-dc.lintian-overrides samba-4.20.1+dfsg/debian/samba-ad-dc.lintian-overrides
--- samba-4.20.1+dfsg/debian/samba-ad-dc.lintian-overrides	1970-01-01 01:00:00.000000000 +0100
+++ samba-4.20.1+dfsg/debian/samba-ad-dc.lintian-overrides	2024-05-28 13:37:34.000000000 +0200
@@ -0,0 +1,3 @@
+# begin-remove-after: trixie
+diversion-for-unknown-file lib/systemd/system/samba-ad-dc.service [preinst:*]
+# end-remove-after
diff -Nru samba-4.20.1+dfsg/debian/samba-ad-dc.postinst samba-4.20.1+dfsg/debian/samba-ad-dc.postinst
--- samba-4.20.1+dfsg/debian/samba-ad-dc.postinst	1970-01-01 01:00:00.000000000 +0100
+++ samba-4.20.1+dfsg/debian/samba-ad-dc.postinst	2024-05-28 13:37:30.000000000 +0200
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# begin-remove-after: released:trixie
+# protective diversion of files moved from / to /usr, to avoid file loss.
+# Only for upgrades.
+if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then
+	dpkg-divert --package #PACKAGE# --no-rename \
+		--divert /lib/systemd/system/samba-ad-dc.service.usr-is-merged \
+		--remove /lib/systemd/system/samba-ad-dc.service
+fi
+# end-remove-after
+
+#DEBHELPER#
+
+exit 0
diff -Nru samba-4.20.1+dfsg/debian/samba-ad-dc.preinst samba-4.20.1+dfsg/debian/samba-ad-dc.preinst
--- samba-4.20.1+dfsg/debian/samba-ad-dc.preinst	1970-01-01 01:00:00.000000000 +0100
+++ samba-4.20.1+dfsg/debian/samba-ad-dc.preinst	2024-05-28 13:36:29.000000000 +0200
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# begin-remove-after: released:trixie
+# protective diversion of files moved from / to /usr, to avoid file loss.
+# Only for upgrades.
+if [ "$1" = "upgrade" ] || [ "$1" = "install" ]; then
+	dpkg-divert --package #PACKAGE# --no-rename \
+		--divert /lib/systemd/system/samba-ad-dc.service.usr-is-merged \
+		--add /lib/systemd/system/samba-ad-dc.service
+fi
+# end-remove-after
+
+#DEBHELPER#
+
+exit 0


More information about the Pkg-samba-maint mailing list