<br><br><div class="gmail_quote">On Thu, Oct 6, 2011 at 2:52 PM, Francis Giraldeau <span dir="ltr"><<a href="mailto:francis.giraldeau@gmail.com">francis.giraldeau@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Span information was collected when the option is set, but the command would<br>
fail. The test to determine if span is enable was not working properly. It was<br>
testing against a NULL string. Instead, use the option flag from the aug tree,<br>
since this value really reflects the state of span information in the tree<br>
after an effective load.<br>
<br></blockquote><div><br><br>You beat me to it Francis, I'm just finishing my own patch to fix it. However, I do not agree with the patch, see below.<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Fix ticket #220<br>
---<br>
 src/augrun.c |    8 +-------<br>
 1 files changed, 1 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/src/augrun.c b/src/augrun.c<br>
index 636b6fe..f4a4e03 100644<br>
--- a/src/augrun.c<br>
+++ b/src/augrun.c<br>
@@ -619,19 +619,13 @@ static void cmd_span(struct command *cmd) {<br>
     int r;<br>
     uint label_start, label_end, value_start, value_end, span_start, span_end;<br>
     char *filename = NULL;<br>
-    const char *option = NULL;<br>
<br>
-    if (! streqv(AUG_DISABLE, option)) {<br>
+    if (!(cmd->aug->flags & AUG_ENABLE_SPAN)) {<br></blockquote><div><br><br>This will only work if AUG_ENABLE_SPAN was passed as a flag. However, users can set /augeas/span manually, and it won't work here. Instead, we should use the way it was done in 0.8.0:<br>
<br>    if (aug_get(cmd->aug, AUGEAS_SPAN_OPTION, &option) != 1) {<br>        printf("Error: option " AUGEAS_SPAN_OPTION " not found\n");<br>        return;<br>    }<br><br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

         ERR_REPORT(cmd, AUG_ECMDRUN,<br>
                    "Span is not enabled. To enable, run the commands:\n"<br>
                    "    set %s %s\n    rm %s\n    load\n",<br>
                    AUGEAS_SPAN_OPTION, AUG_ENABLE, AUGEAS_FILES_TREE);<br>
         return;<br>
-    } else if (streqv(AUG_ENABLE, option)) {<br>
-        ERR_REPORT(cmd, AUG_ECMDRUN,<br>
-                   "option %s must be %s or %s\n", AUGEAS_SPAN_OPTION,<br>
-                   AUG_ENABLE, AUG_DISABLE);<br>
-        return;<br></blockquote><div><br><br>This check is still useful, it just has to be reversed.<br>I'll send my patch along in a minute.<br><br><br>Raphaël<br></div></div><br><br>