Bug 193255

Summary: Error on custom local_unbound configuration
Product: Base System Reporter: garrych <garrych>
Component: confAssignee: Dag-Erling Smørgrav <des>
Status: Closed FIXED    
Severity: Affects Some People CC: des, hrs
Priority: Normal Keywords: patch-ready
Version: 10.0-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
move load_rc_config command
none
A patch to add the default values into etc/defaults/rc.conf.
none
Revised patch to add the default values into etc/defaults/rc.conf.
none
/etc/rc.d/local_unbound patch none

Description garrych 2014-09-02 13:46:35 UTC
If I add some local_unbound_* configuration parameters to /etc/rc.conf they are overwritten by startup script.

I've moved the first occurrence of a string "load_rc_config $name" before evaluating these parameters.
Comment 1 garrych 2014-09-02 13:48:26 UTC
Created attachment 146680 [details]
move load_rc_config command
Comment 2 Hiroki Sato freebsd_committer freebsd_triage 2014-09-05 06:52:52 UTC
Created attachment 146844 [details]
A patch to add the default values into etc/defaults/rc.conf.

It is wrong that the default values are defined in the current script, not the location of load_rc_config().  Can you try the attached patch and let me know if it works or not?
Comment 3 garrych 2014-09-05 10:46:25 UTC
(In reply to Hiroki Sato from comment #2)
> Created attachment 146844 [details]
> A patch to add the default values into etc/defaults/rc.conf.
> 
> It is wrong that the default values are defined in the current script, not
> the location of load_rc_config().  Can you try the attached patch and let me
> know if it works or not?

Thanks. Will try it out. But will it work:

do_as_unbound ${unbound_program%/*}/unbound-anchor

I don't see ${unbound_program%/* defined.
Comment 4 Hiroki Sato freebsd_committer freebsd_triage 2014-09-08 09:14:55 UTC
Created attachment 147052 [details]
Revised patch to add the default values into etc/defaults/rc.conf.

Sorry, there were typos in the previous patch.  Please try this one.  Thank you.
Comment 5 commit-hook freebsd_committer freebsd_triage 2014-09-08 09:33:57 UTC
A commit references this bug:

Author: des
Date: Mon Sep  8 09:33:43 UTC 2014
New revision: 271257
URL: http://svnweb.freebsd.org/changeset/base/271257

Log:
  Use the correct idiom for default values, and ensure that the script
  works correctly if the user overrides them.

  PR:		193255
  Submitted by:	hrs@
  MFC after:	3 days

Changes:
  head/etc/defaults/rc.conf
  head/etc/rc.d/local_unbound
Comment 6 Hiroki Sato freebsd_committer freebsd_triage 2014-09-08 10:03:29 UTC
My apologies.  Garret pointed out a typo in my patch to defaults/rc.conf:

 +local_unbound_forwardconf="${local_unbound_workdir}/forward.conf}"

(extra "}")
Comment 7 garrych 2014-09-08 10:24:26 UTC
local_unbound_flags="-c${local_unbound_config}" should definitely be evaluated later in a code. If I setup my custom config file in /etc/rc.conf for local_unbound it will not pass to through local_unbound_flags to the daemon.
Comment 8 garrych 2014-09-08 11:38:37 UTC
Created attachment 147061 [details]
/etc/rc.d/local_unbound patch

Evaluate local_unbound_flags later in the startup script.
Comment 9 Glen Barber freebsd_committer freebsd_triage 2015-07-08 17:37:24 UTC
Close PRs that have a corresponding commit to resolve the issue.