rc.d standardization patch

Kevin L. Kane kevin.kane at gmail.com
Sun Aug 6 15:26:11 PDT 2006

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:
On 02 Aug 2006 12:58:35 GMT, Oliver Fromme
<check+j3df9e00rshfwkvl at 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\"


    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 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

More information about the Submit mailing list