Usage of the err() inside rc.d scripts

Eygene Ryabinkin rea at freebsd.org
Wed Dec 28 05:06:02 UTC 2011


Good day.

After analyzing my conversation with Doug Barton about 'return' vs
'exit' in the rc.d script I had found the weak point in my arguments:
when rc_fast_and_loose is set, rc.d scripts are directly sourced
into the /etc/rc, so any call to 'exit' will interrupt /etc/rc
in this case.  The function err() from rc.subr does call 'exit'
and for -CURRENT I see at least 13 scripts that use err() to signify
run-time or configuration errors:
{{{
$ grep -r 'err[[:space:]]*[0-9]' . | cut -f 1 -d : | uniq
./bluetooth
./ipfilter
./ipfs
./jail
./mdconfig
./mdconfig2
./named
./nfsd
./ipmon
./routing
./netif
./accounting
./netwait
}}}
power_profile and dhclient were pruned from the list, because they
err() only on the bad usage.

Looks like that rc_fast_and_loose isn't used much, because otherwise
some machines will go single-user on a certain failures of the above
scripts.

CURRENTly, no things in /etc use or set rc_fast_and_loose, apart from
the /etc/rc.subr itself: it only checks its value inside run_rc_script.


rc_fast_and_loose was introduced in
  http://svnweb.freebsd.org/base/head/etc/rc.subr?revision=98186&view=markup
{{{
Revision 98186
Thu Jun 13 22:19:42 2002 UTC (9 years, 6 months ago) by gordon
File size: 23163 byte(s)

Bring this up to date with the latest NetBSD bits. Also add some bits of
our own.

Submitted by:	Mike Makonnen
Reviewed by:	silence on -current and -hackers
}}}
but I can't extract any useful bits regarding the need of
rc_fast_and_loose from this.

So, the question is: what is it good for and how people use it?

Thanks.
-- 
Eygene Ryabinkin                                        ,,,^..^,,,
[ Life's unfair - but root password helps!           | codelabs.ru ]
[ 82FE 06BC D497 C0DE 49EC  4FF0 16AF 9EAE 8152 ECFB | freebsd.org ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-rc/attachments/20111228/51dc01db/attachment.pgp


More information about the freebsd-rc mailing list