On Mon, May 04, 2020 at 06:34:51PM +0200, Klemens Nanni wrote:
> On Mon, May 04, 2020 at 06:24:49PM +0200, Klemens Nanni wrote:
> > 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?
> Sorry, same diff but to install.sub's ifstart() function as well to keep
> the two implementations in sync.
Moving to tech@ now.
I've verified that this does not break hostname.if(5)'s "\$if" parsing.
I'd like to commit this soon.
Anyone?
Index: distrib/miniroot/install.sub
===================================================================
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1150
diff -u -p -r1.1150 install.sub
--- distrib/miniroot/install.sub 5 Apr 2020 15:15:42 -0000 1.1150
+++ distrib/miniroot/install.sub 4 May 2020 16:34:28 -0000
@@ -2377,7 +2377,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
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:34:27 -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