Debian Bug report logs - #339955
sysv-rc: Does not source .sh scripts

version graph

Package: sysv-rc; Maintainer for sysv-rc is Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>; Source for sysv-rc is src:sysvinit.

Reported by: Brendan O'Dea <bod@debian.org>

Date: Sat, 19 Nov 2005 22:18:04 UTC

Severity: minor

Tags: confirmed

Found in versions sysv-rc/2.86.ds1-5, sysv-rc/2.86.ds1-1.2, debian-policy/3.8.0.1

Fixed in version sysvinit/2.86.ds1-62

Done: Petter Reinholdtsen <pere@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Brendan O'Dea <bod@debian.org>:
New Bug report received and forwarded. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Brendan O'Dea <bod@debian.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Cc: Debian Policy List <debian-policy@lists.debian.org>
Subject: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Sun, 20 Nov 2005 09:17:24 +1100
Package: sysv-rc
Version: 2.86.ds1-5
Severity: serious

Debian Policy states (§9.3.1):

   "Also, if the script name ends `.sh', the script will be sourced in
    runlevel `S' rather that being run in a forked subprocess, but will
    be explicitly run by `sh' in all other runlevels".

This could probably be achieved with the attached patch, although there
are quite a few instances in /etc/init.d/*.sh scripts where "exit" is
called.  These scripts need to be changed to use "return"* appropriately
before the behaviour is changed.

Note: I believe that "return" should work to exit from a script both
when sourced and when executed but perhaps someone with a copy of POSIX
could confirm.

--bod

--- /etc/init.d/rc.orig	2005-11-20 08:43:41.000000000 +1100
+++ /etc/init.d/rc	2005-11-20 08:55:10.000000000 +1100
@@ -37,12 +37,14 @@
     action=$1
     shift
     scripts="$@"
+    sh=sh
+    [ S = "$runlevel" ] && sh=.
     case "$CONCURRENCY" in
 	none)
 	    for script in $scripts ; do
 	        case "$script" in
   	          *.sh)
-		      $debug sh "$script" $action
+		      $debug $sh "$script" $action
 		      ;;
 	          *)
 	              $debug "$script" $action



Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Petter Reinholdtsen <pere@hungry.com>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #10 received at 339955@bugs.debian.org (full text, mbox):

From: Petter Reinholdtsen <pere@hungry.com>
To: Debian Policy List <debian-policy@lists.debian.org>
Cc: 339955@bugs.debian.org
Subject: Re: [Pkg-sysvinit-devel] Bug#339955: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Sat, 19 Nov 2005 23:33:44 +0100
[Brendan O'Dea]
> Debian Policy states (§9.3.1):
> 
>    "Also, if the script name ends `.sh', the script will be sourced
>    in runlevel `S' rather that being run in a forked subprocess, but
>    will be explicitly run by `sh' in all other runlevels".

What a strange thing for policy to specify.  :)

This will make it impossible to speed up the rcS.d boot by running
scripts in parallel.  It does not sound sensible to me.

> This could probably be achieved with the attached patch, although
> there are quite a few instances in /etc/init.d/*.sh scripts where
> "exit" is called.  These scripts need to be changed to use "return"*
> appropriately before the behaviour is changed.

Well, I would be surprised if any of the scripts used in rcS.d uses
exit, as this would break the boot.

The patch look good, but will be equivalent to a forked subprocess
when running the scripts in parallel.

> Note: I believe that "return" should work to exit from a script both
> when sourced and when executed but perhaps someone with a copy of
> POSIX could confirm.

As far as I know, return will exit the script if used in the 'outer'
scope.



Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Brendan O'Dea <bod@debian.org>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #15 received at 339955@bugs.debian.org (full text, mbox):

From: Brendan O'Dea <bod@debian.org>
To: Petter Reinholdtsen <pere@hungry.com>
Cc: Debian Policy List <debian-policy@lists.debian.org>, 339955@bugs.debian.org
Subject: Re: [Pkg-sysvinit-devel] Bug#339955: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Sun, 20 Nov 2005 10:32:32 +1100
On Sat, Nov 19, 2005 at 11:33:44PM +0100, Petter Reinholdtsen wrote:
>[Brendan O'Dea]
>> Debian Policy states (§9.3.1):
>> 
>>    "Also, if the script name ends `.sh', the script will be sourced
>>    in runlevel `S' rather that being run in a forked subprocess, but
>>    will be explicitly run by `sh' in all other runlevels".
>
>What a strange thing for policy to specify.  :)

I'm not quite sure what the initial rationale was, although Adam Heath
suggested on IRC that it could be to allow scripts to set environment
variables which would propagate through to subsequent scripts.

>This will make it impossible to speed up the rcS.d boot by running
>scripts in parallel.  It does not sound sensible to me.

Yes, I saw CONCURRENCY in /etc/init.d/rc.  Not quite sure how that's
supposed to work with a value of "shell".  I presume that startpar
is/will be a helper function/script that interprets the LSB
"Required-Start" pseudo header?

>> This could probably be achieved with the attached patch, although
>> there are quite a few instances in /etc/init.d/*.sh scripts where
>> "exit" is called.  These scripts need to be changed to use "return"*
>> appropriately before the behaviour is changed.
>
>Well, I would be surprised if any of the scripts used in rcS.d uses
>exit, as this would break the boot.

It won't currently, but will if the patch is applied.

  $ grep -lw exit /etc/rcS.d/*.sh | wc -l
  12

--bod



Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Petter Reinholdtsen <pere@hungry.com>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #20 received at 339955@bugs.debian.org (full text, mbox):

From: Petter Reinholdtsen <pere@hungry.com>
To: Debian Policy List <debian-policy@lists.debian.org>, 339955@bugs.debian.org
Subject: Re: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Sun, 20 Nov 2005 00:49:38 +0100
[Brendan O'Dea]
> I'm not quite sure what the initial rationale was, although Adam Heath
> suggested on IRC that it could be to allow scripts to set environment
> variables which would propagate through to subsequent scripts.

I'm not sure why it is documented in policy, but the sysv-rc
implementation for rcS used to source these scripts to cut down the
boot time.  I'm not sure if it actually had any effect, but as far as
I can read from the source and history of the package, it was purely a
optimization, and not intended to pass variables around.

> Yes, I saw CONCURRENCY in /etc/init.d/rc.  Not quite sure how that's
> supposed to work with a value of "shell".  I presume that startpar
> is/will be a helper function/script that interprets the LSB
> "Required-Start" pseudo header?

startpar is just a helper to serialise the output from programs
running in parallel, and has nothing to do with the LSB headers.  The
dependency information can be used to order the scripts, and the
'shell' and 'startpar' argument will then run all scripts with the
same order value in parallel.  This speed up the boot.

> It won't currently, but will if the patch is applied.
> 
>   $ grep -lw exit /etc/rcS.d/*.sh | wc -l
>   12

Some of these are not reachable in the normal case, but others are.
And some of these have been in the scripts when the .sh scripts were
sourced, so I am unsure how this could work previously.



Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Steve Langasek <vorlon@debian.org>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #25 received at 339955@bugs.debian.org (full text, mbox):

From: Steve Langasek <vorlon@debian.org>
To: Petter Reinholdtsen <pere@hungry.com>
Cc: Debian Policy List <debian-policy@lists.debian.org>, 339955@bugs.debian.org
Subject: Re: [Pkg-sysvinit-devel] Bug#339955: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Sat, 19 Nov 2005 20:18:50 -0800
[Message part 1 (text/plain, inline)]
On Sat, Nov 19, 2005 at 11:33:44PM +0100, Petter Reinholdtsen wrote:
> >    "Also, if the script name ends `.sh', the script will be sourced
> >    in runlevel `S' rather that being run in a forked subprocess, but
> >    will be explicitly run by `sh' in all other runlevels".

> What a strange thing for policy to specify.  :)

> This will make it impossible to speed up the rcS.d boot by running
> scripts in parallel.  It does not sound sensible to me.

It's perfectly sensible: if the scripts were meant to be run in parallel,
they shouldn't have the ".sh" extension...

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
vorlon@debian.org                                   http://www.debian.org/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Petter Reinholdtsen <pere@hungry.com>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #30 received at 339955@bugs.debian.org (full text, mbox):

From: Petter Reinholdtsen <pere@hungry.com>
To: Debian Policy List <debian-policy@lists.debian.org>, 339955@bugs.debian.org
Subject: Re: [Pkg-sysvinit-devel] Bug#339955: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Sun, 20 Nov 2005 08:20:59 +0100
[Steve Langasek]
> It's perfectly sensible: if the scripts were meant to be run in
> parallel, they shouldn't have the ".sh" extension...

Eh, are you claiming that policy mention sourcing of .sh scripts to
make sure those scripts are not run in paralell?  It does not sounds
reasonable to me, as the parallel booting feature have never been
tried before in Debian.  Or are you trying to say something else, like
we should change the name of the init.d scripts in /etc/rcS.d/ to
allow parallelization?

I suspect this part of policy was written to document the current
implementation, without considering which part of the implementation
should be part of the policy and which part was better left
unspecified for future improvements.  Am I wrong?



Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Petter Reinholdtsen <pere@hungry.com>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #35 received at 339955@bugs.debian.org (full text, mbox):

From: Petter Reinholdtsen <pere@hungry.com>
To: 339955@bugs.debian.org
Subject: Re: Bug#339955: [Pkg-sysvinit-devel] Bug#339955: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Sun, 20 Nov 2005 08:56:29 +0100
[Petter Reinholdtsen]
> The patch look good, but will be equivalent to a forked subprocess
> when running the scripts in parallel.

Here is a possible patch to avoid running .sh scripts in the
background when using CONCURRENCY=shell.

Index: debian/sysv-rc/etc/init.d/rc
===================================================================
--- debian/sysv-rc/etc/init.d/rc        (revisjon 164)
+++ debian/sysv-rc/etc/init.d/rc        (arbeidskopi)
@@ -58,10 +58,19 @@
            $debug startpar -a $action $scripts
            ;;
        shell)
+           backgrounded=0
            for script in $scripts ; do
-               $debug $script $action &
+               case "$script" in
+                 *.sh)
+                     $debug $sh "$script" $action
+                     ;;
+                 *)
+                     $debug "$script" $action &
+                     backgrounded=1
+                     ;;
+               esac
            done
-           wait
+           [ 1 = "$backgrounded" ] && wait
            ;;
     esac
 }



Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Steve Langasek <vorlon@debian.org>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #40 received at 339955@bugs.debian.org (full text, mbox):

From: Steve Langasek <vorlon@debian.org>
To: Petter Reinholdtsen <pere@hungry.com>
Cc: Debian Policy List <debian-policy@lists.debian.org>, 339955@bugs.debian.org
Subject: Re: [Pkg-sysvinit-devel] Bug#339955: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Sun, 20 Nov 2005 00:15:12 -0800
[Message part 1 (text/plain, inline)]
On Sun, Nov 20, 2005 at 08:20:59AM +0100, Petter Reinholdtsen wrote:
> [Steve Langasek]
> > It's perfectly sensible: if the scripts were meant to be run in
> > parallel, they shouldn't have the ".sh" extension...

> Eh, are you claiming that policy mention sourcing of .sh scripts to
> make sure those scripts are not run in paralell?  It does not sounds
> reasonable to me, as the parallel booting feature have never been
> tried before in Debian.  Or are you trying to say something else, like
> we should change the name of the init.d scripts in /etc/rcS.d/ to
> allow parallelization?

I imagine that parallelization wasn't a major consideration when this part
of policy was written, but *if* parallelization of these scripts is now the
most important thing for boot time optimization, then they could be renamed,
yes.

This would have to be evaluated per-script; the "side-effect" of being able
to set env variables for the remaining boot scripts also needs to be taken
into consideration.

> I suspect this part of policy was written to document the current
> implementation, without considering which part of the implementation
> should be part of the policy and which part was better left
> unspecified for future improvements.  Am I wrong?

Er, this is a case of policy defining an interface, so that both init script
implementors and implementors of runlevel managers both know what to expect.
I don't think that's inappropriate for policy.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
vorlon@debian.org                                   http://www.debian.org/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Thomas Hood <jdthood@yahoo.co.uk>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #45 received at 339955@bugs.debian.org (full text, mbox):

From: Thomas Hood <jdthood@yahoo.co.uk>
To: Brendan O'Dea <bod@debian.org>, 339955@bugs.debian.org
Subject: Re: Bug#339955: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Mon, 21 Nov 2005 09:34:11 +0100
Brendan O'Dea wrote:
> Note: I believe that "return" should work to exit from a script both
> when sourced and when executed but perhaps someone with a copy of POSIX
> could confirm.


Disconfirmation:

$ cat /tmp/s
#!/bin/bash
echo foo
return
echo bar
jdthood@turmeric:~/src/sysvinit/pkg-sysvinit/sysvinit/trunk/debian/initscripts/etc/init.d$ /tmp/s
foo
/tmp/s: line 3: return: can only `return' from a function or sourced script
bar



Bug marked as found in version 2.86.ds1-1.2. Request was from Petter Reinholdtsen <pere@hungry.com> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Thomas Hood <jdthood@yahoo.co.uk>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #52 received at 339955@bugs.debian.org (full text, mbox):

From: Thomas Hood <jdthood@yahoo.co.uk>
To: Brendan O'Dea <bod@debian.org>, 339955@bugs.debian.org
Cc: Miquel van Smoorenburg <miquels@cistron.nl>
Subject: Re: Bug#339955: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Mon, 21 Nov 2005 09:55:22 +0100
Brendan O'Dea wrote:
> there are quite a few instances in /etc/init.d/*.sh scripts where "exit" is
> called.


All the exit commands are either (1) at the end of usage exception sections,
or (2) preceded by colons ':'.  Testing suggests that a ": exit 0" does the
same as ":", namely, nothing.

Miquel: What is the purpose of those ": exit 0" commands?  Do they have an
effect under some conditions?

-- 
Thomas Hood



Tags added: pending Request was from Petter Reinholdtsen <pere@hungry.com> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Petter Reinholdtsen <pere@hungry.com>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #59 received at 339955@bugs.debian.org (full text, mbox):

From: Petter Reinholdtsen <pere@hungry.com>
To: Debian Policy List <debian-policy@lists.debian.org>, 339955@bugs.debian.org
Subject: Re: [Pkg-sysvinit-devel] Bug#339955: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Mon, 21 Nov 2005 10:33:23 +0100
I'm not sure how this could happen, but when I enabled sourcing of the
.sh scripts in rcS.d/, the boot failed because /etc/rcS.d/S01glibc.sh
uses 'exit 0' at the end of the script, and thus terminates the S
runlevel.  This script was added in glibc version 2.3.5-5 uploaded
2005-08-27.  The strange thing is that the sysv-rc version no longer
sourcing the .sh scripts was uploaded 2005-09-10.  Wonder how people
were booting in the mean time... :/

So it is not safe to source the .sh scripts at the moment.  Changing
the 'exit 0' to ': exit 0' solved that issue.  This should be reported
as a bug against glibc, I guess.



Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Brendan O'Dea <bod@debian.org>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #64 received at 339955@bugs.debian.org (full text, mbox):

From: Brendan O'Dea <bod@debian.org>
To: Thomas Hood <jdthood@yahoo.co.uk>
Cc: 339955@bugs.debian.org, Miquel van Smoorenburg <miquels@cistron.nl>, Debian Policy List <debian-policy@lists.debian.org>
Subject: Re: Bug#339955: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Mon, 21 Nov 2005 22:18:50 +1100
On Mon, Nov 21, 2005 at 09:55:22AM +0100, Thomas Hood wrote:
>Brendan O'Dea wrote:
>> there are quite a few instances in /etc/init.d/*.sh scripts where "exit" is
>> called.
>
>All the exit commands are either (1) at the end of usage exception sections,
>or (2) preceded by colons ':'.  Testing suggests that a ": exit 0" does the
>same as ":", namely, nothing.

Yes, ":" is a no-op, which returns true.  Sometimes used for side-effects:

  : ${foo:=bar} # set foo=bar if not set

Not all instances are harmless.  Take /etc/init.d/hwclock.sh for example
(util-linux):

  [ ! -x /sbin/hwclock ] && exit 0

"chmod -x /sbin/hwclock" should not stop my system from booting.

--bod



Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Brendan O'Dea <bod@debian.org>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #69 received at 339955@bugs.debian.org (full text, mbox):

From: Brendan O'Dea <bod@debian.org>
To: Thomas Hood <jdthood@yahoo.co.uk>
Cc: 339955@bugs.debian.org, Debian Policy List <debian-policy@lists.debian.org>
Subject: Re: Bug#339955: sysv-rc: /etc/init.d/*.sh should be sourced in runlevel S
Date: Mon, 21 Nov 2005 22:20:54 +1100
On Mon, Nov 21, 2005 at 09:34:11AM +0100, Thomas Hood wrote:
>Brendan O'Dea wrote:
>> Note: I believe that "return" should work to exit from a script both
>> when sourced and when executed but perhaps someone with a copy of POSIX
>> could confirm.
>
>
>Disconfirmation:
>
>$ cat /tmp/s
>#!/bin/bash
>echo foo
>return
>echo bar
>jdthood@turmeric:~/src/sysvinit/pkg-sysvinit/sysvinit/trunk/debian/initscripts/etc/init.d$ /tmp/s
>foo
>/tmp/s: line 3: return: can only `return' from a function or sourced script
>bar

Bleah, I tested with "sh test-script", forgetting that I have sh as an
alias for $SHELL (ksh).

In which case, what's needed is "return N 2>/dev/null || exit N", which
should cover all cases.

--bod



Tags removed: pending Request was from Thomas Hood <jdthood@yahoo.co.uk> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Thomas Hood <jdthood@yahoo.co.uk>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #76 received at 339955@bugs.debian.org (full text, mbox):

From: Thomas Hood <jdthood@yahoo.co.uk>
To: Debian Bug Tracking System <control@bugs.debian.org>, 339955@bugs.debian.org
Subject: not really serious
Date: Wed, 23 Nov 2005 16:42:17 +0100
severity 339955 normal
stop

This bug is ranked "serious" because sysvinit is supposedly violating policy.
I think that §9.3.1 should be seen as a description of how the system works,
not as a prescription.  The quoted paragraph can be interpreted as a warning
to initscript authors that if they assign to their scripts names with '.sh'
suffixes then these scripts may be sourced instead of executed; so they
should code accordingly.

Certainly initscript authors should not _assume_ that their .sh scripts
are sourced (and then, e.g., try to alter the behavior of scripts sourced
later by playing with the environment).
-- 
Thomas Hood



Severity set to `normal'. Request was from Thomas Hood <jdthood@yahoo.co.uk> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Steve Langasek <vorlon@debian.org>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #83 received at 339955@bugs.debian.org (full text, mbox):

From: Steve Langasek <vorlon@debian.org>
To: Thomas Hood <jdthood@yahoo.co.uk>, 339955@bugs.debian.org
Subject: Re: Bug#339955: not really serious
Date: Wed, 23 Nov 2005 13:59:37 -0800
[Message part 1 (text/plain, inline)]
severity 339955 serious
thanks

On Wed, Nov 23, 2005 at 04:42:17PM +0100, Thomas Hood wrote:

> This bug is ranked "serious" because sysvinit is supposedly violating policy.
> I think that §9.3.1 should be seen as a description of how the system works,
> not as a prescription.  The quoted paragraph can be interpreted as a warning
> to initscript authors that if they assign to their scripts names with '.sh'
> suffixes then these scripts may be sourced instead of executed; so they
> should code accordingly.

> Certainly initscript authors should not _assume_ that their .sh scripts
> are sourced (and then, e.g., try to alter the behavior of scripts sourced
> later by playing with the environment).

None of this rationale is based in policy; I don't see it as a valid reason
to downgrade this bug.  Policy *is* specifying an interface here, and by not
complying with that interface, sysv-rc risks breaking packages that have
been written to depend on that interface.

Normally, failing to comply with a part of policy that's not listed in the
RC policy would be "important" rather than "serious", but in this case the
bug ranges somewhere between "policy violation" and "breaks unrelated
packages, so I think it's best to mark it as serious here for now.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
vorlon@debian.org                                   http://www.debian.org/
[signature.asc (application/pgp-signature, inline)]

Severity set to `serious'. Request was from Steve Langasek <vorlon@debian.org> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Thomas Hood <jdthood@yahoo.co.uk>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #90 received at 339955@bugs.debian.org (full text, mbox):

From: Thomas Hood <jdthood@yahoo.co.uk>
To: 339955@bugs.debian.org
Subject: "breaks unrelated packages"?
Date: Thu, 24 Nov 2005 00:36:38 +0100
What packages are broken by the fact that sysv-rc does not source .sh scripts?

We know of one package that is broken if sysv-rc _does_ source.sh scripts.

-- 
Thomas Hood



Changed Bug title. Request was from Thomas Hood <jdthood@yahoo.co.uk> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Thomas Hood <jdthood@yahoo.co.uk>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #97 received at 339955@bugs.debian.org (full text, mbox):

From: Thomas Hood <jdthood@yahoo.co.uk>
To: 339955@bugs.debian.org
Subject: TODO
Date: Fri, 25 Nov 2005 01:00:08 +0100
Before /etc/init.d/rc can source .sh scripts, all we have to do is get
various maintainers to eliminate all these exit commands.

/etc/rcS.d$ grep exit *.sh
S01glibc.sh:exit_check () {
S01glibc.sh:    exit 1
S01glibc.sh:        exit_check
S01glibc.sh:        exit_check
S01glibc.sh:            exit_check
S01glibc.sh:            exit_check
S01glibc.sh:            exit_check
S01glibc.sh:            exit_check
S01glibc.sh:            exit_check
S01glibc.sh:            exit_check
S01glibc.sh:        exit_check
S01glibc.sh:exit 0
S05initrd-tools.sh:[ "$KEEPINITRD" = yes ] && exit
S05initrd-tools.sh:command -v blockdev > /dev/null 2>&1 || exit 0
S05initrd-tools.sh:     mount -n /proc || exit
S05initrd-tools.sh:grep -q '^[^ ]* /initrd ' /proc/mounts || exit 0
S05initrd-tools.sh:     umount /initrd/dev || exit
S05initrd-tools.sh:umount /initrd || exit
S05initrd-tools.sh:     exit 1
S05keymap.sh:command -v loadkeys >/dev/null 2>&1 || exit 0
S05keymap.sh:           [ $CONSOLE_TYPE = "serial" ] && exit 0
S05keymap.sh:   exit 1
S10checkroot.sh:        # NOTE: "failure" is defined as exiting with a return code of
S10checkroot.sh:        exit 3
S10checkroot.sh:        exit 3
S10checkroot.sh:: exit 0
S22hwclockfirst.sh:[ ! -x /sbin/hwclock ] && exit 0
S22hwclockfirst.sh:                     exit 1
S22hwclockfirst.sh:       *)    log_failure_msg "Unknown UTC setting: \"$UTC\""; exit 1 ;;
S22hwclockfirst.sh:       *)    log_failure_msg "unknown BADYEAR setting: \"$BADYEAR\""; exit 1 ;;
S22hwclockfirst.sh:             exit 1
S30checkfs.sh:  exit 3
S30checkfs.sh:  exit 3
S30checkfs.sh:: exit 0
S30procps.sh:# Check for existance of the default file and exit if not there,
S30procps.sh:[ -r /etc/default/rcS ] || exit 0
S30procps.sh:which sysctl > /dev/null || exit 0
S30procps.sh:                       exit 0
S30procps.sh:               exit 1
S35mountall.sh: exit 3
S35mountall.sh: exit 3
S35mountall.sh:: exit 0
S40hostname.sh: exit 3
S40hostname.sh: exit 3
S45mountnfs.sh: exit 3
S45mountnfs.sh: exit 3
S45mountnfs.sh:: exit 0
S48console-screen.sh:[ -x "${SETFONT}" ] || exit 0
S48console-screen.sh:    CONSOLE_TYPE=`fgconsole 2>/dev/null` || exit 0
S48console-screen.sh:    [ $VT = "no" ] && exit 0
S50hwclock.sh:[ ! -x /sbin/hwclock ] && exit 0
S50hwclock.sh:                  exit 1
S50hwclock.sh:       *) log_failure_msg "Unknown UTC setting: \"$UTC\""; exit 1 ;;
S50hwclock.sh:       *) log_failure_msg "unknown BADYEAR setting: \"$BADYEAR\""; exit 1 ;;
S50hwclock.sh:          exit 1
S55bootmisc.sh: exit 3
S55bootmisc.sh: exit 3
S55bootmisc.sh:: exit 0



Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Steve Langasek <vorlon@debian.org>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #102 received at 339955@bugs.debian.org (full text, mbox):

From: Steve Langasek <vorlon@debian.org>
To: Thomas Hood <jdthood@yahoo.co.uk>, 339955@bugs.debian.org
Cc: 340688@bugs.debian.org, 340689@bugs.debian.org
Subject: Re: Bug#339955: TODO
Date: Fri, 25 Nov 2005 01:58:42 -0800
[Message part 1 (text/plain, inline)]
severity 340688 important
severity 340689 important
severity 339955 important
thanks

On Fri, Nov 25, 2005 at 01:00:08AM +0100, Thomas Hood wrote:
> Before /etc/init.d/rc can source .sh scripts, all we have to do is get
> various maintainers to eliminate all these exit commands.

Hmm; it seems I had quite the brainfart when I re-upgraded this bug report
-- I somehow did not realize we were talking about sysv-rc, the standard
runlevel manager in Debian, and thought this was a discussion about file-rc
or some *other* runlevel manager package.

Since sysv-rc is obviously the default runlevel manager in Debian and
millions of people use it, if no one has yet reported breakage as a result
of not sourcing .sh scripts, my concern about this breaking "unrelated
packages or the whole system" is invalid.  Downgrading again, with
apologies.

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
vorlon@debian.org                                   http://www.debian.org/
[signature.asc (application/pgp-signature, inline)]

Severity set to `important'. Request was from Steve Langasek <vorlon@debian.org> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Thomas Hood <jdthood@yahoo.co.uk>:
Extra info received and forwarded to list. Copy sent to sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #109 received at 339955@bugs.debian.org (full text, mbox):

From: Thomas Hood <jdthood@yahoo.co.uk>
To: 339955@bugs.debian.org
Subject: Re: Does not source .sh scripts
Date: Tue, 17 Jan 2006 14:57:10 +0100
retitle 339955 sysv-rc: Does not source .sh scripts
severity 339955 minor
stop

Severity is minor because the consequence is, at most, a small difference in speed
on systems where the admin could enable "sourcing" if it were possible (which it
currently is not).

The only reason for assigning this a higher severity would be that it reports a
policy violation.  However, if policy _is_ currently _requiring_ that sysv-rc
source /etc/rcS.d/*.sh (and I don't see the sense of interpreting policy §9.3.1
that way, especially considering the fact that §9.3.1 pertains only to sysv-rc,
not to file-rc) then policy should be amended.  We _don't_ want initscripts to
start performing environment variable tricks and we _do_ want to be able to run
.sh scripts in parallel.



Changed Bug title. Request was from Thomas Hood <jdthood@yahoo.co.uk> to control@bugs.debian.org. Full text and rfc822 format available.

Severity set to `minor'. Request was from Thomas Hood <jdthood@yahoo.co.uk> to control@bugs.debian.org. Full text and rfc822 format available.

Tags added: confirmed Request was from Thomas Hood <jdthood@yahoo.co.uk> to control@bugs.debian.org. Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. Full text and rfc822 format available.

Acknowledgement sent to Petter Reinholdtsen <pere@hungry.com>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #120 received at 339955@bugs.debian.org (full text, mbox):

From: Petter Reinholdtsen <pere@hungry.com>
To: 339955@bugs.debian.org
Subject: Re: sysv-rc: Does not source .sh scripts
Date: Tue, 25 Dec 2007 19:42:09 +0100
I just tested, and it is still not safe to source all the *.sh scripts
during boot.  Some script is calling exit, and the rcS.d/* sequence is
terminated before all file systems are mounted, and the boot fail.

Happy hacking,
-- 
Petter Reinholdtsen




Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. (Mon, 02 Feb 2009 19:18:19 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kel Modderman <kel@otaku42.de>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Mon, 02 Feb 2009 19:18:23 GMT) Full text and rfc822 format available.

Message #125 received at 339955@bugs.debian.org (full text, mbox):

From: Kel Modderman <kel@otaku42.de>
To: submit@bugs.debian.org
Cc: 339955@bugs.debian.org
Subject: debian-policy: do not require /etc/init.d/*.sh scripts to be sourced
Date: Tue, 3 Feb 2009 05:13:58 +1000
Package: debian-policy
Version: 3.8.0.1
Severity: wishlist

Hi Debian Policy maintainers,

It is the opinion of myself and Petter Reinholdtsen, maintainers of the
sysvinit package, that the last sentence of §9.3.1 of policy is no longer
relevant and should be removed:

"""Also, if the script name ends in .sh, the script will be sourced in
runlevel S rather than being run in a forked subprocess, but will be
explicitly run by sh in all other runlevels."""

The reasons for which it should be removed are:

* /etc/init.d/rc has not supported this for an extremely long time, probably
  never, because the system would be unbootable due to .sh scripts calling
  'exit' [0, 1].

* the reason why .sh scripts should be sourced is not clear. A popular
  theory is that it was an optimisation to avoid forking shells and reduce
  boot time [2]. It may have been an interface to allow scripts to "set
  an environment variable which would propogate through to subsequent
  scripts" [3].

  These days, sourcing .sh scripts instead of executing them is not so
  much of an optimisation; we have a lightweight shell dash which can be
  used as /bin/sh and has been measured to improve boot time [4]. startpar
  has been hacked on to work better with the Debian boot system and we hope
  to use it for parrallel execution of initscripts in the future without
  contradicting policy (it a C program which uses execlp() to execute
  scripts).

  Passing enviroment variables around by sourcing .sh scripts is not a
  supported interface: .sh scripts have not been sourced for years
  and nobody has cared.

* it would be nice to clean up /etc/init.d/rc in the absence of this
  requirement. Trying to support the sourcing of /etc/init.d/*.sh
  scripts makes the code much uglier to maintain.

Thanks, Kel.

[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=339955#59
[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=339955#120
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=339955#20
[3] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=339955#15
[4] http://initscripts-ng.alioth.debian.org/soc2006-bootsystem/bootcharts.html




Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. (Tue, 03 Feb 2009 04:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Russ Allbery <rra@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Tue, 03 Feb 2009 04:42:02 GMT) Full text and rfc822 format available.

Message #130 received at 339955@bugs.debian.org (full text, mbox):

From: Russ Allbery <rra@debian.org>
To: Kel Modderman <kel@otaku42.de>
Cc: 513955@bugs.debian.org, 339955@bugs.debian.org
Subject: Re: Bug#513955: debian-policy: do not require /etc/init.d/*.sh scripts to be sourced
Date: Mon, 02 Feb 2009 20:36:52 -0800
Kel Modderman <kel@otaku42.de> writes:

> It is the opinion of myself and Petter Reinholdtsen, maintainers of the
> sysvinit package, that the last sentence of §9.3.1 of policy is no
> longer relevant and should be removed:
>
> """Also, if the script name ends in .sh, the script will be sourced in
> runlevel S rather than being run in a forked subprocess, but will be
> explicitly run by sh in all other runlevels."""
>
> The reasons for which it should be removed are:
>
> * /etc/init.d/rc has not supported this for an extremely long time, probably
>   never, because the system would be unbootable due to .sh scripts calling
>   'exit' [0, 1].

Given this, I definitely agree.  There's no point in having a statement
like this in Policy when our core packages don't implement it and no one
has apparently cared.

Unless someone steps up to say that we should do the work to reimplement
support for this interface (including fixing all the broken *.sh scripts
we have now), I think it's obvious we should simply remove it.  There's no
need to specify things no one uses and clearly can do without.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>




Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. (Tue, 03 Feb 2009 07:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Giacomo Catenazzi <cate@cateee.net>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Tue, 03 Feb 2009 07:39:02 GMT) Full text and rfc822 format available.

Message #135 received at 339955@bugs.debian.org (full text, mbox):

From: Giacomo Catenazzi <cate@cateee.net>
To: Russ Allbery <rra@debian.org>, 513955@bugs.debian.org
Cc: Kel Modderman <kel@otaku42.de>, 339955@bugs.debian.org
Subject: Re: Bug#513955: debian-policy: do not require /etc/init.d/*.sh scripts to be sourced
Date: Tue, 03 Feb 2009 08:38:02 +0100
Russ Allbery wrote:
> Kel Modderman <kel@otaku42.de> writes:
> 
>> It is the opinion of myself and Petter Reinholdtsen, maintainers of the
>> sysvinit package, that the last sentence of §9.3.1 of policy is no
>> longer relevant and should be removed:
>>
>> """Also, if the script name ends in .sh, the script will be sourced in
>> runlevel S rather than being run in a forked subprocess, but will be
>> explicitly run by sh in all other runlevels."""
>>
>> The reasons for which it should be removed are:
>>
>> * /etc/init.d/rc has not supported this for an extremely long time, probably
>>   never, because the system would be unbootable due to .sh scripts calling
>>   'exit' [0, 1].
> 
> Given this, I definitely agree.  There's no point in having a statement
> like this in Policy when our core packages don't implement it and no one
> has apparently cared.
> 
> Unless someone steps up to say that we should do the work to reimplement
> support for this interface (including fixing all the broken *.sh scripts
> we have now), I think it's obvious we should simply remove it.  There's no
> need to specify things no one uses and clearly can do without.

I agree.
BTW LSB doesn't have such special case, so such
proposal will converge to LSB, which is also positive.

ciao
	cate




Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. (Sat, 14 Feb 2009 04:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Russ Allbery <rra@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Sat, 14 Feb 2009 04:03:02 GMT) Full text and rfc822 format available.

Message #140 received at 339955@bugs.debian.org (full text, mbox):

From: Russ Allbery <rra@debian.org>
To: Kel Modderman <kel@otaku42.de>
Cc: 513955@bugs.debian.org, 339955@bugs.debian.org
Subject: Re: Bug#513955: debian-policy: do not require /etc/init.d/*.sh scripts to be sourced
Date: Fri, 13 Feb 2009 20:01:40 -0800
Kel Modderman <kel@otaku42.de> writes:

> It is the opinion of myself and Petter Reinholdtsen, maintainers of the
> sysvinit package, that the last sentence of §9.3.1 of policy is no
> longer relevant and should be removed:
>
> """Also, if the script name ends in .sh, the script will be sourced in
> runlevel S rather than being run in a forked subprocess, but will be
> explicitly run by sh in all other runlevels."""

I went to write the patch for this, but I paused when I saw that the other
part of this sentence (explicitly running such scripts with sh at other
run levels) is implemented.  The current /etc/init.d/rc runs the script
directly if it doesn't end in .sh but runs it with sh if it does.

At least on my system, all of the scripts ending in .sh have a proper #!
line and are executable, so this wouldn't make any difference there, but I
wanted to double-check first before also removing that since it appears to
be implemented.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>




Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. (Mon, 16 Feb 2009 09:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Giacomo A. Catenazzi" <cate@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Mon, 16 Feb 2009 09:03:02 GMT) Full text and rfc822 format available.

Message #145 received at 339955@bugs.debian.org (full text, mbox):

From: "Giacomo A. Catenazzi" <cate@debian.org>
To: Russ Allbery <rra@debian.org>, 513955@bugs.debian.org
Cc: Kel Modderman <kel@otaku42.de>, 339955@bugs.debian.org
Subject: Re: Bug#513955: debian-policy: do not require /etc/init.d/*.sh scripts to be sourced
Date: Mon, 16 Feb 2009 10:01:37 +0100
Russ Allbery wrote:
> Kel Modderman <kel@otaku42.de> writes:
> 
>> It is the opinion of myself and Petter Reinholdtsen, maintainers of the
>> sysvinit package, that the last sentence of §9.3.1 of policy is no
>> longer relevant and should be removed:
>>
>> """Also, if the script name ends in .sh, the script will be sourced in
>> runlevel S rather than being run in a forked subprocess, but will be
>> explicitly run by sh in all other runlevels."""
> 
> I went to write the patch for this, but I paused when I saw that the other
> part of this sentence (explicitly running such scripts with sh at other
> run levels) is implemented.  The current /etc/init.d/rc runs the script
> directly if it doesn't end in .sh but runs it with sh if it does.
> 

As alternative, I propose not to use the suffix .sh:
- now we change /will be sourced/could be sourced/ , with a footnote that
  deprecated such feature
- we bugs package, to remove the suffix .sh
- after most of the most important packages removed the .sh suffix,
  the policy remove the exception, maybe introducing a footnote which
  shortly explain the past rules (this will simplify the writing of
  rationale in the new doc)

Rationale:
  users could be confused by the .sh suffix.

> At least on my system, all of the scripts ending in .sh have a proper #!
> line and are executable, so this wouldn't make any difference there, but I
> wanted to double-check first before also removing that since it appears to
> be implemented.

hmm. All init.d script should be executable, with proper #! header.
Sysadmin are used to manually /etc/init.d/foo >stop|start|restart|reload>
So I don't understand your commentart.

ciao
	cate


ciao
	cate








Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. (Mon, 16 Feb 2009 09:27:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Mon, 16 Feb 2009 09:27:06 GMT) Full text and rfc822 format available.

Message #150 received at 339955@bugs.debian.org (full text, mbox):

From: Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>
To: "Giacomo A. Catenazzi" <cate@debian.org>, 513955@bugs.debian.org
Cc: Russ Allbery <rra@debian.org>, Kel Modderman <kel@otaku42.de>, 339955@bugs.debian.org
Subject: Re: Bug#513955: debian-policy: do not require /etc/init.d/*.sh scripts to be sourced
Date: Mon, 16 Feb 2009 10:23:31 +0100
On Mon, Feb 16, 2009 at 10:01:37AM +0100, Giacomo A. Catenazzi wrote:
> Russ Allbery wrote:
> >Kel Modderman <kel@otaku42.de> writes:
> >
> >>It is the opinion of myself and Petter Reinholdtsen, maintainers of the
> >>sysvinit package, that the last sentence of §9.3.1 of policy is no
> >>longer relevant and should be removed:
> >>
> >>"""Also, if the script name ends in .sh, the script will be sourced in
> >>runlevel S rather than being run in a forked subprocess, but will be
> >>explicitly run by sh in all other runlevels."""
> >
> >I went to write the patch for this, but I paused when I saw that the other
> >part of this sentence (explicitly running such scripts with sh at other
> >run levels) is implemented.  The current /etc/init.d/rc runs the script
> >directly if it doesn't end in .sh but runs it with sh if it does.
> >
> 
> As alternative, I propose not to use the suffix .sh:
> - now we change /will be sourced/could be sourced/ , with a footnote that
>   deprecated such feature
> - we bugs package, to remove the suffix .sh
> - after most of the most important packages removed the .sh suffix,
>   the policy remove the exception, maybe introducing a footnote which
>   shortly explain the past rules (this will simplify the writing of
>   rationale in the new doc)
> 
> Rationale:
>   users could be confused by the .sh suffix.

While I agree in general that the .sh suffix should not be mentionned
unless it has a specific meaning, I am afraid that your proposal will
be technically troublesome, because the file /etc/init.d/*.sh are
conffiles and renaming conffiles is a pain. Since such files are
critical at startup, I am afraid than an attempt to rename them will make
the upgrade path to squeeze more fragile.

> > At least on my system, all of the scripts ending in .sh have a proper #!
> > line and are executable, so this wouldn't make any difference there, but I
> > wanted to double-check first before also removing that since it appears to
> > be implemented.
> 
> hmm. All init.d script should be executable, with proper #! header.
> Sysadmin are used to manually /etc/init.d/foo >stop|start|restart|reload>
> So I don't understand your commentart.

I think Russ point is that there is no reason for policy to mandate to
run them with 'sh /etc/init.d/foo' if you can just run them directly as
'/etc/init.d/foo', as you suggest.

If we are going to remove """Also, if the script name ends in .sh, the
script will be sourced in runlevel S rather than being run in a forked
subprocess""", then we can just remove any difference in handling 
a script called /etc/init.d/foo.sh versus /etc/init.d/bar.

Cheers,
-- 
Bill. <ballombe@debian.org>

Imagine a large red swirl here. 




Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. (Sat, 21 Feb 2009 01:18:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Henrique de Moraes Holschuh <hmh@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Sat, 21 Feb 2009 01:18:05 GMT) Full text and rfc822 format available.

Message #155 received at 339955@bugs.debian.org (full text, mbox):

From: Henrique de Moraes Holschuh <hmh@debian.org>
To: Russ Allbery <rra@debian.org>, 339955@bugs.debian.org
Cc: Kel Modderman <kel@otaku42.de>, 513955@bugs.debian.org
Subject: Re: [Pkg-sysvinit-devel] Bug#339955: Bug#513955: debian-policy: do not require /etc/init.d/*.sh scripts to be sourced
Date: Fri, 20 Feb 2009 22:13:45 -0300
On Fri, 13 Feb 2009, Russ Allbery wrote:
> I went to write the patch for this, but I paused when I saw that the other
> part of this sentence (explicitly running such scripts with sh at other
> run levels) is implemented.  The current /etc/init.d/rc runs the script
> directly if it doesn't end in .sh but runs it with sh if it does.
> 
> At least on my system, all of the scripts ending in .sh have a proper #!
> line and are executable, so this wouldn't make any difference there, but I
> wanted to double-check first before also removing that since it appears to
> be implemented.

Non-executable shell initscripts are NOT supported.  While rc might handle
them, invoke-rc.d will refuse to run them, and it also breaks the
well-understood and standard "call /etc/init.d/<initscript> <action>
directly" which everything under the sun expects to work.

It is something left over from the ancient past that we can and should get
rid of.  At most, it deserves a note on the NEWS.Debian file, if that much.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh




Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. (Sun, 22 Feb 2009 10:39:24 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kel Modderman <kel@otaku42.de>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Sun, 22 Feb 2009 10:39:33 GMT) Full text and rfc822 format available.

Message #160 received at 339955@bugs.debian.org (full text, mbox):

From: Kel Modderman <kel@otaku42.de>
To: Russ Allbery <rra@debian.org>
Cc: 513955@bugs.debian.org, 339955@bugs.debian.org
Subject: Re: Bug#513955: debian-policy: do not require /etc/init.d/*.sh scripts to be sourced
Date: Sun, 22 Feb 2009 20:36:28 +1000
On Saturday 14 February 2009 14:01:40 Russ Allbery wrote:
> Kel Modderman <kel@otaku42.de> writes:
> 
> > It is the opinion of myself and Petter Reinholdtsen, maintainers of the
> > sysvinit package, that the last sentence of §9.3.1 of policy is no
> > longer relevant and should be removed:
> >
> > """Also, if the script name ends in .sh, the script will be sourced in
> > runlevel S rather than being run in a forked subprocess, but will be
> > explicitly run by sh in all other runlevels."""
> 
> I went to write the patch for this, but I paused when I saw that the other
> part of this sentence (explicitly running such scripts with sh at other
> run levels) is implemented.  The current /etc/init.d/rc runs the script
> directly if it doesn't end in .sh but runs it with sh if it does.

That's not an interface that has much merit either, it would be nice if we
didn't have to support it and we had the freedom to execute the scripts
directly.

> 
> At least on my system, all of the scripts ending in .sh have a proper #!
> line and are executable, so this wouldn't make any difference there, but I
> wanted to double-check first before also removing that since it appears to
> be implemented.
> 

I think all scripts in /etc/init.d/ must have a shebang line and be executable,
and be able to be executed directly. Executing .sh scripts explicitly by sh is
not something I see much value in supporting, Petter expressed similar
sentiment when I poked him on IRC.

Thanks, Kel.




Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#339955; Package sysv-rc. (Sun, 22 Feb 2009 21:57:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Russ Allbery <rra@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Sun, 22 Feb 2009 21:57:05 GMT) Full text and rfc822 format available.

Message #165 received at 339955@bugs.debian.org (full text, mbox):

From: Russ Allbery <rra@debian.org>
To: Kel Modderman <kel@otaku42.de>
Cc: 513955@bugs.debian.org, 339955@bugs.debian.org
Subject: Re: Bug#513955: debian-policy: do not require /etc/init.d/*.sh scripts to be sourced
Date: Sun, 22 Feb 2009 13:54:29 -0800
Kel Modderman <kel@otaku42.de> writes:
> On Saturday 14 February 2009 14:01:40 Russ Allbery wrote:

>> I went to write the patch for this, but I paused when I saw that the
>> other part of this sentence (explicitly running such scripts with sh at
>> other run levels) is implemented.  The current /etc/init.d/rc runs the
>> script directly if it doesn't end in .sh but runs it with sh if it
>> does.

> That's not an interface that has much merit either, it would be nice if
> we didn't have to support it and we had the freedom to execute the
> scripts directly.

Agreed.  I just wanted to be sure that this was the intention.

> I think all scripts in /etc/init.d/ must have a shebang line and be
> executable, and be able to be executed directly. Executing .sh scripts
> explicitly by sh is not something I see much value in supporting, Petter
> expressed similar sentiment when I poked him on IRC.

Good enough for me.

This change will be in the next release of Policy.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>




Reply sent to Petter Reinholdtsen <pere@debian.org>:
You have taken responsibility. (Tue, 23 Jun 2009 17:27:06 GMT) Full text and rfc822 format available.

Notification sent to Brendan O'Dea <bod@debian.org>:
Bug acknowledged by developer. (Tue, 23 Jun 2009 17:27:06 GMT) Full text and rfc822 format available.

Message #170 received at 339955-close@bugs.debian.org (full text, mbox):

From: Petter Reinholdtsen <pere@debian.org>
To: 339955-close@bugs.debian.org
Subject: Bug#339955: fixed in sysvinit 2.86.ds1-62
Date: Tue, 23 Jun 2009 17:02:06 +0000
Source: sysvinit
Source-Version: 2.86.ds1-62

We believe that the bug you reported is fixed in the latest version of
sysvinit, which is due to be installed in the Debian FTP archive:

initscripts_2.86.ds1-62_i386.deb
  to pool/main/s/sysvinit/initscripts_2.86.ds1-62_i386.deb
sysv-rc_2.86.ds1-62_all.deb
  to pool/main/s/sysvinit/sysv-rc_2.86.ds1-62_all.deb
sysvinit-utils_2.86.ds1-62_i386.deb
  to pool/main/s/sysvinit/sysvinit-utils_2.86.ds1-62_i386.deb
sysvinit_2.86.ds1-62.diff.gz
  to pool/main/s/sysvinit/sysvinit_2.86.ds1-62.diff.gz
sysvinit_2.86.ds1-62.dsc
  to pool/main/s/sysvinit/sysvinit_2.86.ds1-62.dsc
sysvinit_2.86.ds1-62_i386.deb
  to pool/main/s/sysvinit/sysvinit_2.86.ds1-62_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 339955@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Petter Reinholdtsen <pere@debian.org> (supplier of updated sysvinit package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Tue, 23 Jun 2009 18:18:53 +0200
Source: sysvinit
Binary: sysvinit sysvinit-utils sysv-rc initscripts
Architecture: source i386 all
Version: 2.86.ds1-62
Distribution: unstable
Urgency: low
Maintainer: Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>
Changed-By: Petter Reinholdtsen <pere@debian.org>
Description: 
 initscripts - Scripts for initializing and shutting down the system
 sysv-rc    - System-V-like runlevel change mechanism
 sysvinit   - System-V-like init utilities
 sysvinit-utils - System-V-like utilities
Closes: 67095 316468 339955 360165 422940 457896 461103 471101 483392 484883 501724 504877 510455 510912 512003 519520 526398 529805 534300
Changes: 
 sysvinit (2.86.ds1-62) unstable; urgency=low
 .
   [ Kel Modderman ]
   * Add missing semi-colon in LSB header of init.d/urandom (Closes:
     #501724).
   * Force C locale for df command used in init.d/mountoverflowtmp.
     (Closes: #510912)
   * Update startpar source to upstream 0.52 (from 0.50) and apply debian
     compatibility patch (sent upstream). Also workaround /dev/pts not
     being mounted early in runlevel S by having startpar use an own
     version of getpt(2) system call. (Closes: #457896, #484883)
   * Enable CONCURRENCY=makefile mode in debian/sysv-rc/etc/init.d/rc.
     This mode uses startpar and the /etc/init.d/.depend.* makefile-like
     information created by insserv to calculate boot script execution
     order. The splash API is not supported in this mode of boot. This
     mode of boot is considered very experimental at this time.
   * Allow startpar using concurrency modes to operate in runlevel S, now
     that startpar can manage to work properly in absence of /dev/pts.
   * Use uscan dversionmangle option to remove .ds\d+ string from modifed
     orig.tar.gz. This fixes the debian-watch-file-should-mangle-version
     lintian warning. Patch taken from diff on LP: #312764.
   * Add comment to debian/sysv-rc/etc/init.d/rc about debug=echo, it
     should never be left uncommented for a real boot process and should
     only be used for interactive debugging. (Closes: #510455)
   * Do not mount usbfs any more, it was deprecated long ago.
     Applications should all use /dev/bus/usb, which can be managed more
     flexibly (assign permissions with udev, and the like). Thanks Martin
     Pitt. (Closes: #483392, #422940, #360165, #471101)
   * Add Homepage field to debian/control.
   * Add interface for disabling system init script start links with
     update-rc.d, and enabling them again. (Closes: #67095)
   * When update-rc.d in "start|stop"-mode is invoked without the final
     dot, script warnings are displayed just before the "usage" message
     is shown. Check that last argument to start|stop command is a period
     earlier. Thanks to Patrick <pet@painfullscratch.nl>.  (Closes: #512003)
   * Use -delete option of find(1) instead of piping through xargs in
     debian/initscripts/lib/init/bootclean.sh. (Closes: #316468, #461103)
   * Make init.d/rc simpler by dropping support for sourcing .sh files
     after the policy finally changed in 3.8.1.  Update to Standards
     version 3.8.1. (Closes: #339955, #519520)
   * Allow initscripts postinst maintainer script to not fail when
     attempting to mkdir /dev/pts and /dev/shm when running in a
     fakechroot environment. This is done by checking for FAKECHROOT env
     variable before bailing out. Patch thanks to Daniel Kahn Gillmor.
     (Closes: #504877)
   * Update debian/NOTES to reflect current affairs.
 .
   [ Petter Reinholdtsen ]
   * Move the startpar binary to a more proper location, from sysvinit
     to sysvinit-utils.
   * Comment out the code disabling fsck when running on battery.  It
     need changes in fsck to work properly (Closes: #526398).  This
     Reopens #326647.
   * Add a /usr/sbin/service command (Closes: #534300).  Modified the
     manual page based on ideas from the sysvconfig package.  Thanks to
     Steve Langasek and Ubuntu.  Add conflict with sysvconfig and
     chkconfig providing the same program.
   * Improve init.d/umountfs umount ordering code to avoid being
     confused while still solving #391673 (Closes: #529805).  Patch
     from Tim Phipps.
   * Make sysv-rc depend on a version of sysvinit-utils with a properly
     working startpar, in case concurrent booting is enabled.
   * Drop shell style concurrent booting, and make CONCURRENCY=shell
     behave like CONCURRENTY=startpar, as startpar concurrency now work
     properly.
Checksums-Sha1: 
 77ff3ecfa1130e320dacfaec70b044d381c85fca 1483 sysvinit_2.86.ds1-62.dsc
 0fe9f119888b22ab789e2b9babeabcb95efb0b5d 155616 sysvinit_2.86.ds1-62.diff.gz
 81cb9e47352efc1de8e72c31d3b4f7c6c4c6d69f 103082 sysvinit_2.86.ds1-62_i386.deb
 34da4a531585d44301ece3088c5981d687a002c5 86618 sysvinit-utils_2.86.ds1-62_i386.deb
 f2f446c6e5c9fdbb1c93822fa33e209967d09545 69010 initscripts_2.86.ds1-62_i386.deb
 a2ebfd00011db4f3d0609634b2409acba7e14826 65638 sysv-rc_2.86.ds1-62_all.deb
Checksums-Sha256: 
 89db98da56f8c2417aee098f44cc301c2821409bbe1682515a86fa311363c843 1483 sysvinit_2.86.ds1-62.dsc
 f655ed6fdfd2591dadc399aaae9fe6dc1782d165feb908ff240b7ad2d1f0e4f2 155616 sysvinit_2.86.ds1-62.diff.gz
 718dfa0d930d38130358cef22d5b86ae2e078eb7ea9615b6a75a3ed8307128f8 103082 sysvinit_2.86.ds1-62_i386.deb
 ab26b862341d93190797c4b79bcd4acf25185eccb12f6127b98954cbf667ba60 86618 sysvinit-utils_2.86.ds1-62_i386.deb
 bf8f5330b35ba5ea5a42fbd43d8d43dcf893534983114a83d5daff7db2d6031f 69010 initscripts_2.86.ds1-62_i386.deb
 bf3e86f69effe488a950c8c04955505e6dedb73d577b6c038edab4c4376092d3 65638 sysv-rc_2.86.ds1-62_all.deb
Files: 
 8aff0cbff66ff250babf4be897c88dda 1483 admin required sysvinit_2.86.ds1-62.dsc
 6dd9d90daa7384f24198e2a20534d9cd 155616 admin required sysvinit_2.86.ds1-62.diff.gz
 88235b6992eccdbc9689efd79c021149 103082 admin required sysvinit_2.86.ds1-62_i386.deb
 40006b5c47ecd8e7af6f2fb0356eecbe 86618 admin required sysvinit-utils_2.86.ds1-62_i386.deb
 a8cd6f0d2982e6cfb7489d56a449f079 69010 admin required initscripts_2.86.ds1-62_i386.deb
 2b8ebaa8b9a72a66abf0e7c5ffb90fd9 65638 admin required sysv-rc_2.86.ds1-62_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFKQQiC20zMSyow1ykRAjJ7AKDts2KBER9fjpOcCIrHnwyy9aR/xgCgy0r5
ZBq+xDveg/S8a8ikptgAiC0=
=O+4B
-----END PGP SIGNATURE-----





Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Wed, 22 Jul 2009 07:29:23 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Apr 17 19:15:45 2014; Machine Name: buxtehude.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.