Asterisk
  1. Asterisk
  2. ASTERISK-4375

[Patch] check_expr -- a small program to check for possible probs in extensions.conf

    Details

    • Type: Bug Bug
    • Status: Closed
    • Severity: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Target Release Version/s: None
    • Component/s: Core/General
    • Labels:
      None
    • Mantis ID:
      4491
    • Regression:
      No

      Description

      I have written a small program to check the extensions.conf file for
      operators not surrounded by spaces, such as a regex operator in an unquoted string. Such were implicitly grouped with the old syntax, now they are seen by the parser as an operator.

      This is the first problem that confused a user enough to write the mailing list. To help users in general, I think it might be wise to add this to the CVS somewhere, so if a user is confused, we can direct him to this tool, to compile and use it to find possible problems.

      It is meant to be run only once, when a user upgrades from older versions of flex to flex-2.5.31 or higher. At this point, the new spaces-dont-matter-as-much parser is in affect, and legacy situations should be reviewed.

      Just because check_expr flags a possible problem doesn't necc. mean that there is a real problem, but the operator in question should be checked to see it the new parsing rules might cause a problem.

      I will issue new versions of this file as more experience is gained with possible user problems.

                • ADDITIONAL INFORMATION ******

      The program requires one arg, the path to the extensions.conf you want to check.

      Compile with: gcc -g -o check_expr check_expr.c

      It generates a log file, expr2_log

      It might be cool to run the check during the make, if the flex version is >= 2.5.31, and the logfile doesn't exist. It should only run once that way, and the users will see the results to stdout. But this may be more a headache than it's worth... up to you.

        Activity

        Hide
        Donny Kavanagh added a comment -

        I think the best scenario would be to add a feature to Asterisk similar to apache, which is to tell it to parse its config files to see if they come up clean or not.

        Show
        Donny Kavanagh added a comment - I think the best scenario would be to add a feature to Asterisk similar to apache, which is to tell it to parse its config files to see if they come up clean or not.
        Hide
        Steve Murphy added a comment -

        Sure, that would be really cool, but this is not that feature. It is purely meant to read "legacy", or extensions.conf files run & tested with flex < 2.5.31 (which means no flex scanner at all), flagging possible compatibility probs with the new flex scanner in place.

        And, once a user codes and tests exprs in the new regime, such new exprs might be flagged also, needlessly.

        These exprs would probably pass syntax check in both regimes. They just don't behave the same, is the issue. A code review of the extensions.conf would most likely find these, but sometimes you miss things. The program will hopefully help.

        Show
        Steve Murphy added a comment - Sure, that would be really cool, but this is not that feature. It is purely meant to read "legacy", or extensions.conf files run & tested with flex < 2.5.31 (which means no flex scanner at all), flagging possible compatibility probs with the new flex scanner in place. And, once a user codes and tests exprs in the new regime, such new exprs might be flagged also, needlessly. These exprs would probably pass syntax check in both regimes. They just don't behave the same, is the issue. A code review of the extensions.conf would most likely find these, but sometimes you miss things. The program will hopefully help.
        Hide
        Kevin P. Fleming (Inactive) added a comment -

        Added to the 'utils' directory in CVS HEAD (with a minor fix to make it work when no expressions are found). Thanks!

        Show
        Kevin P. Fleming (Inactive) added a comment - Added to the 'utils' directory in CVS HEAD (with a minor fix to make it work when no expressions are found). Thanks!
        Hide
        Digium Subversion added a comment -

        Repository: asterisk
        Revision: 5886

        A trunk/utils/check_expr.c

        ------------------------------------------------------------------------
        r5886 | kpfleming | 2008-01-15 15:37:50 -0600 (Tue, 15 Jan 2008) | 2 lines

        add tool to check extensions.conf files for problems with new expression parser (bug ASTERISK-4375)

        ------------------------------------------------------------------------

        http://svn.digium.com/view/asterisk?view=rev&revision=5886

        Show
        Digium Subversion added a comment - Repository: asterisk Revision: 5886 A trunk/utils/check_expr.c ------------------------------------------------------------------------ r5886 | kpfleming | 2008-01-15 15:37:50 -0600 (Tue, 15 Jan 2008) | 2 lines add tool to check extensions.conf files for problems with new expression parser (bug ASTERISK-4375 ) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=5886

          People

          • Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development