On Tue, 2021-04-13 at 17:58:08 +0200, Guillem Jover wrote: > On Tue, 2021-04-13 at 15:36:08 +0200, Ivo De Decker wrote: > > Please go ahead with the upload and remove the moreinfo tag from this bug > > when > > the new version is in unstable. > > Thanks! I'm targeting an upload for later today, but I was thinking I > might try to quickly produce a tiny functional test for the > auto-deconfigure bug. I'll update the report once I get that, and I > could hold the upload until you approve that, but I'm not sure that's > worth the round-trip, given that it's a test? :)
Ok, this was actually trivial, as it was pretty much like the existing t-breaks test case but with Protected/Essential:yes added to the broken packages. Attached updated patch, including test case and ref. Thanks, Guillem
From a57b563c247f7c8025bc1e33713325452dabd2d7 Mon Sep 17 00:00:00 2001 From: Guillem Jover <guil...@debian.org> Date: Mon, 22 Feb 2021 18:12:18 +0100 Subject: [PATCH] dpkg: Fix --auto-deconfigure for essential and protected during installation Only apply the --force-remove-essential and --force-remove-protected during package removals, which can only happen due to Conflicts, otherwise we cannot solve auto-deconfigurations due to Breaks on essential or protected packages during installations or upgrades. This is a regression when the Breaks field got introduced, as the same function that had been used for Conflicts was refactored to be used for Breaks, but without taking into account the removal case. Fixes: commit b301c0e71a5314bb4560111c6cf1602269f6f672 Reported-by: Julian Andres Klode <j...@debian.org> Ref: #983014 --- src/archives.c | 4 ++-- tests/Makefile | 2 ++ tests/t-breaks-essential/Makefile | 13 +++++++++++++ tests/t-breaks-essential/lib-a-0/DEBIAN/control | 8 ++++++++ tests/t-breaks-essential/lib-a-1/DEBIAN/control | 8 ++++++++ tests/t-breaks-essential/pkg-b/DEBIAN/control | 8 ++++++++ tests/t-breaks-protected/Makefile | 13 +++++++++++++ tests/t-breaks-protected/lib-a-0/DEBIAN/control | 8 ++++++++ tests/t-breaks-protected/lib-a-1/DEBIAN/control | 8 ++++++++ tests/t-breaks-protected/pkg-b/DEBIAN/control | 8 ++++++++ 10 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 tests/t-breaks-essential/Makefile create mode 100644 tests/t-breaks-essential/lib-a-0/DEBIAN/control create mode 100644 tests/t-breaks-essential/lib-a-1/DEBIAN/control create mode 100644 tests/t-breaks-essential/pkg-b/DEBIAN/control create mode 100644 tests/t-breaks-protected/Makefile create mode 100644 tests/t-breaks-protected/lib-a-0/DEBIAN/control create mode 100644 tests/t-breaks-protected/lib-a-1/DEBIAN/control create mode 100644 tests/t-breaks-protected/pkg-b/DEBIAN/control diff --git a/src/archives.c b/src/archives.c index 96079ab1f..aa56e9e9c 100644 --- a/src/archives.c +++ b/src/archives.c @@ -1239,7 +1239,7 @@ try_deconfigure_can(bool (*force_p)(struct deppossi *), struct pkginfo *pkg, warning(_("ignoring dependency problem with %s:\n%s"), action, why); return 2; } else if (f_autodeconf) { - if (pkg->installed.essential) { + if (removal && pkg->installed.essential) { if (in_force(FORCE_REMOVE_ESSENTIAL)) { warning(_("considering deconfiguration of essential\n" " package %s, to enable %s"), @@ -1251,7 +1251,7 @@ try_deconfigure_can(bool (*force_p)(struct deppossi *), struct pkginfo *pkg, return 0; } } - if (pkg->installed.is_protected) { + if (removal && pkg->installed.is_protected) { if (in_force(FORCE_REMOVE_PROTECTED)) { warning(_("considering deconfiguration of protected\n" " package %s, to enable %s"), diff --git a/tests/Makefile b/tests/Makefile index 6a52e50e2..3b885f04e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -53,6 +53,8 @@ TESTS_PASS += t-provides-self TESTS_PASS += t-provides-arch-implicit TESTS_PASS += t-provides-arch-qualified TESTS_PASS += t-breaks +TESTS_PASS += t-breaks-protected +TESTS_PASS += t-breaks-essential TESTS_PASS += t-conflicts TESTS_PASS += t-conflict-provide-replace-real TESTS_PASS += t-conflict-provide-replace-virtual diff --git a/tests/t-breaks-essential/Makefile b/tests/t-breaks-essential/Makefile new file mode 100644 index 000000000..ace63f0ef --- /dev/null +++ b/tests/t-breaks-essential/Makefile @@ -0,0 +1,13 @@ +TESTS_DEB := lib-a-0 lib-a-1 pkg-b + +include ../Test.mk + +DPKG_OPTIONS += --auto-deconfigure + +test-case: + $(DPKG_INSTALL) lib-a-0.deb + $(DPKG_INSTALL) pkg-b.deb lib-a-1.deb + +test-clean: + $(DPKG_PURGE) pkg-b + $(DPKG_PURGE) --force-remove-essential lib-a diff --git a/tests/t-breaks-essential/lib-a-0/DEBIAN/control b/tests/t-breaks-essential/lib-a-0/DEBIAN/control new file mode 100644 index 000000000..7643fd86b --- /dev/null +++ b/tests/t-breaks-essential/lib-a-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-d...@lists.debian.org> +Architecture: all +Essential: yes +Description: test package - broken package diff --git a/tests/t-breaks-essential/lib-a-1/DEBIAN/control b/tests/t-breaks-essential/lib-a-1/DEBIAN/control new file mode 100644 index 000000000..5c37c036c --- /dev/null +++ b/tests/t-breaks-essential/lib-a-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-a +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-d...@lists.debian.org> +Architecture: all +Essential: yes +Description: test package - broken package diff --git a/tests/t-breaks-essential/pkg-b/DEBIAN/control b/tests/t-breaks-essential/pkg-b/DEBIAN/control new file mode 100644 index 000000000..c0da700ab --- /dev/null +++ b/tests/t-breaks-essential/pkg-b/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-d...@lists.debian.org> +Architecture: all +Breaks: lib-a (<< 1) +Description: test package - breaking package diff --git a/tests/t-breaks-protected/Makefile b/tests/t-breaks-protected/Makefile new file mode 100644 index 000000000..3f85436e6 --- /dev/null +++ b/tests/t-breaks-protected/Makefile @@ -0,0 +1,13 @@ +TESTS_DEB := lib-a-0 lib-a-1 pkg-b + +include ../Test.mk + +DPKG_OPTIONS += --auto-deconfigure + +test-case: + $(DPKG_INSTALL) lib-a-0.deb + $(DPKG_INSTALL) pkg-b.deb lib-a-1.deb + +test-clean: + $(DPKG_PURGE) pkg-b + $(DPKG_PURGE) --force-remove-protected lib-a diff --git a/tests/t-breaks-protected/lib-a-0/DEBIAN/control b/tests/t-breaks-protected/lib-a-0/DEBIAN/control new file mode 100644 index 000000000..7ca516e75 --- /dev/null +++ b/tests/t-breaks-protected/lib-a-0/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-a +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-d...@lists.debian.org> +Architecture: all +Protected: yes +Description: test package - broken package diff --git a/tests/t-breaks-protected/lib-a-1/DEBIAN/control b/tests/t-breaks-protected/lib-a-1/DEBIAN/control new file mode 100644 index 000000000..132031814 --- /dev/null +++ b/tests/t-breaks-protected/lib-a-1/DEBIAN/control @@ -0,0 +1,8 @@ +Package: lib-a +Version: 1 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-d...@lists.debian.org> +Architecture: all +Protected: yes +Description: test package - broken package diff --git a/tests/t-breaks-protected/pkg-b/DEBIAN/control b/tests/t-breaks-protected/pkg-b/DEBIAN/control new file mode 100644 index 000000000..c0da700ab --- /dev/null +++ b/tests/t-breaks-protected/pkg-b/DEBIAN/control @@ -0,0 +1,8 @@ +Package: pkg-b +Version: 0 +Section: test +Priority: extra +Maintainer: Dpkg Developers <debian-d...@lists.debian.org> +Architecture: all +Breaks: lib-a (<< 1) +Description: test package - breaking package -- 2.31.0