nsd_flags

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

nsd_flags

Maurice Janssen-2
Hi,

I just upgraded my nameserver to 5.6-stable and noticed the following
line in /etc/rc.conf:

nsd_flags=NO            # for normal use: "-c /var/nsd/etc/nsd.conf"

However, /etc/rc.d/nsd contains the following line:
daemon_flags="-c /var/nsd/etc/nsd.conf"

I suppose the comment in rc.conf should be: for normal use: ""
Just like most other services.  Is that correct?

Thanks,
Maurice

Reply | Threaded
Open this post in threaded view
|

Re: nsd_flags

David  Dahlberg
Am Donnerstag, den 06.11.2014, 21:24 +0100 schrieb Maurice Janssen:

> I suppose the comment in rc.conf should be: for normal use: ""
> Just like most other services.  Is that correct?

A look into rc.subr:

| eval _rcflags=\${${_name}_flags}
[..]
| [ -n "${_rcflags}" ] && daemon_flags=${_rcflags}

Seems that you are correct. Default flags are used when the script is
not configured in rc.conf.local (i.e. started by distribution default,
script started with "-f" or package script), or when flags="".

So how do you define a service to start without any flags set? Seems up
to 5.5 you would have to set ${daemon}_flags=" ". But does this still
work with the parsed rc.conf.local from 5.6?

| _val=${_l##*([!=])=*([[:blank:]])}
| _val=${_val%%#*}
| _val=${_val%%*([[:blank:]])}
| # remove leading and trailing quotes (backwards compat)
| [[ $_val == @(\"*\"|\'*\') ]] && _val=${_val#?} _val=${_val%?}

Looks like _val is being trimmed. So " " should still work as "backwards
compat".

For me the question is, whether there is a usecase for starting a rc.d
script (which has defined default) flags without any flags. If so, the
line "[ -n "${_rcflags}" ] && daemon_flags=${_rcflags}" should probably
be changed to just "daemon_flags=${_rcflags}" (the rc.conf manpage
implies this behaviour) or the manpage should be changed accordingly.

Regards
        David

--
David Dahlberg    

Fraunhofer FKIE, Dept. Communication Systems (KOM) | Tel: +49-228-9435-845
Fraunhoferstr. 20, 53343 Wachtberg, Germany        | Fax: +49-228-856277

Reply | Threaded
Open this post in threaded view
|

Re: nsd_flags

Ingo Schwarze
Hi,

David Dahlberg wrote on Fri, Nov 07, 2014 at 08:11:50AM +0000:
> Am Donnerstag, den 06.11.2014, 21:24 +0100 schrieb Maurice Janssen:

>> I suppose the comment in rc.conf should be: for normal use: ""
>> Just like most other services.  Is that correct?

It doesn't really matter, IMHO.  Both are OK.

Maybe all the "for normal use" comments should be removed,
because, well, by definition, the default flags are the flags
for normal use.  But i'm not going to spend time on pushing
that right now.

> A look into rc.subr:
>
> | eval _rcflags=\${${_name}_flags}
> [..]
> | [ -n "${_rcflags}" ] && daemon_flags=${_rcflags}
>
> Seems that you are correct. Default flags are used when the script is
> not configured in rc.conf.local (i.e. started by distribution default,
> script started with "-f" or package script), or when flags="".

Yes.

> So how do you define a service to start without any flags set? Seems up
> to 5.5 you would have to set ${daemon}_flags=" ". But does this still
> work with the parsed rc.conf.local from 5.6?

Yes.

> | _val=${_l##*([!=])=*([[:blank:]])}
> | _val=${_val%%#*}
> | _val=${_val%%*([[:blank:]])}
> | # remove leading and trailing quotes (backwards compat)
> | [[ $_val == @(\"*\"|\'*\') ]] && _val=${_val#?} _val=${_val%?}
>
> Looks like _val is being trimmed. So " " should still work as "backwards
> compat".

Yes, the comment about "backwards compat" is slightly misleading,
"needed to preserve trailing blanks" might be nearer the mark.

> For me the question is, whether there is a usecase for starting a rc.d
> script (which has defined default) flags without any flags.

identd(8) starts with -e by default, and you might wish to start
it without any flags, for example.

> If so, the
> line "[ -n "${_rcflags}" ] && daemon_flags=${_rcflags}"
> should probably be changed to just "daemon_flags=${_rcflags}"

No, that would result in *never* running with default flags,
not even when _rcflags == "".

The line is correct as it stands.  Note:

   $ [ -n " " ]; echo $?
  0
   $ [ -n "" ]; echo $?  
  1

Yours,
  Ingo