ossobv / asterisklint

Asterisk PBX configuration syntax checker
GNU General Public License v3.0
61 stars 12 forks source link

Can make it crash with a CPLAYBACKOFFSET #13

Closed ghost closed 7 years ago

ghost commented 7 years ago

Summary: AssertionError: CPLAYBACKOFFSET=0

CPLAYBACKOFFSET=0 is indeed wrong, but makes asterisklint crash.

Offending code

exten => s,1,Verbose(1,Context:${CONTEXT} Extension:${EXTEN} foldercount:${foldercount} numberOfTracks:${numberOfTracks} currentTrackFileName:${currentTrackFileName} pathDepth:${pathDepth} scanPath:${scanPath} CPLAYBACKOFFSET:${CPLAYBACKOFFSET=0})

Full output


Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/asterisklint/config.py", line 186, in __iter__
    self.on_varset(element)
  File "/usr/local/lib/python3.5/dist-packages/asterisklint/dialplan.py", line 588, in on_varset
    dialplanvarset = DialplanVarset.from_varset(varset)
  File "/usr/local/lib/python3.5/dist-packages/asterisklint/dialplan.py", line 496, in from_varset
    app = App(app, varset.where)
  File "/usr/local/lib/python3.5/dist-packages/asterisklint/application.py", line 120, in __init__
    self.parse()
  File "/usr/local/lib/python3.5/dist-packages/asterisklint/application.py", line 142, in parse
    self.data = self.parse_inner(self.data)
  File "/usr/local/lib/python3.5/dist-packages/asterisklint/application.py", line 164, in parse_inner
    data = VarLoader().parse_variables(data, self.where)
  File "/usr/local/lib/python3.5/dist-packages/asterisklint/varfun.py", line 217, in parse_variables
    inner_data, where)
  File "/usr/local/lib/python3.5/dist-packages/asterisklint/varfun.py", line 267, in _process_variable
    self.count_var(data, where)
  File "/usr/local/lib/python3.5/dist-packages/asterisklint/varfun.py", line 305, in count_var
    for i in varname), varname
AssertionError: CPLAYBACKOFFSET=0

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/bin/asterisklint", line 34, in <module>
    sys.exit(main(sys.argv[1:], os.environ))
  File "/usr/local/lib/python3.5/dist-packages/asterisklint/main.py", line 147, in main
    return command_module.main(args, envs)
  File "/usr/local/lib/python3.5/dist-packages/asterisklint/commands/modules-show.py", line 74, in main
    dialplan = next(iter(parser))
  File "/usr/local/lib/python3.5/dist-packages/asterisklint/config.py", line 192, in __iter__
    raise ProgrammingError(str(element.where)) from exc
asterisklint.config.ProgrammingError: An unexpected exception was raised. This is most likely a bug in the asterisklint library. If you can reproduce the problem and file an issue on the bug tracker, that would be nice. Further info: ./extensions_star_help_handler.conf:102```