Package: opensysusers Version: 0.7.3-2 Severity: serious Tags: patch User: helm...@debian.org Usertags: dep17p3 Control: affects -1 + systemd
Hi, opensysusers diverts /bin/systemd-sysusers. systemd has moved this file to /usr/bin/systemd-sysusers in version 255~rc1-1. While this change is not visible in an installation, the diversion no longer matches it. Thus what ends up at systemd-sysusers now depends on the order of unpacks. The diversion has become ineffective. This is a known problem category and documented in DEP17[1] as P3. Usually, the recommended mitigation for this kind of problem is duplicating the diversion (M18) such that both /bin/systemd-sysusers and /usr/bin/systemd-sysusers are diverted. I'm attaching a patch for this approach, but I think this is not the preferred solution for this case. I dug deeper as to why opensysusers would divert systemd-sysusers, talked to systemd maintainers and Thomas Goirand and read about #947847 in the process. Given this background, I believe that the use of a diversion is not a good solution and this was echoed by the CTTE decision, which declined to overrule and considered diversion a mechanism for experimentation. Three years later and with two stable releases including opensysusers I hope we are past the experimentation phase. The diversion setup bears a significant downside: While the API existing API of the sysusers interface is relatively stable, systemd keeps adding features and when systemd calls systemd-sysusers it wants to be able to rely on its latest features. A diverted systemd-sysusers may not provide what is needed here. Looking deeper into policy sections 7.4 and 7.5, the virtual package systemd-sysusers looks similar to mail-transport-agent where each implementation provides+conflicts+replaces mail-transport-agent. I think opensysusers should do the same. Once doing so, the diversion (and thus this bug) goes away entirely. The downside is that opensysusers and systemd are no longer coinstallable. I'm also attaching a patch for this. I caution that Thomas Goirand disagrees with this approach and recommends that these packages remain coinstallable and that users may choose the implementation. On the flip side, a user cannot choose to have systemd as the provider of systemd-sysusers when opensysusers is installed. A possible compromise could be that opensysusers stops diverting systemd-sysusers and installs the symbolic link without diversion such that systemd becomes the preferred provider when coinstalled. It could detect removal of systemd using file triggers and then reinstate the link. Such a setup also requires little cooperation from systemd maintainers, but it relies on an symbolic link that is completely untracked by dpkg, so there is some fragility to be found here whereas the conflict is conceptually simpler. In any case, something needs to be done here. The latest systemd upload now declares an unversioned conflict with opensysusers. It can become versioned once opensysusers has addressed this bug in some way. Helmut [1] https://subdivi.de/~helmut/dep17.html
diff --minimal -Nru opensysusers-0.7.3/debian/changelog opensysusers-0.7.3/debian/changelog --- opensysusers-0.7.3/debian/changelog 2022-11-20 16:18:16.000000000 +0100 +++ opensysusers-0.7.3/debian/changelog 2023-11-07 08:38:13.000000000 +0100 @@ -1,3 +1,11 @@ +opensysusers (0.7.3-2.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Duplicate diversion to mitigate DEP17 P3 via M18. (Closes: #-1) + * Move to /usr. + + -- Helmut Grohne <hel...@subdivi.de> Tue, 07 Nov 2023 08:38:13 +0100 + opensysusers (0.7.3-2) unstable; urgency=medium * d/preinst: remove -u option. diff --minimal -Nru opensysusers-0.7.3/debian/opensysusers.links opensysusers-0.7.3/debian/opensysusers.links --- opensysusers-0.7.3/debian/opensysusers.links 2022-11-20 16:11:31.000000000 +0100 +++ opensysusers-0.7.3/debian/opensysusers.links 2023-11-07 08:38:13.000000000 +0100 @@ -1 +1 @@ -/usr/bin/opensysusers-sysusers /bin/systemd-sysusers +/usr/bin/opensysusers-sysusers /usr/bin/systemd-sysusers diff --minimal -Nru opensysusers-0.7.3/debian/opensysusers.lintian-overrides opensysusers-0.7.3/debian/opensysusers.lintian-overrides --- opensysusers-0.7.3/debian/opensysusers.lintian-overrides 2022-11-20 16:11:31.000000000 +0100 +++ opensysusers-0.7.3/debian/opensysusers.lintian-overrides 2023-11-07 08:38:13.000000000 +0100 @@ -4,4 +4,6 @@ # Creating sysusers.d is intentional opensysusers: package-contains-empty-directory [usr/lib/sysusers.d/] # The manpage is provided by the systemd package -opensysusers: no-manual-page [bin/systemd-sysusers] +opensysusers: no-manual-page [usr/bin/systemd-sysusers] +# DEP17 M18 not recognized by lintian +opensysusers: diversion-for-unknown-file bin/systemd-sysusers [preinst:*] diff --minimal -Nru opensysusers-0.7.3/debian/opensysusers.postrm opensysusers-0.7.3/debian/opensysusers.postrm --- opensysusers-0.7.3/debian/opensysusers.postrm 2022-11-20 16:15:39.000000000 +0100 +++ opensysusers-0.7.3/debian/opensysusers.postrm 2023-11-07 08:38:10.000000000 +0100 @@ -3,15 +3,30 @@ set -e if [ "$1" = "remove" ] || [ "$1" = "abort-install" ] || [ "$1" = "disappear" ] ; then - dpkg-divert --package opensysusers --remove --rename \ + dpkg-divert --package opensysusers --remove --no-rename \ --divert /bin/systemd-sysusers.real /bin/systemd-sysusers + dpkg-divert --package opensysusers --remove --no-rename \ + --divert /usr/bin/systemd-sysusers.real /usr/bin/systemd-sysusers fi if [ "abort-upgrade" = "$1" ] && dpkg --compare-versions "$2" lt 0.6-1; then - dpkg-divert --package opensysusers --remove --rename \ + dpkg-divert --package opensysusers --remove --no-rename \ --divert /bin/systemd-sysusers.real /bin/systemd-sysusers fi +if [ "$1" = abort-upgrade ] && dpkg --compare-versions "$2" lt 0.7.3-2.1~; then + dpkg-divert --package opensysusers --remove --no-rename \ + --divert /usr/bin/systemd-sysusers.real /usr/bin/systemd-sysusers +fi + +if [ "$1" = "remove" ] || [ "$1" = "abort-install" ] || [ "$1" = "disappear" ] ; then + for f in /usr/bin/systemd-sysusers /bin/systemd-sysusers; do + if [ -e "$DPKG_ROOT$f.real" ] && ! [ -e "$DPKG_ROOT$f" ]; then + mv "$DPKG_ROOT$f.real" "$DPKG_ROOT$f" + fi + done +fi + #DEBHELPER# exit 0 diff --minimal -Nru opensysusers-0.7.3/debian/opensysusers.preinst opensysusers-0.7.3/debian/opensysusers.preinst --- opensysusers-0.7.3/debian/opensysusers.preinst 2022-11-20 16:11:53.000000000 +0100 +++ opensysusers-0.7.3/debian/opensysusers.preinst 2023-11-07 08:35:14.000000000 +0100 @@ -7,10 +7,23 @@ fi if [ upgrade != "$1" ] || dpkg --compare-versions "$2" lt 0.6-1; then - dpkg-divert --package opensysusers --add --rename \ + dpkg-divert --package opensysusers --add --no-rename \ --divert /bin/systemd-sysusers.real /bin/systemd-sysusers fi +if [ upgrade != "$1" ] || dpkg --compare-versions "$2" lt 0.7.3-2.1~; then + dpkg-divert --package opensysusers --add --no-rename \ + --divert /usr/bin/systemd-sysusers.real /usr/bin/systemd-sysusers +fi + +if [ upgrade != "$1" ]; then + for f in /usr/bin/systemd-sysusers /bin/systemd-sysusers; do + if [ -e "$DPKG_ROOT$f" ] && ! [ -e "$DPKG_ROOT$f.real" ]; then + mv "$DPKG_ROOT$f" "$DPKG_ROOT$f.real" + fi + done +fi + #DEBHELPER# exit 0
diff --minimal -Nru opensysusers-0.7.3/debian/changelog opensysusers-0.7.3/debian/changelog --- opensysusers-0.7.3/debian/changelog 2022-11-20 16:18:16.000000000 +0100 +++ opensysusers-0.7.3/debian/changelog 2023-11-07 16:34:41.000000000 +0100 @@ -1,3 +1,10 @@ +opensysusers (0.7.3-2.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Declare Conflicts+Replaces systemd-sysusers. (Closes: #-1) + + -- Helmut Grohne <hel...@subdivi.de> Tue, 07 Nov 2023 16:34:41 +0100 + opensysusers (0.7.3-2) unstable; urgency=medium * d/preinst: remove -u option. diff --minimal -Nru opensysusers-0.7.3/debian/control opensysusers-0.7.3/debian/control --- opensysusers-0.7.3/debian/control 2022-11-20 16:11:31.000000000 +0100 +++ opensysusers-0.7.3/debian/control 2023-11-07 16:30:08.000000000 +0100 @@ -14,7 +14,9 @@ Homepage: https://github.com/cromerc/opensysusers.git Package: opensysusers +Conflicts: systemd-sysusers Provides: systemd-sysusers +Replaces: systemd-sysusers Architecture: all Depends: ${misc:Depends}, diff --minimal -Nru opensysusers-0.7.3/debian/opensysusers.postinst opensysusers-0.7.3/debian/opensysusers.postinst --- opensysusers-0.7.3/debian/opensysusers.postinst 1970-01-01 01:00:00.000000000 +0100 +++ opensysusers-0.7.3/debian/opensysusers.postinst 2023-11-07 16:33:50.000000000 +0100 @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e + +if [ "$1" = configure ] && dpkg --compare-versions "$2" lt-nl 0.7.3-2.1~; then + dpkg-divert --package opensysusers --remove --no-rename \ + --divert /bin/systemd-sysusers.real /bin/systemd-sysusers +fi + +#DEBHELPER# + +exit 0 diff --minimal -Nru opensysusers-0.7.3/debian/opensysusers.postrm opensysusers-0.7.3/debian/opensysusers.postrm --- opensysusers-0.7.3/debian/opensysusers.postrm 2022-11-20 16:15:39.000000000 +0100 +++ opensysusers-0.7.3/debian/opensysusers.postrm 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -#!/bin/sh - -set -e - -if [ "$1" = "remove" ] || [ "$1" = "abort-install" ] || [ "$1" = "disappear" ] ; then - dpkg-divert --package opensysusers --remove --rename \ - --divert /bin/systemd-sysusers.real /bin/systemd-sysusers -fi - -if [ "abort-upgrade" = "$1" ] && dpkg --compare-versions "$2" lt 0.6-1; then - dpkg-divert --package opensysusers --remove --rename \ - --divert /bin/systemd-sysusers.real /bin/systemd-sysusers -fi - -#DEBHELPER# - -exit 0 diff --minimal -Nru opensysusers-0.7.3/debian/opensysusers.preinst opensysusers-0.7.3/debian/opensysusers.preinst --- opensysusers-0.7.3/debian/opensysusers.preinst 2022-11-20 16:11:53.000000000 +0100 +++ opensysusers-0.7.3/debian/opensysusers.preinst 2023-11-07 16:30:39.000000000 +0100 @@ -6,11 +6,6 @@ update-alternatives --remove-all sysusers fi -if [ upgrade != "$1" ] || dpkg --compare-versions "$2" lt 0.6-1; then - dpkg-divert --package opensysusers --add --rename \ - --divert /bin/systemd-sysusers.real /bin/systemd-sysusers -fi - #DEBHELPER# exit 0