Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed location reporting and long lines in config errors #3383

Conversation

bazsi
Copy link
Collaborator

@bazsi bazsi commented Aug 9, 2020

This branch fixes a couple of issues in configuration error reporting:

  1. when the configuration file has lines longer than 1024 bytes, the report could become confusing
  2. the location of the error was incorrectly reported in some cases

+1 I've added the parsed value to the main grammar error message for cases where the value is a string.

All this together would probably have avoided the bug report in #3382

@kira-syslogng
Copy link
Contributor

Build SUCCESS

@szemere szemere added the user-visible-feature User visible feature label Aug 10, 2020
@szemere
Copy link
Collaborator

szemere commented Aug 10, 2020

I added the "user-visible-feature" flag, since we are changing the output. However I think this one do not need extra documentation in the admin guide. With a news file, it is approved from my sight.

@szemere szemere requested a review from furiel August 11, 2020 11:49
@furiel
Copy link
Collaborator

furiel commented Aug 11, 2020

Looks good to me too. @bazsi please add the news file. Then this can go in.

Sometimes it is a big deal to see how syslog-ng parsed a specific token when
trying to understand an error message.  Together with the fixed location
reporting in the followup patch, I hope this makes a couple of bugreports
avoidable.

Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
… reporting errors

Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
… token

When the error reporting format was improved to include the entire include
stack, we started using location information from the lexer's state, which
may not be entirely correct.

The lexer sometimes is advance to the token triggering the error (because
of LALR or simply because we are erroring on the first token of a rule), in
these cases using the location information in the lexer is incorrect,
and we should use the yylloc value as passed by the grammar.

This fixes cases where the caret showing the exact error location points
a bit past to the token that causes the error, for instance:

@Version: 3.29

rewrite foo {
  subst ("", "", value("MESSAGE") type("pcre") flags("global store-matches"));
};

This was reported as:

3       rewrite foo {
4----->   subst ("", "", value("MESSAGE") type("pcre") flags("global store-matches"));
4----->                                                                            ^
5       };
6

Please note that the caret points to the closing parenthesis instead of
the incorrect flag. With the fix we get:

1       @Version: 3.29
2
3       rewrite foo {
4----->   subst ("", "", value("MESSAGE") type("pcre") flags("global store-matches"));
4----->                                                      ^^^^^^^^^^^^^^^^^^^^^^
5       };
6

This would have saved us at least one bug-report where the user didn't understand
the error he was getting.

Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
@bazsi bazsi force-pushed the fixed-location-reporting-and-long-lines-in-config-errors branch from af83364 to 695407c Compare August 18, 2020 08:49
@kira-syslogng
Copy link
Contributor

Build SUCCESS

szemere
szemere previously approved these changes Aug 18, 2020
Signed-off-by: Antal Nemes <antal.nemes.hu@gmail.com>
@kira-syslogng
Copy link
Contributor

Build SUCCESS

@szemere szemere merged commit 31bcad9 into syslog-ng:master Aug 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user-visible-feature User visible feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants