Bug 177217

Summary: [patch] rc.d/ddb -- squelch warning when ddb_enable=yes but DDB missing from kernel
Product: Base System Reporter: Jeremy Chadwick <jdc>
Component: confAssignee: freebsd-bugs mailing list <bugs>
Status: Open ---    
Severity: Affects Only Me    
Priority: Normal    
Version: 9.1-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Jeremy Chadwick 2013-03-22 01:20:00 UTC
	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.

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).

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"
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2013-03-22 21:55:22 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

Over to maintainer(s).
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:55 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped