tags 867020 + confirmed patch pending
thanks
>>>>>  AB == Andreas Beckmann [2017-7-3]

AB> Package: auctex
AB> Version: 11.90-1
AB> Severity: serious
AB> User: debian...@lists.debian.org
AB> Usertags: piuparts

AB> Hi,

AB> during a test with piuparts I noticed your package fails to remove.

>> From the attached log (scroll to the bottom...):

AB> Removing auctex (11.90-1) ...
AB> Remove auctex for emacs25
AB> auctex/remove: Removing parsed (La)TeX macros for emacs25...rm: cannot 
remove '/var/lib/auctex/emacs25': Directory not empty
AB> ERROR: remove script from auctex package failed
AB> dpkg: error processing package auctex (--remove):
AB> subprocess installed pre-removal script returned error exit status 1

AB> This was observed during a test of stretch, i386, --install-recommends.

Hi Andreas,

thanks for the report; I can confirm it.

I think I found the cause.  At installation time the auctex package
starts in background (per default) the script udpate-auctex-elisp, which
keeps running for some time after installation writing files in
/var/lib/auctex/${emacsen-flavor} as part of its job.  During piuparts
tests the package gets removed before update-auctex-elisp has got the
chance to finish, so that when the package emacsen remove script invoke
the "rm --recursive --force /var/lib/auctex/emacs25" command
update-auctex-elisp still writes files in that directory.  Thus it may
happen, as far as I can undestand, that rm fails due to the non
atomicity of its non empty directory removal operations, because
update-auctex-elisp may create a new file after rm thinks it has removed
all of the directory files and before rm tries and removes the
directory, resulting in rm trying to unlink a non empty directory.

If my analysis is correct, this bug is unlikely to manifest itself
during normal operations, since it can only happen if auctex gets
removed shortly after its installation.

The solution I'm evaluating is to kill running update-auctex-elisp
instances before invoking "rm --recursive --force
/var/lib/auctex/${emacsen-flavor}" in auctex emacsen remove script.
Since "update-auctex-elisp" should be a rather distinct and private
process name, I think I will do it with something along the lines of
"pkill -f update-auctex-elisp", as in the patch attached.

--
Thanks,
Davide
>From 0dd8709b456afa76f1d73d79da3e02a48fd6cc27 Mon Sep 17 00:00:00 2001
From: "Davide G. M. Salvetti" <sa...@debian.org>
Date: Sat, 12 Aug 2017 00:46:05 +0200
Subject: [PATCH] Kill update-auctex-elisp instances at package remove time

* debian/auctex.emacsen-remove.eperl: When the package is being removed,
  take care of killing any running update-auctex-elisp instance before
  removing parsed macro caches in /var/lib/auctex/$FLAVOR.

* debian/control (auctex/Depends): Add procps, needed for pgrep and pkill
  used above.

Closes: #867020
---
 debian/auctex.emacsen-remove.eperl | 9 +++++++++
 debian/control                     | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/debian/auctex.emacsen-remove.eperl b/debian/auctex.emacsen-remove.eperl
index 79bf23294..c4adebc3e 100644
--- a/debian/auctex.emacsen-remove.eperl
+++ b/debian/auctex.emacsen-remove.eperl
@@ -36,6 +36,15 @@ undo_install () {
 }
 
 undo_update_auctex_elisp () {
+    <: # Take care of running update-auctex-elisp instances :>//
+    while pgrep -f update-auctex-elisp >/dev/null; do
+	echo -n "${PROGNAME}:" \
+	     "Killing $(pgrep -fc update-auctex-elisp) running" \
+	     "update-auctex-elisp instance(s)..."
+	pkill -f update-auctex-elisp || true
+	sleep 1
+	echo 'done.'
+    done
     echo -n "${PROGNAME}:" \
 	"Removing parsed (La)TeX macros for ${FLAVOR}..."
     rm --recursive --force /var/lib/auctex/${FLAVOR}
diff --git a/debian/control b/debian/control
index d2489bb4c..b052b11af 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Vcs-Git: https://anonscm.debian.org/git/users/salve/auctex.git
 
 Package: auctex
 Architecture: all
-Depends: emacs25 | emacs24 | emacs-snapshot, emacsen-common (>= 2.0.8), preview-latex-style, ${misc:Depends}
+Depends: emacs25 | emacs24 | emacs-snapshot, emacsen-common (>= 2.0.8), preview-latex-style, procps, ${misc:Depends}
 Recommends: ghostscript, texlive-latex-recommended, xpdf | evince | evince-gtk | okular
 Suggests: catdvi, dvipng, lacheck
 Breaks: emacspeak (<= 17.0-1)
-- 
2.11.0

Reply via email to