Bug#867020: auctex: fails to remove: auctex/remove: Removing parsed (La)TeX macros for emacs25...rm: cannot remove '/var/lib/auctex/emacs25': Directory not empty

2019-06-15 Thread Andreas Beckmann
Control: severity -1 important

On Sat, 12 Aug 2017 11:50:54 +0200 Andreas Beckmann  wrote:
> On 2017-08-12 11:32, Davide G. M. Salvetti wrote:
> > Running it in foreground is a debconf low priority user choice.  It does
> 
> Even better. I can preseed this in piuparts.

Which worked fine for me, thus lowering the severity.


Andreas



Bug#867020: auctex: fails to remove: auctex/remove: Removing parsed (La)TeX macros for emacs25...rm: cannot remove '/var/lib/auctex/emacs25': Directory not empty

2017-08-12 Thread Andreas Beckmann
On 2017-08-12 11:32, Davide G. M. Salvetti wrote:
> Running it in foreground is a debconf low priority user choice.  It does

Even better. I can preseed this in piuparts.


Andreas



Bug#867020: auctex: fails to remove: auctex/remove: Removing parsed (La)TeX macros for emacs25...rm: cannot remove '/var/lib/auctex/emacs25': Directory not empty

2017-08-12 Thread Davide G. M. Salvetti
>  AB == Andreas Beckmann [2017-8-12]

AB> On 2017-08-12 02:43, Davide G. M. Salvetti wrote:
>> 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

AB> If you write "per default", it there some way to change that behavior?

Running it in foreground is a debconf low priority user choice.  It does
still take some minutes today on a typical desktop machine (used to be
tens of minutes some years ago), so that it runs in background by
default.

AB> How long does it take? Or could it just be run in the foreground per
AB> default?
AB> I could just add some sleep for that package in piuparts... wouldn't be
AB> the first time.

Thanks, thinking about it however I feel that killing running
update-auctex-elisp instances if any at package remove time is indeed
the right thing to do.  I will think some more on the proper way to kill
them before uploading a bug fix.

-- 
Pace e bene,
Davide



Bug#867020: auctex: fails to remove: auctex/remove: Removing parsed (La)TeX macros for emacs25...rm: cannot remove '/var/lib/auctex/emacs25': Directory not empty

2017-08-12 Thread Andreas Beckmann
On 2017-08-12 02:43, Davide G. M. Salvetti wrote:
> 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

If you write "per default", it there some way to change that behavior?
How long does it take? Or could it just be run in the foreground per
default?
I could just add some sleep for that package in piuparts... wouldn't be
the first time.

Andreas



Bug#867020: auctex: fails to remove: auctex/remove: Removing parsed (La)TeX macros for emacs25...rm: cannot remove '/var/lib/auctex/emacs25': Directory not empty

2017-08-11 Thread Davide G. M. Salvetti
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" 
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



Bug#867020: auctex: fails to remove: auctex/remove: Removing parsed (La)TeX macros for emacs25...rm: cannot remove '/var/lib/auctex/emacs25': Directory not empty

2017-07-03 Thread Andreas Beckmann
Followup-For: Bug #867020

Forgot to attach the logfile ...

Andreas


auctex_11.90-1.log.gz
Description: application/gzip


Bug#867020: auctex: fails to remove: auctex/remove: Removing parsed (La)TeX macros for emacs25...rm: cannot remove '/var/lib/auctex/emacs25': Directory not empty

2017-07-03 Thread Andreas Beckmann
Package: auctex
Version: 11.90-1
Severity: serious
User: debian...@lists.debian.org
Usertags: piuparts

Hi,

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

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

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


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


cheers,

Andreas