Bug#385055: thttpd: cannot uninstall when daemon is not running

2006-09-04 Thread Steinar H. Gunderson
On Mon, Aug 28, 2006 at 08:40:14PM +0200, Bastian Kleineidam wrote:
> if the thttpd daemon is not running, the prerm script fails, since
> "/etc/init.d/thttpd stop" fails to exit with a zero status.

This is just plain wrong:

  trofast:/usr/src/thttpd-2.23beta1# sh debian/thttpd.rc stop ; echo $? 
  Stopping web server: No /usr/sbin/thttpd found running; none killed.
  0

The only code path that _doesn't_ work is when there is a pid file but the
web server does not run. This could surely be improved (the start target
can't handle it either), but it surely isn't RC.

The issue with invoke-rc.d is real enough, though, and I'll NMU for it.

/* Steinar */
-- 
Homepage: http://www.sesse.net/


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



Bug#385055: thttpd: cannot uninstall when daemon is not running

2006-08-31 Thread Steve Langasek
On Thu, Aug 31, 2006 at 09:23:47PM +0200, Bastian Kleineidam wrote:

> Steve Langasek schrieb:
> > On Wed, Aug 30, 2006 at 08:39:10PM +0200, Bastian Kleineidam wrote:
> >> What should be done then in prerm when the stop command fails?

> > Why is the stop command failing?
> It fails when the daemon is not running. Perhaps it should not do so.

Indeed it should not; I just pointed out the policy section that this
violates.

> However, the stop command can still possibly fail. The question is what
> should be done in prerm if it fails? I think ignoring the error is the
> right decision then, by adding "|| true".

I think ignoring errors is almost always the wrong thing to do.  Ignoring a
failure to stop the daemon may be a security hole, if an uninstalled daemon
is left running without the knowledge of the admin.

-- 
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/


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



Bug#385055: thttpd: cannot uninstall when daemon is not running

2006-08-31 Thread Stephen Gran
This one time, at band camp, Bastian Kleineidam said:
> Steve Langasek schrieb:
> > On Wed, Aug 30, 2006 at 08:39:10PM +0200, Bastian Kleineidam wrote:
> >> What should be done then in prerm when the stop command fails?
> > 
> > Why is the stop command failing?
> It fails when the daemon is not running. Perhaps it should not do so.

It should not do so.

> However, the stop command can still possibly fail. The question is what
> should be done in prerm if it fails? I think ignoring the error is the
> right decision then, by adding "|| true".

You should take reasonable care to make sure that the stop target does
not fail, and only exit with an error when the script can't cope.  Just
adding or true is not really acceptable.  It would be better to let the
script fail than to paper over a problem, frankly.
-- 
 -
|   ,''`.Stephen Gran |
|  : :' :[EMAIL PROTECTED] |
|  `. `'Debian user, admin, and developer |
|`- http://www.debian.org |
 -


signature.asc
Description: Digital signature


Bug#385055: thttpd: cannot uninstall when daemon is not running

2006-08-31 Thread Bastian Kleineidam
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Steve Langasek schrieb:
> On Wed, Aug 30, 2006 at 08:39:10PM +0200, Bastian Kleineidam wrote:
>> What should be done then in prerm when the stop command fails?
> 
> Why is the stop command failing?
It fails when the daemon is not running. Perhaps it should not do so.

However, the stop command can still possibly fail. The question is what
should be done in prerm if it fails? I think ignoring the error is the
right decision then, by adding "|| true".

Ciao,
  Bastian
- --
  ,''`.  Bastian Kleineidam
 : :' :GnuPG Schlüssel
 `. `'gpg --keyserver wwwkeys.pgp.net --recv-keys 32EC6F3E
   `-

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE9zdDeBwlBDLsbz4RAlA/AJ4p3c9vcTXwKyHTWHYsdZM7kcZWtgCgwRh+
5Hcj+EZh9IApLTZDlBOiuqg=
=MudW
-END PGP SIGNATURE-



Bug#385055: thttpd: cannot uninstall when daemon is not running

2006-08-30 Thread Steve Langasek
On Wed, Aug 30, 2006 at 08:39:10PM +0200, Bastian Kleineidam wrote:

> Steve Langasek schrieb:
> > On Tue, Aug 29, 2006 at 07:54:32PM +0200, Bastian Kleineidam wrote:

> >> The "|| true" after the stop command must be added regardless of the
> >> usage of invoke-rc.d.

> > Why?  That's not the customary usage at all.
> What should be done then in prerm when the stop command fails?

Why is the stop command failing?

 The `init.d' scripts should ensure that they will behave sensibly if
 invoked with `start' when the service is already running, or with
 `stop' when it isn't, and that they don't kill unfortunately-named
 user processes.  The best way to achieve this is usually to use
 `start-stop-daemon'.

Policy 9.3.2.

-- 
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/


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



Bug#385055: thttpd: cannot uninstall when daemon is not running

2006-08-30 Thread Bastian Kleineidam
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Steve Langasek schrieb:
> On Tue, Aug 29, 2006 at 07:54:32PM +0200, Bastian Kleineidam wrote:
> 
>> The "|| true" after the stop command must be added regardless of the
>> usage of invoke-rc.d.
> 
> Why?  That's not the customary usage at all.
What should be done then in prerm when the stop command fails?

Regards,
  Bastian
- --
  ,''`.  Bastian Kleineidam
 : :' :GnuPG Schlüssel
 `. `'gpg --keyserver wwwkeys.pgp.net --recv-keys 32EC6F3E
   `-

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE9dtNeBwlBDLsbz4RAu6aAKClfHUwZ6u7EcW1/e3ugFFRd9TL5wCcDSWl
fwu41ZxhRGIeWUzo051/yzI=
=xrqf
-END PGP SIGNATURE-



Bug#385055: thttpd: cannot uninstall when daemon is not running

2006-08-29 Thread Steve Langasek
On Tue, Aug 29, 2006 at 07:54:32PM +0200, Bastian Kleineidam wrote:

> The "|| true" after the stop command must be added regardless of the
> usage of invoke-rc.d.

Why?  That's not the customary usage at all.

-- 
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/


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



Bug#385055: thttpd: cannot uninstall when daemon is not running

2006-08-29 Thread Bastian Kleineidam
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Steve Langasek schrieb:
> This is still a policy violation; maintainer scripts aren't supposed to
> invoke init.d scripts directly, they should use invoke-rc.d.
I agree. There is already a bug filed wrt invoke-rc.d (#05). I will
raise the severity of #05, and block this bug by it.
The "|| true" after the stop command must be added regardless of the
usage of invoke-rc.d.

Regards,
  Bastian
- --
  ,''`.  Bastian Kleineidam
 : :' :GnuPG Schlüssel
 `. `'gpg --keyserver wwwkeys.pgp.net --recv-keys 32EC6F3E
   `-

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE9H9XeBwlBDLsbz4RAk30AJ4wfOg35QsIqlfc9rewEq5vLfLECQCgtzE4
rCbuVubpVqMLz8kq7yGbNJQ=
=pEd9
-END PGP SIGNATURE-



Bug#385055: thttpd: cannot uninstall when daemon is not running

2006-08-28 Thread Steve Langasek
On Mon, Aug 28, 2006 at 08:40:14PM +0200, Bastian Kleineidam wrote:
> if the thttpd daemon is not running, the prerm script fails, since
> "/etc/init.d/thttpd stop" fails to exit with a zero status.
> This prevents the package from uninstall. Attached is a patch
> the ignores stop errors.

> --- prerm_old 2006-08-28 20:33:54.087259208 +0200
> +++ prerm 2006-08-28 20:33:39.154529328 +0200
> @@ -7,7 +7,7 @@
>   #
>   #   Stop the daemon
>   #
> - /etc/init.d/thttpd stop
> + /etc/init.d/thttpd stop || true
>   [ -L /usr/doc/thttpd ] && rm -f /usr/doc/thttpd
>   ;;
>   failed-upgrade)

This is still a policy violation; maintainer scripts aren't supposed to
invoke init.d scripts directly, they should use invoke-rc.d.

-- 
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/


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



Bug#385055: thttpd: cannot uninstall when daemon is not running

2006-08-28 Thread Bastian Kleineidam
Package: thttpd
Version: 2.23beta1-4
Severity: serious
Tags: patch
Justification: Policy 6.1 - maintainer scripts

Hi,

if the thttpd daemon is not running, the prerm script fails, since
"/etc/init.d/thttpd stop" fails to exit with a zero status.
This prevents the package from uninstall. Attached is a patch
the ignores stop errors.

Regards,
  Bastian

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17-treasure7
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)
--- prerm_old   2006-08-28 20:33:54.087259208 +0200
+++ prerm   2006-08-28 20:33:39.154529328 +0200
@@ -7,7 +7,7 @@
#
#   Stop the daemon
#
-   /etc/init.d/thttpd stop
+   /etc/init.d/thttpd stop || true
[ -L /usr/doc/thttpd ] && rm -f /usr/doc/thttpd
;;
failed-upgrade)