reassign 693472 emacsen-common 2.0.3
severity 693472 serious
reassign 694674 emacsen-common 2.0.3
reassign 694675 emacsen-common 2.0.3
forcemerge 693472 694674 694675
tags 693472 + patch
retitle 693472 emacsen-common: wrong compilation logic; only the last script in 
dependency chains is actually compiled
thanks

Dear Rob,

I found the cause of the problem (at least for devscripts-el and emms;
the case of speechd-el seems more complex). In short, the logic in
emacs-package-install is wrong: the $script variable is not updated in
the $pkg loop (see the attached debdiff which makes it obvious). Hence
dependency chains are not correctly handled, because it is always the
last script in the chain that is called.

BTW, I found another problem: when processing the dependency chain of a
package, all the dependencies are processed as being old-style
(respectively new-style) if the calling package is old-style
(respectively new-style). In particular, if emacsen-common is processed
in the dependency chain of an old-style package, it is called with
flavor "emacs", and this in turn creates disastrous self-referencing
symlinks under /etc/emacs (I got this behaviour when testing my patch
against emms). Hence I fixed emacsen-common.{install,remove} to do
nothing when called with flavor "emacs". Since there seem to be no other
new-style package in Wheezy, I think this workaround is sufficient for
now. But for Jessie you probably need to refactor the logic of
emacsen-package-install so that each install script of a dependency
chain is called the right way.

I checked that the attached patch fixes the upgrade path from lenny for
devscripts-el and emms, hence I merged back these bugs.

I can do an NMU of the package, but of course a review is very much
welcome.

Cheers,

-- 
 .''`.    Sébastien Villemot
: :' :    Debian Developer
`. `'     http://www.dynare.org/sebastien
  `-      GPG Key: 4096R/381A7594

diff -Nru emacsen-common-2.0.3/debian/changelog emacsen-common-2.0.3+nmu1/debian/changelog
--- emacsen-common-2.0.3/debian/changelog	2012-05-23 05:55:35.000000000 +0200
+++ emacsen-common-2.0.3+nmu1/debian/changelog	2012-12-08 23:10:21.000000000 +0100
@@ -1,3 +1,14 @@
+emacsen-common (2.0.3+nmu1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * debian/emacs-package-install: fix compilation logic. Only the last
+    script in the dependency list was actually compiled. (Closes: #693472)
+  * debian/emacsen-common.{install,remove}: don't mess up everything when
+    called with flavor "emacs" (this can happen if emacsen-common is handled
+    as part of the dependency list of an old-style package)
+
+ -- Sébastien Villemot <sebast...@debian.org>  Sat, 08 Dec 2012 22:24:41 +0100
+
 emacsen-common (2.0.3) unstable; urgency=low
 
   * Move #DEBHEPLER# up in the postinst to avoid an emacs complaint about
diff -Nru emacsen-common-2.0.3/emacsen-common.install emacsen-common-2.0.3+nmu1/emacsen-common.install
--- emacsen-common-2.0.3/emacsen-common.install	2012-05-13 21:13:01.000000000 +0200
+++ emacsen-common-2.0.3+nmu1/emacsen-common.install	2012-12-08 23:07:09.000000000 +0100
@@ -3,6 +3,11 @@
 set -e
 
 FLAVOR=$1
+
+if [ "$FLAVOR" = "emacs" ]; then
+    exit 0
+fi
+
 # Make sure these options are appropriate for the given package.
 compile_options="--no-init-file --no-site-file -batch -f batch-byte-compile"
 
diff -Nru emacsen-common-2.0.3/emacsen-common.remove emacsen-common-2.0.3+nmu1/emacsen-common.remove
--- emacsen-common-2.0.3/emacsen-common.remove	2012-05-13 21:12:56.000000000 +0200
+++ emacsen-common-2.0.3+nmu1/emacsen-common.remove	2012-12-08 23:06:57.000000000 +0100
@@ -4,6 +4,10 @@
 
 FLAVOR=$1
 
+if [ "$FLAVOR" = "emacs" ]; then
+    exit 0
+fi
+
 echo emacsen-common: Handling removal of emacsen flavor ${FLAVOR}
 
 rm -f \
diff -Nru emacsen-common-2.0.3/emacs-package-install emacsen-common-2.0.3+nmu1/emacs-package-install
--- emacsen-common-2.0.3/emacs-package-install	2012-05-23 05:13:36.000000000 +0200
+++ emacsen-common-2.0.3+nmu1/emacs-package-install	2012-12-08 22:23:34.000000000 +0100
@@ -63,12 +63,12 @@
 # Get all the packages $pkg depends on, dependency sorted.
 my @pkgs_to_handle = generate_add_on_install_list([$pkg]);
 my @installed_flavors = get_installed_flavors();
-my $script = $lib_dir . "/packages/install/$pkg";
 
 if(!$invoked_by_old_pkg)
 {
   foreach my $pkg (@pkgs_to_handle)
   {
+    my $script = $lib_dir . "/packages/install/$pkg";
     foreach my $flavor (@installed_flavors)
     {
       print "Install $pkg for $flavor\n";
@@ -84,6 +84,7 @@
 {
   foreach my $pkg (@pkgs_to_handle)
   {
+    my $script = $lib_dir . "/packages/install/$pkg";
     print "Install $pkg for emacs\n";
     ex($script, 'emacs', @installed_flavors) if -e $script;
 

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to