On Wed, 2006-12-13 at 23:06 +0000, Christopher Browne wrote:
> Jeff Davis wrote:
> > If a config option is terminated with EOF, the loop is terminated before
> > the values are stored. So, I check for parse_start==2 outside the loop,
> > and if true, store the config variables.
> >
> > I also attached slony-test.diff which can be used to see what values are
> > acutally being stored from the configuration file. This can be used for
> > debugging.
> >
> Here is a sample .conf file (compressed, to ensure its integrity ;-))
> that causes the failure.
>
Here is a fix for that. The comment-eating regex was broken because it
ended with a "$", matching only EOL. I changed it to "#.*" which should
eat any proper comment. This is the same as postgresql's guc-file.l.
So, there were two problems with ProcessConfigFile(). The first was that
the loop would exit when getting an EOF without saving the config
variable, even if the line was complete but just lacking an EOL. The
second was that the comment regex only matched comments ending in EOL,
not EOF.
Regards,
Jeff Davis
diff -cr slony1-engine.orig/src/slon/conf-file.l slony1-engine/src/slon/conf-file.l
*** slony1-engine.orig/src/slon/conf-file.l Wed Dec 13 11:11:09 2006
--- slony1-engine/src/slon/conf-file.l Wed Dec 13 15:29:09 2006
***************
*** 67,73 ****
\n ConfigFileLineno++; return SLON_EOL;
[ \t\r]+ /* eat whitespace */
! #.*$ /* eat comment */
{ID} return SLON_ID;
{QUALIFIED_ID} return SLON_QUALIFIED_ID;
--- 67,73 ----
\n ConfigFileLineno++; return SLON_EOL;
[ \t\r]+ /* eat whitespace */
! #.* /* eat comment */
{ID} return SLON_ID;
{QUALIFIED_ID} return SLON_QUALIFIED_ID;
***************
*** 218,226 ****
}
tail = item;
}
! parse_state = 0;
! break;
}
}
fclose(fp);
--- 218,262 ----
}
tail = item;
}
! parse_state = 0;
! break;
! }
! }
! /*
! * If we encountered an EOF after we've already
! * reached parse_state of 2, we already have a complete
! * configuration line, it's just terminated with EOF
! * instead of EOL. Store that config option.
! */
! if(parse_state == 2)
! {
! item = malloc(sizeof *item);
! item->name = opt_name;
! item->value = opt_value;
! if (strcmp(opt_name, "custom_variable_classes") == 0)
! {
! item->next = head;
! head = item;
! if (!tail)
! {
! tail = item;
! }
! }
! else
! {
! /* append to list */
! item->next = NULL;
! if (!head)
! {
! head = item;
! }
! else
! {
! tail->next = item;
! }
! tail = item;
}
+ parse_state = 0;
}
fclose(fp);
_______________________________________________
Slony1-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/slony1-general