> On Mon, Aug 08, 2016 at 10:23:22AM +0200, Michal Bozon wrote: > > Hi, I've had an issue connecting to a wireless network > > (by doas sh /etc/netstart $if). Its password contained > > '#' character(s). > > > > Even adding "debug" keyword did not assure me > > whether the problem is with my password definition: > > wpakey s3cur3-as-#311, for illustration (was not sure > > if the '#' has to be escaped somehow); or somewhere > > else. Finally, it was the latter, but it took me a while > > to realize that. > > > > Current hostname.if manpage is not absolutely clear: > > > > # Comments are allowed. Anything following a comment > > character is treated as a comment. > > > > It suggests that what is before '#' might have a meaning, > > while the broader context of the definition strongly suggests > > that comment it is when '#' "keyword" is at the beginning. > > > > Looking into /etc/netstart might also be confusing - > > just at the beginning, there's stripcom() function definition, > > which clearly strips the input line from '#' and following. > > However, this function is NOT applied to /etc/hostname.if, > > it is treated differently, entire line beginning with '#' > > is skipped (see # Skip comments and empty lines). > > > > I am therefore proposing following or similar change: > > > > --- /usr/src/share/man/man5/hostname.if.5 > > +++ /usr/src/share/man/man5/hostname.if.5 > > @@ -201,7 +201,7 @@ > > the interface, such as 64. > > .It Li # > > Comments are allowed. > > -Anything following a comment character is treated as a comment. > > +Line beginning with a comment character is treated as a comment. > > .It Li \&! Ns Ar command > > Arbitrary shell commands can be executed using this directive, as > > long as they are available in the single-user environment (for > > > > hi. > > the diff as-is is wrong. i mean it's valid to have this in your > hostname.if file: > > up # blah blah > > that's a very common construct, and is allowed. > > however it might be that to the list of things that should be double > quoted (whitespace and single quotes) we should add the comment > character. i'm not sure though. > > jmc
Indeed, my initial analysis was not correct, it is more, say, complicated. As i said, my config with # in the password worked without any escaping or quoting needed. !echo foo # boo will echo foo !echo foo#boo will echo foo#boo up # blah blah will work just because if fact it is ignored, because the interface is up-ped automatically, implicitly dhcp # blah blah will NOT work, because in the end it is interpreted as cmd: ifconfig ath0 # blah blah down;dhclient ath0