On Sun, Mar 15, 2015 at 07:08:52PM +0200, Igor Konforti wrote:
> I was writing Deamon by name "/etc/rc.d/example-client" and all a time I
> was getting error that ${daemon_user} is "client"
> 
> After looking at source code of rc.subr
> <http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/etc/rc.d/rc.subr?rev=1.92&content-type=text/x-cvsweb-markup>
> I
> saw the following:
> 
> 
> ```
>  _name=$(basename $0)
> eval _rcuser=\${${_name}_user}
> [ -n "${_rcuser}" ] && daemon_user=${_rcuser}
> ```
> 
> So, if we have  a deamon by name "example-client" because of eval there
> will be always $daemon_user:
> 
> ```
> -bash-4.2# eval _rcuser=\${example-client_user}
> -bash-4.2# echo $_rcuser
> client_user
> ```
> 
> 
> I'm not sure if this is bug or the feature, therefore I'm posting this in
> misc but if you guys confirm it is a bug I'll send it to bugs@
> This of course can be really fixed really easy.

man rc.subr:

<...>
DESCRIPTION
     Apart from a few notable exceptions, rc scripts must follow this naming
     policy:

     1.   Use the same name as the daemon it is referring to.
     2.   Dashes (‘-’) have to be converted to underscores (‘_’).

-- 
Antoine

Reply via email to