Bug#1059415: ntfs-3g: install files into /usr (instead of /)

2024-03-26 Thread Helmut Grohne
user helm...@debian.org
usertags 1059415 + dep17p1
reassign 1059415 ntfs-3,libntfs-3g89t64
found 1059415 1:2022.10.3-1.2
affects 1059415 libntfs-3g89
severity 1059415 important
thanks


On Sun, Dec 24, 2023 at 10:13:46PM +0100, Chris Hofstaedtler wrote:
> Your package installs files into /. For the ongoing Debian UsrMerge
> effort [1] these files should move to /usr in the trixie cycle.

This still applies.

> I'm attaching a patch to implement such a move. It is quite
> involved, but mostly undoes the move /usr -> /. The upstream
> Makefiles ignore --exec-prefix/rootsbindir for the mount.* symlinks,
> so I've chosen to re-create them using dh_link instead.
> 
> However, please still read the wiki page on moving files, especially
> if you intend to backport to bookworm or earlier. The patch has
> already been checked by a local dumat copy.

This patch should no longer be applied, because

> If during the trixie cycle your package will undergo structural
> changes or any other file moves, please also see the wiki and upload
> to experimental first when these changes are done.

time64 incurred structural changes. I'm attaching an updated patch that
mitigates these structural changes.

I've tested the patch using piuparts and using a manual upgrade test
via:

mmdebstrap trixie /dev/null --variant=apt --include ntfs-3g 
--customize-hook='echo "deb http://deb.debian.org/debian sid main" > 
"$1/etc/apt/sources.list.d/sid.list"' --chrooted-customize-hook="apt-get 
update" --customize-hook="upload libntfs-3g89t64_2022.10.3-1.3_amd64.deb 
/l.deb" --customize-hook="upload ntfs-3g_2022.10.3-1.3_amd64.deb /d.deb" 
--chrooted-customize-hook="apt-get -y install libgnutls30t64; dpkg 
--auto-deconfigure --unpack /l.deb /d.deb; apt-get -y install /l.deb /d.deb" 
--chrooted-customize-hook="dpkg --verify"

Helmut
diff -Nru ntfs-3g-2022.10.3/debian/changelog ntfs-3g-2022.10.3/debian/changelog
--- ntfs-3g-2022.10.3/debian/changelog  2024-03-14 13:21:45.0 +0100
+++ ntfs-3g-2022.10.3/debian/changelog  2024-03-26 11:16:22.0 +0100
@@ -1,3 +1,12 @@
+ntfs-3g (1:2022.10.3-1.3) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+
+  [ Helmut Grohne and Chris Hofstaedtler ]
+  * Move files to /usr and mitigate file loss. (Closes: #1059415, #945923)
+
+ -- Helmut Grohne   Tue, 26 Mar 2024 11:16:22 +0100
+
 ntfs-3g (1:2022.10.3-1.2) unstable; urgency=medium
 
   [ Zixing Liu ]
diff -Nru ntfs-3g-2022.10.3/debian/control ntfs-3g-2022.10.3/debian/control
--- ntfs-3g-2022.10.3/debian/control2024-03-01 13:40:21.0 +0100
+++ ntfs-3g-2022.10.3/debian/control2024-03-26 11:16:22.0 +0100
@@ -45,7 +45,7 @@
 Package: libntfs-3g89t64
 Provides: ${t64:Provides}
 Replaces: libntfs-3g89
-Breaks: libntfs-3g89 (<< ${source:Version})
+Conflicts: libntfs-3g89 (<< ${source:Version})
 Section: libs
 Architecture: linux-any kfreebsd-any
 Multi-Arch: same
diff -Nru ntfs-3g-2022.10.3/debian/libntfs-3g89t64.install 
ntfs-3g-2022.10.3/debian/libntfs-3g89t64.install
--- ntfs-3g-2022.10.3/debian/libntfs-3g89t64.install2015-10-24 
09:41:03.0 +0200
+++ ntfs-3g-2022.10.3/debian/libntfs-3g89t64.install2024-03-26 
11:16:22.0 +0100
@@ -1 +1 @@
-lib/*/*.so.*
+usr/lib/*/*.so.*
diff -Nru ntfs-3g-2022.10.3/debian/libntfs-3g89t64.lintian-overrides 
ntfs-3g-2022.10.3/debian/libntfs-3g89t64.lintian-overrides
--- ntfs-3g-2022.10.3/debian/libntfs-3g89t64.lintian-overrides  2024-03-01 
13:40:18.0 +0100
+++ ntfs-3g-2022.10.3/debian/libntfs-3g89t64.lintian-overrides  2024-03-26 
11:16:22.0 +0100
@@ -1 +1,5 @@
 libntfs-3g89t64: package-name-doesnt-match-sonames libntfs-3g89
+# begin-remove-after: released:trixie
+# DEP17 mitigation
+orphaned-diversion lib/x86_64-linux-gnu/*
+# end-remove-after
diff -Nru ntfs-3g-2022.10.3/debian/libntfs-3g89t64.postinst 
ntfs-3g-2022.10.3/debian/libntfs-3g89t64.postinst
--- ntfs-3g-2022.10.3/debian/libntfs-3g89t64.postinst   1970-01-01 
01:00:00.0 +0100
+++ ntfs-3g-2022.10.3/debian/libntfs-3g89t64.postinst   2024-03-26 
11:16:22.0 +0100
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+# begin-remove-after: released:trixie
+if test "$1" = configure; then
+   for f in libntfs-3g.so.89 libntfs-3g.so.89.0.0; do
+   dpkg-divert --no-rename --package libntfs-3g89t64 --divert 
"/lib/#DEB_HOST_MULTIARCH#/$f.usr-is-merged" --remove 
"/lib/#DEB_HOST_MULTIARCH#/$f"
+   done
+fi
+# end-remove-after
+
+#DEBHELPER#
diff -Nru ntfs-3g-2022.10.3/debian/libntfs-3g89t64.preinst 
ntfs-3g-2022.10.3/debian/libntfs-3g89t64.preinst
--- ntfs-3g-2022.10.3/debian/libntfs-3g89t64.preinst1970-01-01 
01:00:00.0 +0100
+++ ntfs-3g-2022.10.3/debian/libntfs-3g89t64.preinst2024-03-26 
11:16:22.0 +0100
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+# begin-remove-after: released:trixie
+if test "$1" = upgrade || test "$1" = install; then
+   for f in libntfs-3g.so.89 libntfs-3g.so.89.0.0; do
+   dpkg-divert --no-rename --package 

Bug#1059415: ntfs-3g: install files into /usr (instead of /)

2023-12-24 Thread Chris Hofstaedtler
Source: ntfs-3g
Version: 1:2022.10.3-1
Severity: normal
Tags: patch
User: helm...@debian.org
Usertags: dep17m2

Hi!

Your package installs files into /. For the ongoing Debian UsrMerge
effort [1] these files should move to /usr in the trixie cycle.

I'm attaching a patch to implement such a move. It is quite
involved, but mostly undoes the move /usr -> /. The upstream
Makefiles ignore --exec-prefix/rootsbindir for the mount.* symlinks,
so I've chosen to re-create them using dh_link instead.

However, please still read the wiki page on moving files, especially
if you intend to backport to bookworm or earlier. The patch has
already been checked by a local dumat copy.

If during the trixie cycle your package will undergo structural
changes or any other file moves, please also see the wiki and upload
to experimental first when these changes are done.

Chris

[1] https://wiki.debian.org/UsrMerge
diff -Nru ntfs-3g-2022.10.3/debian/changelog ntfs-3g-2022.10.3/debian/changelog
--- ntfs-3g-2022.10.3/debian/changelog	2022-10-31 15:14:06.0 +0100
+++ ntfs-3g-2022.10.3/debian/changelog	2023-12-24 21:16:13.0 +0100
@@ -1,3 +1,10 @@
+ntfs-3g (1:2022.10.3-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Install files into /usr instead of /. (Closes: #-1)
+
+ -- Chris Hofstaedtler   Sun, 24 Dec 2023 21:16:13 +0100
+
 ntfs-3g (1:2022.10.3-1) unstable; urgency=high
 
   * New upstream release:
diff -Nru ntfs-3g-2022.10.3/debian/libntfs-3g89.install ntfs-3g-2022.10.3/debian/libntfs-3g89.install
--- ntfs-3g-2022.10.3/debian/libntfs-3g89.install	2015-10-24 09:41:03.0 +0200
+++ ntfs-3g-2022.10.3/debian/libntfs-3g89.install	2023-12-24 21:16:13.0 +0100
@@ -1 +1 @@
-lib/*/*.so.*
+usr/lib/*/*.so.*
diff -Nru ntfs-3g-2022.10.3/debian/local/ntfs-3g.hook ntfs-3g-2022.10.3/debian/local/ntfs-3g.hook
--- ntfs-3g-2022.10.3/debian/local/ntfs-3g.hook	2014-04-25 20:44:28.0 +0200
+++ ntfs-3g-2022.10.3/debian/local/ntfs-3g.hook	2023-12-24 21:16:13.0 +0100
@@ -17,9 +17,9 @@
 
 . /usr/share/initramfs-tools/hook-functions
 
-copy_exec /bin/ntfs-3g /bin
+copy_exec /usr/bin/ntfs-3g /usr/bin
 
-ln -s /bin/ntfs-3g "${DESTDIR}/sbin/mount.ntfs-3g"
-ln -s /bin/ntfs-3g "${DESTDIR}/sbin/mount.ntfs"
+ln -s /usr/bin/ntfs-3g "${DESTDIR}/usr/sbin/mount.ntfs-3g"
+ln -s /usr/bin/ntfs-3g "${DESTDIR}/usr/sbin/mount.ntfs"
 
 exit 0
diff -Nru ntfs-3g-2022.10.3/debian/ntfs-3g.install ntfs-3g-2022.10.3/debian/ntfs-3g.install
--- ntfs-3g-2022.10.3/debian/ntfs-3g.install	2015-10-24 09:40:42.0 +0200
+++ ntfs-3g-2022.10.3/debian/ntfs-3g.install	2023-12-24 21:16:13.0 +0100
@@ -1,4 +1,3 @@
-bin
-sbin
 usr/bin
+usr/sbin
 usr/share
diff -Nru ntfs-3g-2022.10.3/debian/ntfs-3g.links ntfs-3g-2022.10.3/debian/ntfs-3g.links
--- ntfs-3g-2022.10.3/debian/ntfs-3g.links	2014-04-25 20:44:28.0 +0200
+++ ntfs-3g-2022.10.3/debian/ntfs-3g.links	2023-12-24 21:16:13.0 +0100
@@ -1,4 +1,6 @@
-/sbin/mount.ntfs-3g			/sbin/mount.ntfs
+/usr/sbin/mount.ntfs-3g			/usr/sbin/mount.ntfs
+/usr/bin/ntfs-3g	/usr/sbin/mount.ntfs-3g
+/usr/bin/lowntfs-3g	/usr/sbin/mount.lowntfs-3g
 
 /usr/share/man/man8/ntfs-3g.8.gz	/usr/share/man/man8/mount.ntfs.8.gz
 /usr/share/man/man8/ntfs-3g.8.gz	/usr/share/man/man8/lowntfs-3g.8.gz
diff -Nru ntfs-3g-2022.10.3/debian/ntfs-3g-udeb.install ntfs-3g-2022.10.3/debian/ntfs-3g-udeb.install
--- ntfs-3g-2022.10.3/debian/ntfs-3g-udeb.install	2015-10-24 09:42:19.0 +0200
+++ ntfs-3g-2022.10.3/debian/ntfs-3g-udeb.install	2023-12-24 21:16:13.0 +0100
@@ -1,4 +1,3 @@
-bin/ntfs-3g
-lib/*/*.so.*
-sbin/mount.*
-sbin/ntfsresize
+usr/bin/ntfs-3g
+usr/lib/*/*.so.*
+usr/sbin/ntfsresize
diff -Nru ntfs-3g-2022.10.3/debian/ntfs-3g-udeb.links ntfs-3g-2022.10.3/debian/ntfs-3g-udeb.links
--- ntfs-3g-2022.10.3/debian/ntfs-3g-udeb.links	2014-04-25 20:44:28.0 +0200
+++ ntfs-3g-2022.10.3/debian/ntfs-3g-udeb.links	2023-12-24 21:16:13.0 +0100
@@ -1 +1,2 @@
-/sbin/mount.ntfs-3g	/sbin/mount.ntfs
+/usr/sbin/mount.ntfs-3g	/usr/sbin/mount.ntfs
+/usr/bin/ntfs-3g	/usr/sbin/mount.ntfs-3g
diff -Nru ntfs-3g-2022.10.3/debian/rules ntfs-3g-2022.10.3/debian/rules
--- ntfs-3g-2022.10.3/debian/rules	2022-10-31 15:14:06.0 +0100
+++ ntfs-3g-2022.10.3/debian/rules	2023-12-24 21:16:13.0 +0100
@@ -11,7 +11,7 @@
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
-SONAME = $(shell objdump -p debian/tmp/lib/*/libntfs-3g.so.*.* | awk -Fso. '/SONAME/ { print $$2 }')
+SONAME = $(shell objdump -p debian/tmp/usr/lib/*/libntfs-3g.so.*.* | awk -Fso. '/SONAME/ { print $$2 }')
 
 ifeq ($(DEB_HOST_ARCH_OS), linux)
 CONFIGURE_FLAGS = --enable-posix-acls
@@ -24,7 +24,7 @@
 	dh ${@}
 
 override_dh_auto_configure:
-	dh_auto_configure -- --exec-prefix=/ --enable-crypto \
+	dh_auto_configure -- --exec-prefix=/usr --enable-crypto \
 		--enable-extras --enable-xattr-mappings \
 		--enable-quarantined --disable-ldconfig \
 		--enable-mount-helper --with-fuse=internal \
@@ -33,13 +33,10 @@