Date: Wed, 28 Dec 2011 09:05:58 +0400 From: Eygene Ryabinkin <rea@freebsd.org> To: freebsd-rc@freebsd.org Cc: gordon@freebsd.org Subject: Usage of the err() inside rc.d scripts Message-ID: <z2SB6G389aCpk5QE%2BnG6/SgVglc@YnbH/K3/Y1Z96RV2jTofcGuSPJI>
next in thread | raw e-mail | index | archive | help
--da4uJneut+ArUgXk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 =2E/bluetooth =2E/ipfilter =2E/ipfs =2E/jail =2E/mdconfig =2E/mdconfig2 =2E/named =2E/nfsd =2E/ipmon =2E/routing =2E/netif =2E/accounting =2E/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=3D98186&view=3Dm= arkup {{{ 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. --=20 Eygene Ryabinkin ,,,^..^,,, [ Life's unfair - but root password helps! | codelabs.ru ] [ 82FE 06BC D497 C0DE 49EC 4FF0 16AF 9EAE 8152 ECFB | freebsd.org ] --da4uJneut+ArUgXk Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EAREIAAYFAk76o7UACgkQFq+eroFS7PtNcwD/fX3GVLlZWt2ZLQ4LoFXkW4P0 xviZvbKZkDlThFQywOUA/2crfXTk2ElMxKILYmtsY5CKuXSYa2zWGg/HCWBJ30va =3WVt -----END PGP SIGNATURE----- --da4uJneut+ArUgXk--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?z2SB6G389aCpk5QE%2BnG6/SgVglc>