From owner-freebsd-rc@FreeBSD.ORG Wed Dec 28 05:06:02 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12FB7106566B; Wed, 28 Dec 2011 05:06:02 +0000 (UTC) (envelope-from rea@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id ADED48FC12; Wed, 28 Dec 2011 05:06:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=codelabs.ru; s=two; h=Sender:Content-Type:MIME-Version:Message-ID:Subject:Cc:To:From:Date; bh=m6FhYif8hTTL5KdPy0g/TcjVl3uMHC1PcWNkTC28Jbg=; b=d/lG/0335DPzQ1EgojbQl7VxlFn+iAtlkG4UbgD7dQs05UfTUWARk6Sl4Td45k4X7XLpWAk2P89dIQgzI/E5qI/oKi9uuOYxqduSMMfq3wujx7kBSlBrOON+sEnOzYZLSBes/yD+UZm9oSWy4ARVqM2GxxyHrpdy+600AYuwGj2QRZ7/vzP2WCFJsT5+EfkHPjnNMTacEtlTiqymtMIpMe2pIIjJIYYZNdyPtFtMAxJ1JkmWZ0nyo8SGVVWXwZTn7R/rxW30crgozmklDiXarJgr8ebNy0Msr6gOcNdUj5co9V7ToCoMX5XL+qnv+3Qc4oeRkZUFsYuMTpgTLVxJuA==; Received: from shadow.codelabs.ru (ppp91-77-174-173.pppoe.mtu-net.ru [91.77.174.173]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1RfliC-0006Kd-DL; Wed, 28 Dec 2011 08:06:00 +0300 Date: Wed, 28 Dec 2011 09:05:58 +0400 From: Eygene Ryabinkin To: freebsd-rc@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="da4uJneut+ArUgXk" Content-Disposition: inline Sender: rea@codelabs.ru Cc: gordon@freebsd.org Subject: Usage of the err() inside rc.d scripts X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2011 05:06:02 -0000 --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--