Date: Wed, 11 Jan 2012 07:40:10 GMT From: Matthew Story <matthewstory@gmail.com> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/164011: comments in rc.conf cause system loading Message-ID: <201201110740.q0B7eA5B074846@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/164011; it has been noted by GNATS. From: Matthew Story <matthewstory@gmail.com> To: Eugen Konkov <kes-kes@yandex.ru> Cc: freebsd-gnats-submit@freebsd.org Subject: Re: misc/164011: comments in rc.conf cause system loading Date: Wed, 11 Jan 2012 02:10:26 -0500 --f46d043c07be761be204b63b53d8 Content-Type: text/plain; charset=ISO-8859-1 On Wed, Jan 11, 2012 at 1:38 AM, Eugen Konkov <kes-kes@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 line is ignored: $ echo hello # there hello $ echo hello#there hello#there $ (page 77) -- regards, matt --f46d043c07be761be204b63b53d8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div><div>On Wed, Jan 11, 2012 at 1:38 AM, Eugen Konkov <span dir=3D"ltr">&= lt;<a href=3D"mailto:kes-kes@yandex.ru">kes-kes@yandex.ru</a>></span> wr= ote:</div><div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote"= style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> >How-To-Repeat:<br> If I put this line All is ok<br> ifconfig_vlan7=3D"inet 10.11.19.149 netmask 255.255.255.248 vlan 7 vla= ndev re0" #<br> When I do not keep space between " and #<br> ifconfig_vlan7=3D"inet 10.11.19.149 netmask 255.255.255.248 vlan 7 vla= ndev re0"#<br></blockquote>rc.conf uses sh(1) syntax, per the man page= :<div><div>=A0=A0 =A0 Options are set with ``name=3Dvalue'' assignm= ents that use sh(1) syntax.</div> <div>=A0=A0 =A0 The following list provides a name and short description fo= r 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, `#' only denotes a comment if it occurs at the beginnin= g of a word:</div> <div><br></div><div><span class=3D"Apple-style-span" style=3D"font-family:V= erdana,Arial,Helvetica,sans-serif;font-size:13px">When it is not processing= an=A0<b>io_here</b>, the shell shall break its input into tokens by applyi= ng 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 deli= mited 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.</= span></div> <div><span class=3D"Apple-style-span" style=3D"font-family:Verdana,Arial,He= lvetica,sans-serif;font-size:13px">[...snip]</span></div><div><span class= =3D"Apple-style-span" style=3D"font-family:Verdana,Arial,Helvetica,sans-ser= if;font-size:13px"><br> </span></div><div><span class=3D"Apple-style-span" style=3D"font-family:Ver= dana,Arial,Helvetica,sans-serif;font-size:13px">10. If the current characte= r is a=A0<tt>'#'</tt>, it and all subsequent characters up to, but = excluding, the next <newline> shall be discarded as a comment. The &l= t;newline> that ends the line is not considered part of the comment.</sp= an></div> <div><br></div><div><span class=3D"Apple-style-span" style=3D"font-family:V= erdana,Arial,Helvetica,sans-serif;font-size:13px"></span>via: <a href=3D"ht= tp://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html">htt= p://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html</a></= div> <div><br></div><div>In your given example:</div><div><br></div><div>"i= net 10.11.19.149 netmask 255.255.255.248 vlan 7 vlandev re0"#</div><di= v><br></div><div>shell is still constructing a word (for assignemnt), which= will result in the assignment of:</div> <div><br></div><div>inet 10.11.19.149 netmask 255.255.255.248 vlan 7 vlande= v re0#</div><div><br></div><div>to=A0ifconfig_vlan.=A0</div><div><br></div>= <div><font class=3D"Apple-style-span" face=3D"arial, helvetica, sans-serif"= >A relevant snippit from "The UNIX Programming Environment" below= :</font></div> <div><font class=3D"Apple-style-span" face=3D"arial, helvetica, sans-serif"= ><br></font></div><div><p style=3D"margin:0px 0px 0px 0px;font:9.8px Times;= color:#171712"><span style=3D"font:9.9px Times"><span class=3D"Apple-style-= span" style=3D"font-size:small"><font class=3D"Apple-style-span" face=3D"ar= ial, helvetica, sans-serif">The </font></span></span><span class=3D"Apple-s= tyle-span" style=3D"font-size:small"><font class=3D"Apple-style-span" face= =3D"arial, helvetica, sans-serif">metacharacter </font></span><span style= =3D"font:8.7px Times"><span class=3D"Apple-style-span" style=3D"font-size:s= mall"><font class=3D"Apple-style-span" face=3D"arial, helvetica, sans-serif= "># </font></span></span><span class=3D"Apple-style-span" style=3D"font-siz= e:small"><font class=3D"Apple-style-span" face=3D"arial, helvetica, sans-se= rif">is </font></span><span style=3D"color:#252721"><span class=3D"Apple-st= yle-span" style=3D"font-size:small"><font class=3D"Apple-style-span" face= =3D"arial, helvetica, sans-serif">almost </font></span></span><span class= =3D"Apple-style-span" style=3D"font-size:small"><font class=3D"Apple-style-= span" face=3D"arial, helvetica, sans-serif">universally used for </font></s= pan><span style=3D"color:#252721"><span class=3D"Apple-style-span" style=3D= "font-size:small"><font class=3D"Apple-style-span" face=3D"arial, helvetica= , sans-serif">shell </font></span></span><span class=3D"Apple-style-span" s= tyle=3D"font-size:small"><font class=3D"Apple-style-span" face=3D"arial, he= lvetica, sans-serif">comments; if a shell word begins with </font></span><s= pan style=3D"font:9.7px Times"><span class=3D"Apple-style-span" style=3D"fo= nt-size:small"><font class=3D"Apple-style-span" face=3D"arial, helvetica, s= ans-serif">#, </font></span></span><span style=3D"font:9.8px Times"><span c= lass=3D"Apple-style-span" style=3D"font-size:small"><font class=3D"Apple-st= yle-span" face=3D"arial, helvetica, sans-serif">the </font></span></span><s= pan class=3D"Apple-style-span" style=3D"font-size:small"><font class=3D"App= le-style-span" face=3D"arial, helvetica, sans-serif">rest </font></span><sp= an style=3D"font:10.0px Times;color:#252721"><span class=3D"Apple-style-spa= n" style=3D"font-size:small"><font class=3D"Apple-style-span" face=3D"arial= , helvetica, sans-serif">of </font></span></span><span class=3D"Apple-style= -span" style=3D"font-size:small"><font class=3D"Apple-style-span" face=3D"a= rial, helvetica, sans-serif">the line </font></span><span style=3D"font:9.6= px Times"><span class=3D"Apple-style-span" style=3D"font-size:small"><font = class=3D"Apple-style-span" face=3D"arial, helvetica, sans-serif">is </font>= </span></span><span class=3D"Apple-style-span" style=3D"font-size:small"><f= ont class=3D"Apple-style-span" face=3D"arial, helvetica, sans-serif">ignore= d:</font></span></p> <p style=3D"margin:0px 0px 0px 0px;font:9.8px Times;color:#171712"><span cl= ass=3D"Apple-style-span" style=3D"font-size:small"><font class=3D"Apple-sty= le-span" face=3D"arial, helvetica, sans-serif"><br></font></span></p> <p style=3D"margin:0px 0px 0px 0px;font:9.8px Times;color:#171712"><span st= yle=3D"font:7.9px Times"><span class=3D"Apple-style-span" style=3D"font-siz= e:small"><font class=3D"Apple-style-span" face=3D"arial, helvetica, sans-se= rif">$ </font></span></span><span style=3D"font:9.4px Times"><span class=3D= "Apple-style-span" style=3D"font-size:small"><font class=3D"Apple-style-spa= n" face=3D"arial, helvetica, sans-serif">echo </font></span></span><span st= yle=3D"font:10.3px Times"><span class=3D"Apple-style-span" style=3D"font-si= ze:small"><font class=3D"Apple-style-span" face=3D"arial, helvetica, sans-s= erif">hello </font></span></span><span style=3D"font:7.7px Times;color:#252= 721"><span class=3D"Apple-style-span" style=3D"font-size:small"><font class= =3D"Apple-style-span" face=3D"arial, helvetica, sans-serif"># </font></span= ></span><span style=3D"font:9.9px Times"><span class=3D"Apple-style-span" s= tyle=3D"font-size:small"><font class=3D"Apple-style-span" face=3D"arial, he= lvetica, sans-serif">there=A0</font></span></span></p> <p style=3D"margin:0px 0px 0px 0px;font:9.8px Times;color:#171712"><span st= yle=3D"font:9.9px Times"><span class=3D"Apple-style-span" style=3D"font-siz= e:small"><font class=3D"Apple-style-span" face=3D"arial, helvetica, sans-se= rif"></font></span></span><span style=3D"font:10.2px Times"><span class=3D"= Apple-style-span" style=3D"font-size:small"><font class=3D"Apple-style-span= " face=3D"arial, helvetica, sans-serif">hello=A0</font></span></span></p> <p style=3D"margin:0px 0px 0px 0px;font:9.8px Times;color:#171712"><span st= yle=3D"font:10.2px Times"><span class=3D"Apple-style-span" style=3D"font-si= ze:small"><font class=3D"Apple-style-span" face=3D"arial, helvetica, sans-s= erif"></font></span></span><span style=3D"font:7.9px Times"><span class=3D"= Apple-style-span" style=3D"font-size:small"><font class=3D"Apple-style-span= " face=3D"arial, helvetica, sans-serif">$ </font></span></span><span style= =3D"font:9.4px Times"><span class=3D"Apple-style-span" style=3D"font-size:s= mall"><font class=3D"Apple-style-span" face=3D"arial, helvetica, sans-serif= ">echo </font></span></span><span style=3D"font:9.8px Times"><span class=3D= "Apple-style-span" style=3D"font-size:small"><font class=3D"Apple-style-spa= n" face=3D"arial, helvetica, sans-serif">hello#there=A0</font></span></span= ></p> <p style=3D"margin:0px 0px 0px 0px;font:9.8px Times;color:#171712"><span st= yle=3D"font:9.8px Times"><span class=3D"Apple-style-span" style=3D"font-siz= e:small"><font class=3D"Apple-style-span" face=3D"arial, helvetica, sans-se= rif"></font></span></span><span style=3D"font:10.1px Times"><span class=3D"= Apple-style-span" style=3D"font-size:small"><font class=3D"Apple-style-span= " face=3D"arial, helvetica, sans-serif">hello#there</font></span></span></p= > <p style=3D"margin:0px 0px 0px 0px;font:7.9px Times;color:#171712"><span cl= ass=3D"Apple-style-span" style=3D"font-size:small"><font class=3D"Apple-sty= le-span" face=3D"arial, helvetica, sans-serif">$</font></span></p></div></d= iv><div> <br></div>(page 77)<br><br clear=3D"all"><div><br></div>-- <br>regards,<br>= matt<br> </div></div> --f46d043c07be761be204b63b53d8--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201110740.q0B7eA5B074846>