Skip to content

Infinite loop when encountering exclamation mark symbol firstly for BIND9Parser #23

Description

@egberts

When encountering the following content:

    allow-transfer {
        trusted_residential_network_acl; // allow XFER from homenet

        external_downstream_nameservers_acl;
        key ddns-sha256-arca-a-key; // TODO tighten this down

        !{ !localhost; any; };
        key master-to-slave-key; // only localhost can use key
        localhost; // not so useful for unsecured RNDC uses
        };

The infinite loop resides at the line:

    !{ !localhost; any; };

Apparently, the exclamation mark is tripping that up when pressing Ctrl-C, as traceback shows:

(Pdb) bt
  /usr/lib/python3.5/runpy.py(193)_run_module_as_main()
-> "__main__", mod_spec)
  /usr/lib/python3.5/runpy.py(85)_run_code()
-> exec(code, run_globals)
  /usr/lib/python3.5/pdb.py(1692)<module>()
-> pdb.main()
  /usr/lib/python3.5/pdb.py(1665)main()
-> pdb._runscript(mainpyfile)
  /usr/lib/python3.5/pdb.py(1546)_runscript()
-> self.run(statement)
  /usr/lib/python3.5/bdb.py(431)run()
-> exec(cmd, globals, locals)
  <string>(1)<module>()
  /home/steve/work/python/reconfigure/test/bind.py(4)<module>()
-> import reconfigure
  /home/steve/.local/lib/python3.5/site-packages/reconfigure-0.1.81-py3.5.egg/reconfigure/includers/auto.py(13)compose()
-> self.compose_rec(origin, origin, tree)
  /home/steve/.local/lib/python3.5/site-packages/reconfigure-0.1.81-py3.5.egg/reconfigure/includers/auto.py(38)compose_rec()
-> self.compose_rec(root, file, subtree)
  /home/steve/.local/lib/python3.5/site-packages/reconfigure-0.1.81-py3.5.egg/reconfigure/includers/auto.py(38)compose_rec()
-> self.compose_rec(root, file, subtree)
  /home/steve/.local/lib/python3.5/site-packages/reconfigure-0.1.81-py3.5.egg/reconfigure/includers/auto.py(20)compose_rec()
-> self.compose_rec(root, origin, child)
  /home/steve/.local/lib/python3.5/site-packages/reconfigure-0.1.81-py3.5.egg/reconfigure/includers/auto.py(36)compose_rec()
-> subtree = self.parser.parse(content)
> /home/steve/.local/lib/python3.5/site-packages/reconfigure-0.1.81-py3.5.egg/reconfigure/parsers/nginx.py(24)parse()
-> tokens, remainder = scanner.scan(' '.join(filter(None, content.split(' '))))
  /usr/lib/python3.5/re.py(367)scan()
-> m = match()

The loop is not stuck in the NginxParser(BaseParser), but in the following function:

tokens, remainder = scanner.scan(' '.join(filter(None, content.split(' '))))

According to the traceback, it is stuck in match():

/usr/lib/python3.5/re.py(367)scan()

Probably a bad regex. I realized that NginxParser is being used. I do think that tokens can be enhanced to allow exclamation mark.

tokens, remainder = scanner.scan(' '.join(filter(None, content.split(' '))))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions