On Tue, Apr 05, 2011 at 02:08:57PM +0200, Otto Moerbeek wrote:
> On Tue, Apr 05, 2011 at 01:47:52PM +0200, Antoine Jacoutot wrote:
>
> > On Tue, 5 Apr 2011, Piotr Sikora wrote:
> >
> > > Hello,
> > > $daemon_flags are sanitized using echo and tr, but the input isn't quoted,
> > > which makes it indistinguishable from echo's options. Effect of this is
> > > that
> > > when $daemon_flags starts with "-n" then this argument is lost in the
> > > process.
> >
> > Good catch!
> > Committed, thanks.
>
> Ehh
>
> echo "-n"
>
> still echoes nothing. Or am I missing something?
you likely want sth as:
echo '' "${daemon_flags}
(no -- handling for echo)
>
> -Otto
> >
> >
> > >
> > > Best regards,
> > > Piotr Sikora < [email protected] >
> > >
> > >
> > > Index: rc.subr
> > > ===================================================================
> > > RCS file: /cvs/src/etc/rc.d/rc.subr,v
> > > retrieving revision 1.30
> > > diff -u -r1.30 rc.subr
> > > --- rc.subr 25 Mar 2011 10:03:26 -0000 1.30
> > > +++ rc.subr 5 Apr 2011 10:59:08 -0000
> > > @@ -116,6 +116,6 @@
> > > [ -n "${_rcflags}" ] && daemon_flags=${_rcflags}
> > > [ -n "${_rcuser}" ] && daemon_user=${_rcuser}
> > >
> > > -daemon_flags=$(echo ${daemon_flags} | tr -s "[:space:]")
> > > +daemon_flags=$(echo "${daemon_flags}" | tr -s "[:space:]")
> > > pexp="${daemon}${daemon_flags:+ ${daemon_flags}}"
> > > rcexec="su -l -c ${daemon_class} -s /bin/sh ${daemon_user} -c"
> > >
> > >
> >
> > --
> > Antoine