DragonFly BSD
DragonFly submit List (threaded) for 2006-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Re: rc.d standardization patch


From: "Kevin L. Kane" <kevin.kane@xxxxxxxxx>
Date: Sun, 6 Aug 2006 18:20:45 -0400

I updated the patch to include ifconfig.if support and man page.  I
took olivers suggestion and changed my eval statement some.  I also
pulled in some changes from rc.subr in netbsd, I left out a couple
that didnt seem relevant like _systrace support, some perl daemon
stuff that seemed like we already had it, and also some other minor
changes that we already had.

still availabe at:
http://www.uberstyle.net/~kevin/rcenable.diff

On 02 Aug 2006 12:58:35 GMT, Oliver Fromme
<check+j3df9e00rshfwkvl@xxxxxxxxxx> wrote:
Kevin L. Kane wrote:
 > Simon 'corecode' Schubert wrote:
 > > Kevin L. Kane wrote:
 > > > [...]
 > > > +     eval _value=\$${1}_enable
 > > [...]
 > >      eval \$${1}=\$${1}_enable
 > [...]
 > I just updated patch with a simplified block along the lines you said.
 > except:
 > eval ${1}=$_value

You have to be very careful with "eval" in shell scripts.
It is best to always escape dollar signs on the right, so
they're expanded on the second pass, not on the first, and
enclose the whole expression in escaped double quotes:

eval $1=\"\$_value\"

or:

eval $1='"$_value"'

That's the _only_ way that will always work if the value
of the variable contains white space, semicolons or other
nasty things.  If the value comes from a configuration file
and hasn't be checked for errors, then you cannot guarantee
that it's "clean".  You probably don't want your rc scripts
abort due to a shell syntax error during boot just because
you accidentally inserted a space in one of the variables.
;-)

Best regards
   Oliver

--
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd

Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.



--
Kevin L. Kane
kevin.kane at gmail.com



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]