misc/164011: comments in rc.conf cause system loading

Matthew Story matthewstory at gmail.com
Wed Jan 11 08:00:31 UTC 2012


The following reply was made to PR misc/164011; it has been noted by GNATS.

From: Matthew Story <matthewstory at gmail.com>
To: bug-followup at FreeBSD.org
Cc:  
Subject: Re: misc/164011: comments in rc.conf cause system loading
Date: Wed, 11 Jan 2012 02:24:36 -0500

 --f46d043c7c941cc30b04b63b8645
 Content-Type: text/plain; charset=ISO-8859-1
 
 On Wed, Jan 11, 2012 at 1:38 AM, Eugen Konkov <kes-kes at yandex.ru> wrote:
 
 > >How-To-Repeat:
 > If I put this line All is ok
 > ifconfig_vlan7="inet 10.11.19.149 netmask 255.255.255.248 vlan 7 vlandev
 > re0" #
 > When I do not keep space between " and #
 > ifconfig_vlan7="inet 10.11.19.149 netmask 255.255.255.248 vlan 7 vlandev
 > re0"#
 >
 rc.conf uses sh(1) syntax, per the man page:
      Options are set with ``name=value'' assignments that use sh(1) syntax.
      The following list provides a name and short description for each vari-
      able that can be set in the rc.conf file:
 (via man 5 rc.conf)
 
 per the POSIX specification, `#' only denotes a comment if it occurs at the
 beginning of a word:
 
 When it is not processing an *io_here*, the shell shall break its input
 into tokens by applying the first applicable rule below to the next
 character in its input. The token shall be from the current position in the
 input until a token is delimited according to one of the rules below; the
 characters forming the token are exactly those in the input, including any
 quoting characters. If it is indicated that a token is delimited, and no
 characters have been included in a token, processing shall continue until
 an actual token is delimited.
 [...snip]
 
 10. If the current character is a '#', it and all subsequent characters up
 to, but excluding, the next <newline> shall be discarded as a comment. The
 <newline> that ends the line is not considered part of the comment.
 
 via:
 http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
 
 In your given example:
 
 "inet 10.11.19.149 netmask 255.255.255.248 vlan 7 vlandev re0"#
 
 shell is still constructing a word (for assignemnt), which will result in
 the assignment of:
 
 inet 10.11.19.149 netmask 255.255.255.248 vlan 7 vlandev re0#
 
 to ifconfig_vlan.
 
 A relevant snippit from "The UNIX Programming Environment" below:
 
 The metacharacter # is almost universally used for shell comments; if a
 shell word begins with #, the rest of the lineis ignored:
 
 
 $ echo hello # there
 
 hello
 
 $ echo hello#there
 
 hello#there
 
 $
 
 (page 77)
 
 -- 
 regards,
 matt
 
 --f46d043c7c941cc30b04b63b8645
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 <span class=3D"Apple-style-span" style=3D"font-family:arial,sans-serif;font=
 -size:13px;border-collapse:collapse;color:rgb(34,34,34)"><div class=3D"im" =
 style=3D"color:rgb(80,0,80)"><div>On Wed, Jan 11, 2012 at 1:38 AM, Eugen Ko=
 nkov=A0<span dir=3D"ltr">&lt;<a href=3D"mailto:kes-kes at yandex.ru" target=3D=
 "_blank" style=3D"color:rgb(17,85,204)">kes-kes at yandex.ru</a>&gt;</span>=A0=
 wrote:</div>
 </div><div><div class=3D"gmail_quote"><div class=3D"im" style=3D"color:rgb(=
 80,0,80)"><blockquote class=3D"gmail_quote" style=3D"margin-top:0px;margin-=
 right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-=
 left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
 &gt;How-To-Repeat:<br>If I put this line All is ok<br>ifconfig_vlan7=3D&quo=
 t;inet 10.11.19.149 netmask 255.255.255.248 vlan 7 vlandev re0&quot; #<br>W=
 hen I do not keep space between &quot; and #<br>ifconfig_vlan7=3D&quot;inet=
  10.11.19.149 netmask 255.255.255.248 vlan 7 vlandev re0&quot;#<br>
 </blockquote></div>rc.conf uses sh(1) syntax, per the man page:<div><div>=
 =A0=A0 =A0 Options are set with ``name=3Dvalue&#39;&#39; assignments that u=
 se sh(1) syntax.</div><div>=A0=A0 =A0 The following list provides a name an=
 d short description for each vari-</div>
 <div>=A0=A0 =A0 able that can be set in the rc.conf file:</div></div><div>(=
 via man 5 rc.conf)</div><div><br></div><div>per the POSIX specification, `#=
 &#39; only denotes a comment if it occurs at the beginning of a word:</div>=
 <div>
 <br></div><div><span style=3D"font-family:Verdana,Arial,Helvetica,sans-seri=
 f;font-size:13px">When it is not processing an=A0<b>io_here</b>, the shell =
 shall break its input into tokens by applying the first applicable rule bel=
 ow to the next character in its input. The token shall be from the current =
 position in the input until a token is delimited according to one of the ru=
 les below; the characters forming the token are exactly those in the input,=
  including any quoting characters. If it is indicated that a token is delim=
 ited, and no characters have been included in a token, processing shall con=
 tinue until an actual token is delimited.</span></div>
 <div><span style=3D"font-family:Verdana,Arial,Helvetica,sans-serif;font-siz=
 e:13px">[...snip]</span></div><div><span style=3D"font-family:Verdana,Arial=
 ,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style=3D"=
 font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px">10. If the c=
 urrent character is a=A0<tt>&#39;#&#39;</tt>, it and all subsequent charact=
 ers up to, but excluding, the next &lt;newline&gt; shall be discarded as a =
 comment. The &lt;newline&gt; that ends the line is not considered part of t=
 he comment.</span></div>
 <div><br></div><div><span style=3D"font-family:Verdana,Arial,Helvetica,sans=
 -serif;font-size:13px"></span>via:=A0<a href=3D"http://pubs.opengroup.org/o=
 nlinepubs/009695399/utilities/xcu_chap02.html" target=3D"_blank" style=3D"c=
 olor:rgb(17,85,204)">http://pubs.opengroup.org/onlinepubs/009695399/utiliti=
 es/xcu_chap02.html</a></div>
 <div><br></div><div>In your given example:</div><div class=3D"im" style=3D"=
 color:rgb(80,0,80)"><div><br></div><div>&quot;inet 10.11.19.149 netmask 255=
 .255.255.248 vlan 7 vlandev re0&quot;#</div><div><br></div></div><div>shell=
  is still constructing a word (for assignemnt), which will result in the as=
 signment of:</div>
 <div class=3D"im" style=3D"color:rgb(80,0,80)"><div><br></div><div>inet 10.=
 11.19.149 netmask 255.255.255.248 vlan 7 vlandev re0#</div><div><br></div><=
 /div><div>to=A0ifconfig_vlan.=A0</div><div><br></div><div><font face=3D"ari=
 al, helvetica, sans-serif">A relevant snippit from &quot;The UNIX Programmi=
 ng Environment&quot; below:</font></div>
 <div><font face=3D"arial, helvetica, sans-serif"><br></font></div><div><p s=
 tyle=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;f=
 ont:normal normal normal 9.8px/normal Times;color:rgb(23,23,18)"><span styl=
 e=3D"font:normal normal normal 9.9px/normal Times"><span style=3D"font-size=
 :small"><font face=3D"arial, helvetica, sans-serif">The=A0</font></span></s=
 pan><span style=3D"font-size:small"><font face=3D"arial, helvetica, sans-se=
 rif">metacharacter=A0</font></span><span style=3D"font:normal normal normal=
  8.7px/normal Times"><span style=3D"font-size:small"><font face=3D"arial, h=
 elvetica, sans-serif">#=A0</font></span></span><span style=3D"font-size:sma=
 ll"><font face=3D"arial, helvetica, sans-serif">is=A0</font></span><span st=
 yle=3D"color:rgb(37,39,33)"><span style=3D"font-size:small"><font face=3D"a=
 rial, helvetica, sans-serif">almost=A0</font></span></span><span style=3D"f=
 ont-size:small"><font face=3D"arial, helvetica, sans-serif">universally use=
 d for=A0</font></span><span style=3D"color:rgb(37,39,33)"><span style=3D"fo=
 nt-size:small"><font face=3D"arial, helvetica, sans-serif">shell=A0</font><=
 /span></span><span style=3D"font-size:small"><font face=3D"arial, helvetica=
 , sans-serif">comments; if a shell word begins with=A0</font></span><span s=
 tyle=3D"font:normal normal normal 9.7px/normal Times"><span style=3D"font-s=
 ize:small"><font face=3D"arial, helvetica, sans-serif">#,=A0</font></span><=
 /span><span style=3D"font:normal normal normal 9.8px/normal Times"><span st=
 yle=3D"font-size:small"><font face=3D"arial, helvetica, sans-serif">the=A0<=
 /font></span></span><span style=3D"font-size:small"><font face=3D"arial, he=
 lvetica, sans-serif">rest=A0</font></span><span style=3D"font:normal normal=
  normal 10px/normal Times;color:rgb(37,39,33)"><span style=3D"font-size:sma=
 ll"><font face=3D"arial, helvetica, sans-serif">of=A0</font></span></span><=
 span style=3D"font-size:small"><font face=3D"arial, helvetica, sans-serif">=
 the line</font></span><span style=3D"font:normal normal normal 9.6px/normal=
  Times"><span style=3D"font-size:small"><font face=3D"arial, helvetica, san=
 s-serif">is=A0</font></span></span><span style=3D"font-size:small"><font fa=
 ce=3D"arial, helvetica, sans-serif">ignored:</font></span></p>
 <p style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0=
 px;font:normal normal normal 9.8px/normal Times;color:rgb(23,23,18)"><span =
 style=3D"font-size:small"><font face=3D"arial, helvetica, sans-serif"><br><=
 /font></span></p>
 <p style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0=
 px;font:normal normal normal 9.8px/normal Times;color:rgb(23,23,18)"><span =
 style=3D"font:normal normal normal 7.9px/normal Times"><span style=3D"font-=
 size:small"><font face=3D"arial, helvetica, sans-serif">$=A0</font></span><=
 /span><span style=3D"font:normal normal normal 9.4px/normal Times"><span st=
 yle=3D"font-size:small"><font face=3D"arial, helvetica, sans-serif">echo=A0=
 </font></span></span><span style=3D"font:normal normal normal 10.3px/normal=
  Times"><span style=3D"font-size:small"><font face=3D"arial, helvetica, san=
 s-serif">hello=A0</font></span></span><span style=3D"font:normal normal nor=
 mal 7.7px/normal Times;color:rgb(37,39,33)"><span style=3D"font-size:small"=
 ><font face=3D"arial, helvetica, sans-serif">#=A0</font></span></span><span=
  style=3D"font:normal normal normal 9.9px/normal Times"><span style=3D"font=
 -size:small"><font face=3D"arial, helvetica, sans-serif">there=A0</font></s=
 pan></span></p>
 <p style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0=
 px;font:normal normal normal 9.8px/normal Times;color:rgb(23,23,18)"><span =
 style=3D"font:normal normal normal 9.9px/normal Times"><span style=3D"font-=
 size:small"><font face=3D"arial, helvetica, sans-serif"></font></span></spa=
 n><span style=3D"font:normal normal normal 10.2px/normal Times"><span style=
 =3D"font-size:small"><font face=3D"arial, helvetica, sans-serif">hello=A0</=
 font></span></span></p>
 <p style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0=
 px;font:normal normal normal 9.8px/normal Times;color:rgb(23,23,18)"><span =
 style=3D"font:normal normal normal 10.2px/normal Times"><span style=3D"font=
 -size:small"><font face=3D"arial, helvetica, sans-serif"></font></span></sp=
 an><span style=3D"font:normal normal normal 7.9px/normal Times"><span style=
 =3D"font-size:small"><font face=3D"arial, helvetica, sans-serif">$=A0</font=
 ></span></span><span style=3D"font:normal normal normal 9.4px/normal Times"=
 ><span style=3D"font-size:small"><font face=3D"arial, helvetica, sans-serif=
 ">echo=A0</font></span></span><span style=3D"font:normal normal normal 9.8p=
 x/normal Times"><span style=3D"font-size:small"><font face=3D"arial, helvet=
 ica, sans-serif">hello#there=A0</font></span></span></p>
 <p style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0=
 px;font:normal normal normal 9.8px/normal Times;color:rgb(23,23,18)"><span =
 style=3D"font:normal normal normal 9.8px/normal Times"><span style=3D"font-=
 size:small"><font face=3D"arial, helvetica, sans-serif"></font></span></spa=
 n><span style=3D"font:normal normal normal 10.1px/normal Times"><span style=
 =3D"font-size:small"><font face=3D"arial, helvetica, sans-serif">hello#ther=
 e</font></span></span></p>
 <p style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0=
 px;font:normal normal normal 7.9px/normal Times;color:rgb(23,23,18)"><span =
 style=3D"font-size:small"><font face=3D"arial, helvetica, sans-serif">$</fo=
 nt></span></p>
 </div></div><div><br></div>(page 77)</div></span><div><br></div>-- <br>rega=
 rds,<br>matt<br>
 
 --f46d043c7c941cc30b04b63b8645--


More information about the freebsd-bugs mailing list