Bug#413397: ifcico: purging the package fails (update-inetd unavailable)

2007-03-18 Thread Steve Langasek
tags 413397 -patch
thanks

The suggested patch is flawed.  There's no reason to limit update-inetd's
actions to cases when the postinst is called with 'configure'; the other
options for postinst are abort-upgrade, abort-remove, and abort-deconfigure,
and if the removal commands are going to be moved from postrm to prerm, then
the --add command needs to be invoked for *every* call of the postinst.

Now, if the removal /is/ done in the prerm, then without any changes to the
postinst we get as a bonus the fix that 'dpkg-reconfigure ifcico' no longer
generates an extra, commented-out entry every time it's called.  The
postinst is still not idempotent, though; if for any reason the postinst
should fail partway through, calling it again is going to create extra
commented-out entries for these services, because the postinst will comment
out the newly added entries from the /previous/ run and then proceed to add
new uncommented ones.

OTOH, there's the question of whether services should be stopped/disabled in
the prerm.  Doing so effectively means that any changes the local admin
makes to the inetd line will be lost on every package upgrade, which is not
desirable.

So the only way to preserve such changes reliably is to treat them the same
as conffiles: only install the entry on initial install of the package, only
remove the entry on package purge.  (Removing the entry on package removal
is insufficient unless we pre-depend on update-inetd, because the postinst
can't distinguish between an upgrade of the package and an install from
config-files state, so install-remove-install would leave the user without
inetd.conf entries.)

The attached patch therefore implements this last logic.  I'm leaving the
patch tag off for now, though; I'm not 100% happy with this solution because
it leaves the record in place and enabled on package removal.  It's possible
that a two-stage process, disable/enable vs. add/remove, would give better
results, but I need to think on that some more since there don't seem to be
any good examples of update-inetd use running around anywhere. :/  Anyway,
the attached patch would at least be an improvement over the current state
of affairs (IMHO) and resolve the RC bug, so Marco, feel free to use it if
you want it, I just won't NMU with this particular iteration.

-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
[EMAIL PROTECTED]   http://www.debian.org/
diff -u ifmail-2.14tx8.10/debian/ifcico.postinst ifmail-2.14tx8.10/debian/ifcico.postinst
--- ifmail-2.14tx8.10/debian/ifcico.postinst
+++ ifmail-2.14tx8.10/debian/ifcico.postinst
@@ -1,9 +1,11 @@
 #!/bin/sh -e
 
-update-inetd --comment-chars #disabled# --disable tfido
-update-inetd --group OTHER --add tfido		stream	tcp	nowait	ftn	/usr/sbin/tcpd	/usr/lib/ifmail/ifcico -r 0 -t
-update-inetd --comment-chars #disabled# --disable fido
-update-inetd --group OTHER --add fido		stream	tcp	nowait  ftn	/usr/sbin/tcpd	/usr/lib/ifmail/ifcico -r 0
+if [ $1 = configure ]  [ -z $2 ]; then
+	update-inetd --comment-chars #disabled# --disable tfido
+	update-inetd --group OTHER --add tfido		stream	tcp	nowait	ftn	/usr/sbin/tcpd	/usr/lib/ifmail/ifcico -r 0 -t
+	update-inetd --comment-chars #disabled# --disable fido
+	update-inetd --group OTHER --add fido		stream	tcp	nowait  ftn	/usr/sbin/tcpd	/usr/lib/ifmail/ifcico -r 0
+fi
 
 #DEBHELPER#
 
diff -u ifmail-2.14tx8.10/debian/changelog ifmail-2.14tx8.10/debian/changelog
--- ifmail-2.14tx8.10/debian/changelog
+++ ifmail-2.14tx8.10/debian/changelog
@@ -1,3 +1,13 @@
+ifmail (2.14tx8.10-19.2) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * High-urgency upload for RC bugfix.
+  * Add missing dependency on update-inetd to ifcico, and fix the 
+maintainer script handling to only add entries on a new install and 
+only remove them on purge.  Closes: #413397.
+
+ -- Steve Langasek [EMAIL PROTECTED]  Sun, 18 Mar 2007 01:42:26 -0700
+
 ifmail (2.14tx8.10-19.1) unstable; urgency=high
 
   * Non-maintainer upload.
diff -u ifmail-2.14tx8.10/debian/control ifmail-2.14tx8.10/debian/control
--- ifmail-2.14tx8.10/debian/control
+++ ifmail-2.14tx8.10/debian/control
@@ -23,7 +23,7 @@
 
 Package: ifcico
 Architecture: any
-Depends: ${shlibs:Depends}, ifmail
+Depends: ${shlibs:Depends}, ifmail, update-inetd
 Conflicts: suidmanager ( 0.50)
 Description: Fidonet Technology transport package
  Ifcico is a FidoTech mailer for connecting to other nodes via the phone
diff -u ifmail-2.14tx8.10/debian/ifcico.postrm ifmail-2.14tx8.10/debian/ifcico.postrm
--- ifmail-2.14tx8.10/debian/ifcico.postrm
+++ ifmail-2.14tx8.10/debian/ifcico.postrm
@@ -1,11 +1,10 @@
 #!/bin/sh -e
 
-update-inetd --remove ^tfido
-update-inetd --comment-chars #disabled# --enable tfido
-update-inetd --remove ^fido
-update-inetd --comment-chars #disabled# --enable fido
-
 if [ $1 = purge ]; then
+  update-inetd --remove 

Bug#413397: ifcico: purging the package fails (update-inetd unavailable)

2007-03-18 Thread Steve Langasek
tags 413397 patch
thanks

Hi Marco,

Ok, the attached patch has the following properties:

- local admin changes are preserved by only removing the entry on package
  purge
- we assume (with reason) that if update-inetd is not present, we're no
  longer responsible for removing any entries from inetd.conf
- the service is disabled on postrm remove.
- the service is /also/ disabled if postrm is called with any other options,
  with unconditional enabling in the postinst; this has the effect of making
  the current version of the package wholly responsible for
  enabling/disabling the service, so that any future version of the package
  which drops support for these particular ports doesn't have to bear the
  responsibility of cleaning up and/or re-adding the service in the event of
  a failed upgrade. (It should, however, still take responsibility for the
  purge handling.)
- by using the postrm instead of the prerm, downtime for the service during
  upgrade is kept to a bare mininum within the above constraints.
- the --comment-chars handling for any pre-existing entries for this service
  is preserved; between this and the use of postrm instead of prerm for the
  disabling, this means that the postinst is *not* idempotent with respect
  to dpkg-reconfigure (which calls prerm and postinst only), dpkg -B, or
  failures later in the postinst.

This is not what I would consider ideal update-inetd handling, but it fixes
all of the overt bugs and retains the status quo where any tradeoffs are
concerned.  If it were up to me, I would do away with the special handling
of pre-existing tfido/fido entries in inetd.conf since it seems pretty
improbable to me that a user would have some other version of this service
running, and that would immediately remove all of the idempotency concerns
here.  But I don't think that's a change I should make in an NMU here -- and
as I plan to NMU shortly with this patch, there you have it. :)

-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
[EMAIL PROTECTED]   http://www.debian.org/
diff -u ifmail-2.14tx8.10/debian/changelog ifmail-2.14tx8.10/debian/changelog
--- ifmail-2.14tx8.10/debian/changelog
+++ ifmail-2.14tx8.10/debian/changelog
@@ -1,3 +1,13 @@
+ifmail (2.14tx8.10-19.2) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * High-urgency upload for RC bugfix.
+  * Add missing dependency on update-inetd to ifcico, and fix the 
+maintainer script handling to only add entries on a new install and 
+only remove them on purge.  Closes: #413397.
+
+ -- Steve Langasek [EMAIL PROTECTED]  Sun, 18 Mar 2007 01:42:26 -0700
+
 ifmail (2.14tx8.10-19.1) unstable; urgency=high
 
   * Non-maintainer upload.
diff -u ifmail-2.14tx8.10/debian/control ifmail-2.14tx8.10/debian/control
--- ifmail-2.14tx8.10/debian/control
+++ ifmail-2.14tx8.10/debian/control
@@ -23,7 +23,7 @@
 
 Package: ifcico
 Architecture: any
-Depends: ${shlibs:Depends}, ifmail
+Depends: ${shlibs:Depends}, ifmail, update-inetd
 Conflicts: suidmanager ( 0.50)
 Description: Fidonet Technology transport package
  Ifcico is a FidoTech mailer for connecting to other nodes via the phone
diff -u ifmail-2.14tx8.10/debian/ifcico.postrm ifmail-2.14tx8.10/debian/ifcico.postrm
--- ifmail-2.14tx8.10/debian/ifcico.postrm
+++ ifmail-2.14tx8.10/debian/ifcico.postrm
@@ -1,13 +1,17 @@
 #!/bin/sh -e
 
-update-inetd --remove ^tfido
-update-inetd --comment-chars #disabled# --enable tfido
-update-inetd --remove ^fido
-update-inetd --comment-chars #disabled# --enable fido
-
 if [ $1 = purge ]; then
+  if which update-inetd /dev/null 21; then
+update-inetd --remove ^tfido.*/usr/lib/ifmail/ifcico
+update-inetd --comment-chars #disabled# --enable tfido
+update-inetd --remove ^fido.*/usr/lib/ifmail/ifcico
+update-inetd --comment-chars #disabled# --enable fido
+  fi
   rm -rf /var/spool/ftn/nl.d/index.dir \
   /var/spool/ftn/nl.d/index.pag  /dev/null
+else if which update-inetd /dev/null 21; then
+  update-inetd --disable ^tfido.*/usr/lib/ifmail/ifcico
+  update-inetd --disable ^fido.*/usr/lib/ifmail/ifcico
 fi
 
 #DEBHELPER#


Bug#413397: ifcico: purging the package fails (update-inetd unavailable)

2007-03-18 Thread Steve Langasek
On Sun, Mar 18, 2007 at 06:21:28PM -0700, Steve Langasek wrote:
 tags 413397 patch
 thanks

 Ok, the attached patch has the following properties:

Well, except it also has the property of a basic shell syntax error in the
postrm. ;)  Here's the fixed patch.

-- 
Steve Langasek   Give me a lever long enough and a Free OS
Debian Developer   to set it on, and I can move the world.
[EMAIL PROTECTED]   http://www.debian.org/
diff -u ifmail-2.14tx8.10/debian/changelog ifmail-2.14tx8.10/debian/changelog
--- ifmail-2.14tx8.10/debian/changelog
+++ ifmail-2.14tx8.10/debian/changelog
@@ -1,3 +1,13 @@
+ifmail (2.14tx8.10-19.2) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * High-urgency upload for RC bugfix.
+  * Add missing dependency on update-inetd to ifcico, and fix the 
+maintainer script handling to only add entries on a new install and 
+only remove them on purge.  Closes: #413397.
+
+ -- Steve Langasek [EMAIL PROTECTED]  Sun, 18 Mar 2007 01:42:26 -0700
+
 ifmail (2.14tx8.10-19.1) unstable; urgency=high
 
   * Non-maintainer upload.
diff -u ifmail-2.14tx8.10/debian/control ifmail-2.14tx8.10/debian/control
--- ifmail-2.14tx8.10/debian/control
+++ ifmail-2.14tx8.10/debian/control
@@ -23,7 +23,7 @@
 
 Package: ifcico
 Architecture: any
-Depends: ${shlibs:Depends}, ifmail
+Depends: ${shlibs:Depends}, ifmail, update-inetd
 Conflicts: suidmanager ( 0.50)
 Description: Fidonet Technology transport package
  Ifcico is a FidoTech mailer for connecting to other nodes via the phone
diff -u ifmail-2.14tx8.10/debian/ifcico.postrm ifmail-2.14tx8.10/debian/ifcico.postrm
--- ifmail-2.14tx8.10/debian/ifcico.postrm
+++ ifmail-2.14tx8.10/debian/ifcico.postrm
@@ -1,13 +1,17 @@
 #!/bin/sh -e
 
-update-inetd --remove ^tfido
-update-inetd --comment-chars #disabled# --enable tfido
-update-inetd --remove ^fido
-update-inetd --comment-chars #disabled# --enable fido
-
 if [ $1 = purge ]; then
+  if which update-inetd /dev/null 21; then
+update-inetd --remove ^tfido.*/usr/lib/ifmail/ifcico
+update-inetd --comment-chars #disabled# --enable tfido
+update-inetd --remove ^fido.*/usr/lib/ifmail/ifcico
+update-inetd --comment-chars #disabled# --enable fido
+  fi
   rm -rf /var/spool/ftn/nl.d/index.dir \
   /var/spool/ftn/nl.d/index.pag  /dev/null
+elif which update-inetd /dev/null 21; then
+  update-inetd --disable ^tfido.*/usr/lib/ifmail/ifcico
+  update-inetd --disable ^fido.*/usr/lib/ifmail/ifcico
 fi
 
 #DEBHELPER#


Bug#413397: ifcico: purging the package fails (update-inetd unavailable)

2007-03-04 Thread Bill Allombert
Package: ifcico
Version: 2.14tx8.10-19.1
Severity: serious

Hello Marco,

There is an error when attempting to purge ifcico:
  Removing ifcico ...
  Purging configuration files for ifcico ...
  /var/lib/dpkg/info/ifcico.postrm: line 3: update-inetd: command not found
  dpkg: error processing ifcico (--purge):
   subprocess post-removal script returned error exit status 127

The postrm script cannot rely on update-inetd to be available when purging.

See Policy 7.2:
  Note, however, that the `postrm' cannot rely on any non-essential packages to
  be present during the `purge' phase.

Cheers,
-- 
Bill. [EMAIL PROTECTED]

Imagine a large blue swirl here. 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]