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