Bug#928919: patch: Do not hide errors from initscripts

2019-05-21 Thread Dmitry Bogatov


[2019-05-18 23:26] Thorsten Glaser 
> > If initscript is called during postinst and fail -- yes, it interrupts
> > installation. And it is bug in package.
>
> No, I can install a package and not have it start perfectly fine.

You have exit status 6 for case of package not being configured.
Otherwise, I strongly disagree with "failure to start service fine".

> Worse is breakage on package *removal*, especially in situations
> where the system is wrecked (e.g. package install was aborted)
> anyway.
>
> Breaking apt is more evil than some dæmon not starting during
> the system run (on large upgrades, a reboot will be done anyway,
> so the problem is very transient).

Yeah, having non-unstallable package is evil. But I think hiding
the fact, that initscript is broken is even more evil.

But with these matters of good and evil we got off the main discussion:
what is wrong with having initscripts from bin:initscripts more sensible
exit values, given they are not invoked in maintainer scripts?
-- 
Note, that I send and fetch email in batch, once every 24 hours.
 If matter is urgent, try https://t.me/kaction
 --



Bug#928919: patch: Do not hide errors from initscripts

2019-05-18 Thread Thorsten Glaser
On Sat, 18 May 2019, Dmitry Bogatov wrote:

> If initscript is called during postinst and fail -- yes, it interrupts
> installation. And it is bug in package.

No, I can install a package and not have it start perfectly fine.
Worse is breakage on package *removal*, especially in situations
where the system is wrecked (e.g. package install was aborted)
anyway.

Breaking apt is more evil than some dæmon not starting during
the system run (on large upgrades, a reboot will be done anyway,
so the problem is very transient).

bye,
//mirabilos
-- 
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg



Bug#928919: patch: Do not hide errors from initscripts

2019-05-18 Thread Dmitry Bogatov


[2019-05-16 14:47] Thorsten Glaser 
> On Thu, 16 May 2019, Dmitry Bogatov wrote:
>
> > Having trailing ":" would result of ignoring result these "do_*" functions.
>
> This is normally right. Initscripts must return 0 in most cases,
  
Why?

> and only explicitly exit with a nonzero errorlevel when needed.

How do you define "when needed"? In my opinion, ignoring errors must be
explicit (e.g || :), checking for them -- default.

> > Exit status of initscript does not affect boot process: see "startup()"
> > from /etc/init.d/rc (no set -e):
>
> Hmm, what was it then... this is from Policy §9.3.2...

Policy:

For "init.d" scripts, it’s often easier to not use "set -e" and
instead check the result of each command separately.

Just a advice, that, in my opinion, promotes reckless scripting.

> but it can make package installation fail, that much is sure.

If initscript is called during postinst and fail -- yes, it interrupts
installation. And it is bug in package.

But how initscripts can fail to install for that reason? They are not
invoked in postinst.
-- 
Note, that I send and fetch email in batch, once every 24 hours.
 If matter is urgent, try https://t.me/kaction
 --



Bug#928919: patch: Do not hide errors from initscripts

2019-05-16 Thread Thorsten Glaser
On Thu, 16 May 2019, Dmitry Bogatov wrote:

> Having trailing ":" would result of ignoring result these "do_*" functions.

This is normally right. Initscripts must return 0 in most cases,
and only explicitly exit with a nonzero errorlevel when needed.

> Exit status of initscript does not affect boot process: see "startup()"
> from /etc/init.d/rc (no set -e):

Hmm, what was it then... this is from Policy §9.3.2...
but it can make package installation fail, that much is sure.

bye,
//m.



Bug#928919: patch: Do not hide errors from initscripts

2019-05-16 Thread Dmitry Bogatov


[2019-05-13 12:58] Thorsten Glaser 
> On Mon, 13 May 2019, Dmitry Bogatov wrote:
>
> > @@ -65,5 +65,3 @@ case "$1" in
> > exit 3
> > ;;
> >  esac
> > -
> > -:
>
> I think this is not advisable. What this will do is
> cause the last errorlevel to be returned by the script,
> which may not be an error but simply the result of a
> test command.

Then this initscripts will always fail. Bug to fix. But actually, most
scripts have following form:

case $1 in
start) do_start ;;
stop)  do_stop ;;
# [...]
esac

Having trailing ":" would result of ignoring result these "do_*" functions.
It is true, that some of them, unfortunately, do not thread return
value properly (ex: mountall).

This change in no way complete, but just one step in direction when exit
status of initscript is meaningful.

> Initscripts explicitly call the exit built-in utility
> in case of errors and must not use 'set -e', but even
> so, this may break some legit uses.

Not that it is good thing, but I know, that both initscripts and
lsb-base can't be used with "set -e".

What legit uses you are talking about?

> Furthermore, not erroring out seems to be the proper fallback case for
> initscripts because doing otherwise may cause the system to not boot,
> which is the greater evil.

Exit status of initscript does not affect boot process: see "startup()"
from /etc/init.d/rc (no set -e):

startup() {
action=$1
shift
scripts="$@"
for script in $scripts ; do
$debug "$script" $action
done
}
-- 
Note, that I send and fetch email in batch, once every 24 hours.
 If matter is urgent, try https://t.me/kaction
 --



Bug#928919: patch: Do not hide errors from initscripts

2019-05-13 Thread Thorsten Glaser
On Mon, 13 May 2019, Dmitry Bogatov wrote:

> @@ -65,5 +65,3 @@ case "$1" in
>   exit 3
>   ;;
>  esac
> -
> -:

I think this is not advisable. What this will do is
cause the last errorlevel to be returned by the script,
which may not be an error but simply the result of a
test command.

Initscripts explicitly call the exit built-in utility
in case of errors and must not use 'set -e', but even
so, this may break some legit uses.

Furthermore, not erroring out seems to be the proper
fallback case for initscripts because doing otherwise
may cause the system to not boot, which is the greater
evil.

bye,
//mirabilos
-- 
tarent solutions GmbH
Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/
Tel: +49 228 54881-393 • Fax: +49 228 54881-235
HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941
Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

**

Mit der tarent Academy bieten wir auch Trainings und Schulungen in den
Bereichen Softwareentwicklung, Agiles Arbeiten und Zukunftstechnologien an.

Besuchen Sie uns auf www.tarent.de/academy. Wir freuen uns auf Ihren Kontakt.

**



Bug#928919: patch: Do not hide errors from initscripts

2019-05-12 Thread Dmitry Bogatov

Package: initscripts
Severity: wishlist
Tags: patch

From 987ac0ec780a063052346ff8adb33a072694ae11 Mon Sep 17 00:00:00 2001
From: Dmitry Bogatov 
Date: Sat, 11 May 2019 20:19:11 +
Subject: [PATCH] Do not hide errors from initscripts

---
 debian/src/initscripts/etc/init.d/bootlogs   | 2 --
 debian/src/initscripts/etc/init.d/bootmisc.sh| 2 --
 debian/src/initscripts/etc/init.d/checkfs.sh | 2 --
 debian/src/initscripts/etc/init.d/checkroot-bootclean.sh | 2 --
 debian/src/initscripts/etc/init.d/checkroot.sh   | 2 --
 debian/src/initscripts/etc/init.d/halt   | 2 --
 debian/src/initscripts/etc/init.d/hostname.sh| 2 --
 debian/src/initscripts/etc/init.d/mountall-bootclean.sh  | 2 --
 debian/src/initscripts/etc/init.d/mountall.sh| 2 --
 debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh  | 2 --
 debian/src/initscripts/etc/init.d/mountnfs.sh| 2 --
 debian/src/initscripts/etc/init.d/rmnologin  | 2 --
 debian/src/initscripts/etc/init.d/sendsigs   | 2 --
 debian/src/initscripts/etc/init.d/umountfs   | 2 --
 debian/src/initscripts/etc/init.d/umountnfs.sh   | 2 --
 debian/src/initscripts/etc/init.d/umountroot | 2 --
 debian/src/initscripts/etc/init.d/urandom| 2 --
 17 files changed, 34 deletions(-)

diff --git a/debian/src/initscripts/etc/init.d/bootlogs 
b/debian/src/initscripts/etc/init.d/bootlogs
index 686a2afb..3916e4ef 100644
--- a/debian/src/initscripts/etc/init.d/bootlogs
+++ b/debian/src/initscripts/etc/init.d/bootlogs
@@ -65,5 +65,3 @@ case "$1" in
exit 3
;;
 esac
-
-:
diff --git a/debian/src/initscripts/etc/init.d/bootmisc.sh 
b/debian/src/initscripts/etc/init.d/bootmisc.sh
index 461b7472..f56b4078 100755
--- a/debian/src/initscripts/etc/init.d/bootmisc.sh
+++ b/debian/src/initscripts/etc/init.d/bootmisc.sh
@@ -58,5 +58,3 @@ case "$1" in
exit 3
;;
 esac
-
-:
diff --git a/debian/src/initscripts/etc/init.d/checkfs.sh 
b/debian/src/initscripts/etc/init.d/checkfs.sh
index 67929dec..ab5a4bac 100755
--- a/debian/src/initscripts/etc/init.d/checkfs.sh
+++ b/debian/src/initscripts/etc/init.d/checkfs.sh
@@ -145,5 +145,3 @@ case "$1" in
exit 3
;;
 esac
-
-:
diff --git a/debian/src/initscripts/etc/init.d/checkroot-bootclean.sh 
b/debian/src/initscripts/etc/init.d/checkroot-bootclean.sh
index effe252b..1cf811cd 100755
--- a/debian/src/initscripts/etc/init.d/checkroot-bootclean.sh
+++ b/debian/src/initscripts/etc/init.d/checkroot-bootclean.sh
@@ -39,5 +39,3 @@ case "$1" in
exit 3
;;
 esac
-
-:
diff --git a/debian/src/initscripts/etc/init.d/checkroot.sh 
b/debian/src/initscripts/etc/init.d/checkroot.sh
index 873e6748..cb7e1537 100755
--- a/debian/src/initscripts/etc/init.d/checkroot.sh
+++ b/debian/src/initscripts/etc/init.d/checkroot.sh
@@ -375,5 +375,3 @@ case "$1" in
exit 3
;;
 esac
-
-:
diff --git a/debian/src/initscripts/etc/init.d/halt 
b/debian/src/initscripts/etc/init.d/halt
index c179a25a..f4f5ffaf 100755
--- a/debian/src/initscripts/etc/init.d/halt
+++ b/debian/src/initscripts/etc/init.d/halt
@@ -79,5 +79,3 @@ case "$1" in
exit 3
;;
 esac
-
-:
diff --git a/debian/src/initscripts/etc/init.d/hostname.sh 
b/debian/src/initscripts/etc/init.d/hostname.sh
index 71635d37..95880cc1 100755
--- a/debian/src/initscripts/etc/init.d/hostname.sh
+++ b/debian/src/initscripts/etc/init.d/hostname.sh
@@ -46,5 +46,3 @@ case "$1" in
exit 3
;;
 esac
-
-:
diff --git a/debian/src/initscripts/etc/init.d/mountall-bootclean.sh 
b/debian/src/initscripts/etc/init.d/mountall-bootclean.sh
index 546c5322..d4d1dad8 100755
--- a/debian/src/initscripts/etc/init.d/mountall-bootclean.sh
+++ b/debian/src/initscripts/etc/init.d/mountall-bootclean.sh
@@ -31,5 +31,3 @@ case "$1" in
exit 3
;;
 esac
-
-:
diff --git a/debian/src/initscripts/etc/init.d/mountall.sh 
b/debian/src/initscripts/etc/init.d/mountall.sh
index 129a4325..50d192cb 100755
--- a/debian/src/initscripts/etc/init.d/mountall.sh
+++ b/debian/src/initscripts/etc/init.d/mountall.sh
@@ -112,5 +112,3 @@ case "$1" in
exit 3
;;
 esac
-
-:
diff --git a/debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh 
b/debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh
index d1a6d8bc..d6ffae12 100755
--- a/debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh
+++ b/debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh
@@ -31,5 +31,3 @@ case "$1" in
exit 3
;;
 esac
-
-:
diff --git a/debian/src/initscripts/etc/init.d/mountnfs.sh 
b/debian/src/initscripts/etc/init.d/mountnfs.sh
index 00ac7572..a33e9ef7 100755
--- a/debian/src/initscripts/etc/init.d/mountnfs.sh
+++ b/debian/src/initscripts/etc/init.d/mountnfs.sh
@@ -102,5 +102,3 @@ case "$1" in
 exit 3
 ;;
 esac
-
-:
diff --git a/debian/src/initscripts/etc/init.d/rmnologin