Bug#1107334: unblock: emacsen-common/3.0.8
Package: release.debian.org
Severity: normal
X-Debbugs-Cc: emacsen-common@packages.debian.org
Control: affects -1 + src:emacsen-common
User: release.debian.org@packages.debian.org
Usertags: unblock
Please unblock package emacsen-common
When emacsen-common and emacs add-ons (e.g. elpa-haskell-mode,
elpa-magit, etc.) are upgrading simultaneously, emacsen-common can be
unpacked but not configured when the add-on's prerm runs. That causes
the add-on's removal command to be skipped, which can cause the upgrade
to fail. emacsen-common 3.0.8 includes a mitigation for this. (Fixing
the issues more thoroughly has been planned for Forky for a while, but
was (and is) considered too disruptive for Trixie.)
The concrete failure that prompted the current change is
https://bugs.debian.org/1106291
Xiyue Deng has tested the changes, verifying that they resolve the
problem.
unblock emacsen-common/3.0.8
diff -Nru emacsen-common-3.0.7/debian/changelog emacsen-common-3.0.8/debian/changelog
--- emacsen-common-3.0.7/debian/changelog 2025-03-20 14:44:30.000000000 -0500
+++ emacsen-common-3.0.8/debian/changelog 2025-06-03 12:17:26.000000000 -0500
@@ -1,3 +1,20 @@
+emacsen-common (3.0.8) unstable; urgency=medium
+
+ [ Rob Browning ]
+ * debian/changelog: correct lexical-binding warning info.
+ Thanks to Sean Whitton for reporting the issue.
+
+ [ Xiyue Deng ]
+ * When emacsen-common and add-ons are upgrading simultaneously,
+ aemacsen-common can be unpacked but not configured when an add-on's
+ prerm runs. That causes the add-on's removal command to be skipped,
+ which can cause the upgrade to fail. As a mitigation for now, remove
+ all installed emacs flavors in the preinst, keeping track of the fact
+ that they're really still installed, and then restore them from the
+ postinst, when emacsen-common is ready again. (Closes: #1106291)
+
+ -- Rob Browning <rlb@defaultvalue.org> Tue, 03 Jun 2025 12:17:26 -0500
+
emacsen-common (3.0.7) unstable; urgency=medium
* debian/copyright: migrate to DEP-5 (machine readable) format.
@@ -9,10 +26,9 @@
[ Rob Browning ]
* debian-startup.el: set lexical-binding to t to silence warnings.
- Emacs now defaults to lexical-binding and warns when a file doesn't
- explicitly specify what it expects.Thanks to Jörg-Volker Peetz, Xiyue
- Deng, Dan Jacobson, and Paul Wise for reporting the issue.
- (Closes: 1099506)
+ Emacs now warns when a file doesn't specify what it expects. Thanks to
+ Jörg-Volker Peetz, Xiyue Deng, Dan Jacobson, and Paul Wise for
+ reporting the issue. (Closes: 1099506)
* The code now exits with 2 rather than 1 for errors, reserving 1 for
"boolean true" (i.e. like grep).
diff -Nru emacsen-common-3.0.7/debian/postinst emacsen-common-3.0.8/debian/postinst
--- emacsen-common-3.0.7/debian/postinst 2018-05-13 12:12:56.000000000 -0500
+++ emacsen-common-3.0.8/debian/postinst 2025-06-03 12:17:26.000000000 -0500
@@ -14,4 +14,17 @@
/usr/lib/emacsen-common/emacs-package-install --postinst emacsen-common
+# Reinstall all flavors during upgrade. See the comments in the
+# preinst and https://bugs.debian.org/1106291
+
+for flavor in /var/lib/emacsen-common/state/flavor/pending/*[!~]; do
+ case "$flavor" in
+ */pending/\**) break ;; # no flavors
+ esac
+ flavor="$(basename "$flavor")"
+ echo "Reinstalling emacsen flavor $flavor after emacsen-common upgrade" 1>&2
+ /usr/lib/emacsen-common/emacs-install "$flavor"
+ rm "/var/lib/emacsen-common/state/flavor/pending/$flavor"
+done
+
#DEBHELPER#
diff -Nru emacsen-common-3.0.7/debian/preinst emacsen-common-3.0.8/debian/preinst
--- emacsen-common-3.0.7/debian/preinst 2014-05-21 15:28:10.000000000 -0500
+++ emacsen-common-3.0.8/debian/preinst 2025-06-03 12:17:26.000000000 -0500
@@ -2,6 +2,35 @@
set -e
+# When emacsen-common and add-ons are upgrading simultaneously,
+# emacsen-common can be unpacked but not configured when an add-on's
+# prerm runs. That causes the add-on's removal command to be skipped,
+# which is wrong and can cause the upgrade to fail. For example
+# https://bugs.debian.org/1106291
+#
+# For now, to ensure the removal commands are still run, remove all
+# emacs flavors here, keeping track of which flavors are actually
+# still installed in pending, and then restore them from the postinst,
+# when emacsen-common is ready again.
+#
+# Normally, it would be unsafe to depend on emacsen-common files like
+# this in the preinst, but our assumption for this mitigation is that
+# since emacs flavors depend on emacsen-common and since they should
+# have a installed/FLAVOR file if and only if they're "ready to go"
+# (i.e. via their postinst configure), then the emacs-remove script
+# will be available inside the loop.
+
+mkdir -p /var/lib/emacsen-common/state/flavor/pending
+for flavor in /var/lib/emacsen-common/state/flavor/installed/*[!~]; do
+ case "$flavor" in
+ */installed/\**) break ;; # no flavors
+ esac
+ flavor="$(basename "$flavor")"
+ echo "Removing emacsen flavor $flavor during emacsen-common upgrade" 1>&2
+ /usr/lib/emacsen-common/emacs-remove "$flavor"
+ touch "/var/lib/emacsen-common/state/flavor/pending/$flavor"
+done
+
# The emacsen-common package is a special case; we can't call
# emacs-package-install from here since the new version hasn't been
# unpacked yet, so just do the important bit that it would have done.
diff -Nru emacsen-common-3.0.7/debian/prerm emacsen-common-3.0.8/debian/prerm
--- emacsen-common-3.0.7/debian/prerm 2014-05-21 15:28:10.000000000 -0500
+++ emacsen-common-3.0.8/debian/prerm 2025-06-03 12:17:26.000000000 -0500
@@ -4,4 +4,6 @@
/usr/lib/emacsen-common/emacs-package-remove --prerm emacsen-common
+rm -rf /var/lib/emacsen-common/state/flavor/pending
+
#DEBHELPER#
diff -Nru emacsen-common-3.0.7/emacs-install emacsen-common-3.0.8/emacs-install
--- emacsen-common-3.0.7/emacs-install 2025-03-18 20:16:59.000000000 -0500
+++ emacsen-common-3.0.8/emacs-install 2025-06-03 12:17:26.000000000 -0500
@@ -79,6 +79,10 @@
}
else # Old-style package.
{
+ # We've completely ignored
+ # /var/lib/emacsen-common/state/flavor/pending/ here (whether it's
+ # relevant or not) because old style packages should be irrelevant
+ # now.
$failed = -e $script && (system($script, $flavor, @installed_flavors) != 0);
}
if($failed)
diff -Nru emacsen-common-3.0.7/emacs-remove emacsen-common-3.0.8/emacs-remove
--- emacsen-common-3.0.7/emacs-remove 2025-03-18 20:16:59.000000000 -0500
+++ emacsen-common-3.0.8/emacs-remove 2025-06-03 12:17:26.000000000 -0500
@@ -58,6 +58,10 @@
}
else # Old-style package.
{
+ # We've completely ignored
+ # /var/lib/emacsen-common/state/flavor/pending/ here (whether it's
+ # relevant or not) because old style packages should be irrelevant
+ # now.
$failed = -e $script && (system($script, $flavor, @installed_flavors) != 0);
}
if($failed)
@@ -67,6 +71,10 @@
}
}
+my $pending_flavor = "/var/lib/emacsen-common/state/flavor/pending/$flavor";
+die "ERROR: cannot unlink $pending_flavor: $!, "
+ unless (unlink($pending_flavor) or $!{ENOENT});
+
# Silence "single use" warning.
$::installed_flavor_state_dir = $::installed_flavor_state_dir;
Thanks
--
Rob Browning
rlb @defaultvalue.org and @debian.org
GPG as of 2011-07-10 E6A9 DA3C C9FD 1FF8 C676 D2C4 C0F0 39E9 ED1B 597A
GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4
Reply to: