Fri, 10 Mar 2023 22:45:58 +0100
log error in get_next_token()
--- a/src/server/config/initconf.c Sat Feb 25 21:12:51 2023 +0100 +++ b/src/server/config/initconf.c Fri Mar 10 22:45:58 2023 +0100 @@ -42,6 +42,7 @@ ConfigParser2 parser; memset(&parser, 0, sizeof(ConfigParser2)); parser.mp = mp; + parser.filename = file; parser.validateDirective = initconfig_validate_directive; parser.allow_hierarchy = 0;
--- a/src/server/config/objconf.c Sat Feb 25 21:12:51 2023 +0100 +++ b/src/server/config/objconf.c Fri Mar 10 22:45:58 2023 +0100 @@ -76,6 +76,7 @@ ConfigParser2 parser; memset(&parser, 0, sizeof(ConfigParser2)); parser.mp = mp; + parser.filename = file; parser.delim = "()/*%"; parser.validateDirective = objectconf_validate_directive; parser.validateObjBegin = objectconf_validate_objbegin;
--- a/src/server/config/serverconfig.c Sat Feb 25 21:12:51 2023 +0100 +++ b/src/server/config/serverconfig.c Fri Mar 10 22:45:58 2023 +0100 @@ -48,6 +48,7 @@ ConfigParser2 parser; memset(&parser, 0, sizeof(ConfigParser2)); parser.mp = mp; + parser.filename = file; parser.allow_hierarchy = true; parser.delim = ""; ConfigNode *root = serverconfig_load_file(&parser, file); @@ -126,12 +127,21 @@ if(c == '\n') { if(quote) { *pos = i; + log_ereport( + LOG_FAILURE, + "cfgparser: file %s:%d:%d: error: %s", + parser->filename, + parser->linenum, + parser->linepos+2, + "missing '\"' character before end of line"); return token; // error } else if(start == i) { // single newline char token type = CFG_TOKEN_NEWLINE; token_begin = i; token_end = i+1; + parser->linenum++; + parser->linepos = 0; break; } @@ -179,12 +189,14 @@ token_begin = i; } prev = c; + + parser->linepos++; } *pos = i + 1; if(token_begin < 0) { - return token; // error + return token; // error or EOF } token.type = type; @@ -249,6 +261,9 @@ CxMempool *mp = parser->mp; CxAllocator *a = (CxAllocator*)mp->allocator; + parser->linenum = 1; + parser->linepos = 1; + if(!parser->delim) { parser->delim = ""; }
--- a/src/server/config/serverconfig.h Sat Feb 25 21:12:51 2023 +0100 +++ b/src/server/config/serverconfig.h Fri Mar 10 22:45:58 2023 +0100 @@ -119,6 +119,11 @@ struct ConfigParser2 { CxMempool *mp; + const char *filename; + + int linenum; + int linepos; + enum ConfigParserError error; const char *delim;