NASA-SW-VnV / ikos

Static analyzer for C/C++ based on the theory of Abstract Interpretation.
Other
2.03k stars 150 forks source link

TypeError in ikos-view with pygments 2.17.2 #264

Closed gmacon closed 6 months ago

gmacon commented 7 months ago

I didn't see anywhere that ikos documents what versions of pygments are supported, but: In Pygments 2.12.0, the signature of HtmlFormatter.wrap was changed, and this exception is now raised out of ikos-view:

Traceback (most recent call last):
  File "/nix/store/y027d3bvlaizbri04c1bzh28hqd6lj01-python3-3.11.7/lib/python3.11/socketserver.py", line 317, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/nix/store/y027d3bvlaizbri04c1bzh28hqd6lj01-python3-3.11.7/lib/python3.11/socketserver.py", line 348, in process_request
    self.finish_request(request, client_address)
  File "/nix/store/y027d3bvlaizbri04c1bzh28hqd6lj01-python3-3.11.7/lib/python3.11/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/nix/store/y027d3bvlaizbri04c1bzh28hqd6lj01-python3-3.11.7/lib/python3.11/socketserver.py", line 755, in __init__
    self.handle()
  File "/nix/store/y027d3bvlaizbri04c1bzh28hqd6lj01-python3-3.11.7/lib/python3.11/http/server.py", line 436, in handle
    self.handle_one_request()
  File "/nix/store/y027d3bvlaizbri04c1bzh28hqd6lj01-python3-3.11.7/lib/python3.11/http/server.py", line 424, in handle_one_request
    method()
  File "/nix/store/v6zpn63fxb0gz3bqcmjfm22qf0sbx85q-ikos-3.2/lib/python3.11/site-packages/ikos/view.py", line 146, in do_GET
    f(**m.groupdict())
  File "/nix/store/v6zpn63fxb0gz3bqcmjfm22qf0sbx85q-ikos-3.2/lib/python3.11/site-packages/ikos/view.py", line 259, in _serve_report
    code = highlight(code, lexer, fmt)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1n8spmj9frs98yh7r589j1swk384ggn8-python3.11-pygments-2.17.2/lib/python3.11/site-packages/pygments/__init__.py", line 82, in highlight
    return format(lex(code, lexer), formatter, outfile)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1n8spmj9frs98yh7r589j1swk384ggn8-python3.11-pygments-2.17.2/lib/python3.11/site-packages/pygments/__init__.py", line 64, in format
    formatter.format(tokens, realoutfile)
  File "/nix/store/1n8spmj9frs98yh7r589j1swk384ggn8-python3.11-pygments-2.17.2/lib/python3.11/site-packages/pygments/formatter.py", line 124, in format
    return self.format_unencoded(tokensource, outfile)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/1n8spmj9frs98yh7r589j1swk384ggn8-python3.11-pygments-2.17.2/lib/python3.11/site-packages/pygments/formatters/html.py", line 982, in format_unencoded
    source = self.wrap(source)
             ^^^^^^^^^^^^^^^^^
TypeError: Formatter.wrap() missing 1 required positional argument: 'outfile'

I edited my installed copy to remove the outfile argument from ikos.view.Formatter.wrap, and that fixed the issue for me, but I don't know if that's sufficiently robust for inclusion upstream.