I found that when svccfg is invoked with the import command line as its 
arguments it fails (enter the command at the svccfg> prompt works). A yacc 
trace shows that it never sees "end-of_file". I added the following to 
svccfg_main.c:

--- a/usr/src/cmd/svc/svccfg/svccfg_main.c      Fri Oct 31 13:36:47 2008 -0400
+++ b/usr/src/cmd/svc/svccfg/svccfg_main.c      Fri Dec 19 14:50:19 2008 -0500
@@ -229,8 +229,10 @@
        cmd = safe_malloc(MAX_CMD_LINE_SZ);
        for (c = optind; c < argc; c++) {
                (void) strlcat(cmd, argv[c], MAX_CMD_LINE_SZ);
-               (void) strlcat(cmd, " ", MAX_CMD_LINE_SZ);
+               if (c + 1 != argc)
+                       (void) strlcat(cmd, " ", MAX_CMD_LINE_SZ);
        }
+       (void) strlcat(cmd, "\n", MAX_CMD_LINE_SZ);
 
        return (engine_exec(cmd));
 }

and this cures it for me. However, as it works for everyone else without this 
patch then this is just a band-aid over an underlying problem. Is someone able 
to build with YYDEBUG=1 and yydebug=1 to see what sequence they get with svccfg 
import /var/svc/manifest/system/xxx.xml so I can compare it to mine? 

Prior to fix/kludge:

# svccfg import /var/svc/manifest/system/sar.xml
State 0, token -none-
Received token SCC_IMPORT
State 41, token -none-
Received token SCV_WORD
Reduce by (123) "string_list : /* empty */"
State 78, token SCV_WORD
State 185, token -none-
Reduce by (127) "string : SCV_WORD"
State 184, token -none-
Reduce by (124) "string_list : string_list string"
State 78, token -none-
Received token SCV_WORD
State 185, token -none-
Reduce by (127) "string : SCV_WORD"
State 184, token -none-
Reduce by (124) "string_list : string_list string"
State 78, token -none-
Received token end-of-file
Error recovery pops state 78, uncovers state 41
State 79, token end-of-file
Error recovery discards token end-of-file

Following fix/kludge:

# svccfg -v import /var/svc/manifest/system/sar.xml
State 0, token -none-
Received token SCC_IMPORT
State 41, token -none-
Received token SCV_WORD
Reduce by (123) "string_list : /* empty */"
State 78, token SCV_WORD
State 185, token -none-
Reduce by (127) "string : SCV_WORD"
State 184, token -none-
Reduce by (124) "string_list : string_list string"
State 78, token -none-
Received token SCS_NEWLINE
State 39, token -none-
Reduce by (122) "terminator : SCS_NEWLINE"
State 183, token -none-
Reduce by (43) "import_cmd : SCC_IMPORT string_list terminator"
svccfg: Taking "previous" snapshot for svc:/system/sar:default.
svccfg: Upgrading properties of svc:/system/sar according to instance "default".
svccfg: Taking "last-import" snapshot for svc:/system/sar:default.
svccfg: Refreshed svc:/system/sar:default.
svccfg: Successful import.
State 5, token -none-
Reduce by (5) "command : import_cmd"
State 2, token -none-
Reduce by (1) "commands : command"
State 1, token -none-
Received token end-of-file

When I enter import command at prompt:

# svccfg  
svc:> import /var/svc/manifest/system/sar.xml
State 0, token -none-
Received token SCC_IMPORT
State 41, token -none-
Received token SCV_WORD
Reduce by (123) "string_list : /* empty */"
State 78, token SCV_WORD
State 185, token -none-
Reduce by (127) "string : SCV_WORD"
State 184, token -none-
Reduce by (124) "string_list : string_list string"
State 78, token -none-
Received token SCS_NEWLINE
State 39, token -none-
Reduce by (122) "terminator : SCS_NEWLINE"
State 183, token -none-
Reduce by (43) "import_cmd : SCC_IMPORT string_list terminator"
State 5, token -none-
Reduce by (5) "command : import_cmd"
State 2, token -none-
Reduce by (1) "commands : command"
State 1, token -none-
Received token SCS_NEWLINE
State 39, token -none-
Reduce by (122) "terminator : SCS_NEWLINE"
State 3, token -none-
Reduce by (3) "command : terminator"
State 74, token -none-
Reduce by (2) "commands : commands command"
State 1, token -none-
Received token end-of-file
svc:>
-- 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to