>Number: 177217 >Category: conf >Synopsis: rc.d/ddb -- squelch warning when ddb_enable=yes but DDB >missing from kernel >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 22 01:20:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Jeremy Chadwick >Release: FreeBSD 9.1-STABLE amd64 >Organization: >Environment: System: FreeBSD icarus.home.lan 9.1-STABLE FreeBSD 9.1-STABLE #0 r248403: Sat Mar 16 20:33:01 PDT 2013 r...@icarus.home.lan:/usr/obj/usr/src/sys/X7SBA_RELENG_9_amd64 amd64 >Description: If a user has ddb_enable="yes" in rc.conf, but their kernel is lacking "options DDB" and friends, then the following message is shown during boot:
/etc/rc.d/ddb: WARNING: failed precmd routine for ddb The reason is that returning 1 from inside of precmd causes rc.subr to emit the above warning. Returning 0 would cause rc.subr to continue on and try to run /sbin/ddb, which emits even more errors. IMO, the simplest way to solve this dillema is to use "exit 1" and bail out of the rc.d script ASAP; some other rc.d scripts use this method as well. To make this fact clearer to future committers/readers, I added an explanation comment. I also added use of $SYSCTL_N to be consistent with other scripts. I should note I did try getting rid of the precmd stuff and instead making a ddb_start() routine + doing the necessary magic, but this induces all sorts of edge cases/nuances relating to required_files and command_args and some other things. exit 1 just seems easier. If someone has a better/cleaner method, I'm happy to test such. >How-To-Repeat: 1. Set ddb_enable="yes" in rc.conf on a system lacking DDB support in the kernel 2. Run "/etc/rc.d/ddb start" >Fix: Patch is below, and will be available at the following URL one I get a PR number: http://jdc.koitsu.org/freebsd/{prnum}/ Verified as working on stable/9 (r248403). Index: etc/rc.d/ddb =================================================================== --- etc/rc.d/ddb (revision 248604) +++ etc/rc.d/ddb (working copy) @@ -19,8 +19,11 @@ stop_cmd=":" ddb_prestart() { # Silently exit if ddb is not enabled - if [ -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then - return 1 + # NOTE: exit is needed here, not return, else rc.subr emits + # a "failed precmd routine" warning when ddb_enable="yes" is + # used on a system which lacks DDB support in the kernel. + if [ -z "`$SYSCTL_N -q debug.ddb.scripting.scripts`" ]; then + exit 1 fi } >Release-Note: >Audit-Trail: >Unformatted: _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"