Actions
Bug #846
opensvccfg -f line numbers should count from 1 not 0
Status:
New
Priority:
Normal
Assignee:
-
Category:
cmd - userland programs
Start date:
2011-03-21
Due date:
% Done:
0%
Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
External Bug:
Description
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 Yuri Pankov almost 12 years ago
- Difficulty set to Medium
- Tags set to needs-triage
Any examples?
# cat svccfg.file junk # svccfg -f svccfg.file svccfg (svccfg.file, line 1): Unknown command "junk". # sudo svccfg -f - junk svccfg (<stdin>, line 1): Unknown command "junk".
Updated by Rich Lowe almost 12 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 almost 12 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)
Actions