On Mon, May 04, 2020 at 05:49:26PM +0300, [email protected] wrote:
> Say I have a SSID like "Mike's". If I set it up at install time, at the
> first boot /etc/netstart will fail with an unmatched quote error. Attached is
> the generated /etc/hostname.iwn0 file as generated. If I change the name in
> /etc/hostname.iwn0 to something like "Mike's" (literally this time, quotes
> included), netstart finishes successfully.
> >How-To-Repeat:
> Configure a SSID at install time with apostrophes
Thanks for the report.
hostname.if(5) created by the installer are syntactically correct, your
SSID "Mike's" will produce lines like
$ quote nwid "foo'bar"
nwid 'foo'\''bar'
quote() is the function used in /usr/src/distrib/miniroot/install.sub
(the installer).
nestart(8) then parses these lines, see parse_hn_line(). This function
also seems correct and does not mangle quotes, spaces or the like.
Diff below fixes your issue: while reading hostname.if lines and feeding
them to parse_hn_line(), we simply must not interpret backslashes.
OK?
Index: etc/netstart
===================================================================
RCS file: /cvs/src/etc/netstart,v
retrieving revision 1.202
diff -u -p -r1.202 netstart
--- etc/netstart 15 Jan 2020 00:19:40 -0000 1.202
+++ etc/netstart 4 May 2020 16:24:05 -0000
@@ -134,7 +134,7 @@ ifstart() {
# Parse the hostname.if(5) file and fill _cmds array with interface
# configuration commands.
set -o noglob
- while IFS= read -- _line; do
+ while IFS= read -r -- _line; do
parse_hn_line $_line
done <$_hn