[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

About /etc/rcS.d/*.sh being sourced



Hi Miquel,

You told me some time ago that the /etc/rcS.d/*.sh files get
*sourced*, and not exec'd.  However, as it's not documented anywhere
AFAIK, I wanted to be sure of this.  I wrote a little script that
installed in /etc/rcS.d as S20test.sh:

===
#! /bin/bash

echo "S20test.sh: Testing who I am: $0"
echo "Testing argument 1: $1"
===

The output was:

====
S20test.sh: Testing who I am: /etc/init.d/rcS
Testing argument 1: 
====

I'd like to outline problems that seems quite big to me:

As all init.d script, the scripts to be put in /etc/init.d/ and
referenced from /etc/rcS.d/ should be call-able from any other rc?.d,
if I remember your explanation well enough.  Then their use is ruled
by section 3.4 of the policy, which demands that they answer to
"start/stop/etc." arguments, which is IMHO not doable in a sourced
script.

You'll note that the rcS script gets called with no argument, but that
may be changed easily in inittab.  However the other problem is more
important:

It also causes big problems with flow control, especially about
"exit", and about shell settings: one may use "set +e" or "exit" in
such a script, and this will break the system badly.

You'll notice that most scripts written for rc[0-9].d/ make use of set
and exit, and thus developpers are quite likely to shoot themselves in
the foot while experimenting.


So please tell me if my analysis is correct, whether this feature is
documented, and whether my fears are grounded.

In this case, I'd suggest that this feature gets removed, whatever
delay this may introduce at boot-time.

--
Yann Dirson  <ydirson@a2points.com>      | Stop making M$-Bill richer & richer,
alt-email:     <dirson@univ-mlv.fr>      |     support Debian GNU/Linux:
debian-email:   <dirson@debian.org>      |         more powerful, more stable !
http://www.a2points.com/homepage/3475232 | Check <http://www.debian.org/>


--
E-mail the word "unsubscribe" to debian-devel-request@lists.debian.org
TO UNSUBSCRIBE FROM THIS MAILING LIST. Trouble?  E-mail to listmaster@debian.org .


Reply to: