svccfg -f line numbers should count from 1 not 0
If you pass a command file to svccfg(1M) with the -f option, line numbers for error purposes appear to count from 0, causing much user confusion. They should count from 1, as line numbers traditionally do.
Updated by Rich Lowe over 8 years ago
Huh. The file I was working with was definitely erroring with a number one before the line that was actually problematic:
> cat ~/test.scf select pkg/server add nightly-debug select pkg/server:nightly-debug addpg pkg application setprop pkg/port 8050 > svccfg -f ~/test.scf svccfg (/export/home/richlowe/test.scf, line 4): Syntax error. > sed -ne 4p ~/test.scf addpg pkg application
The error in the above is the missing '=' in the setprop.
Updated by Yuri Pankov over 8 years ago
I hope my analysis is correct:
diff -r d89753efabc8 usr/src/cmd/svc/svccfg/svccfg_main.c --- a/usr/src/cmd/svc/svccfg/svccfg_main.c Thu May 19 08:22:21 2011 -0600 +++ b/usr/src/cmd/svc/svccfg/svccfg_main.c Fri May 20 14:22:21 2011 +0400 @@ -141,6 +141,13 @@ return; } + /* + * Increment lineno as it's being decremented in vmessage() + * (for the semantic errors case, where we have fully processed + * the line and incremented lineno on '\n') + */ + est->sc_cmd_lineno++; + warn(gettext("Syntax error.\n")); if ((est->sc_cmd_flags & SC_CMD_DONT_EXIT) == 0)