Skip to content

ScannerTool crash

I ran into this issue, when I instantiate ScannerTool, but without executing scanner.py::main().

2024-05-15 14:36:09,110 INFO: Scanning source for common problems...
2024-05-15 14:36:09,113 DEBUG: scanner is configured to use signature data from: 'suss'
Traceback (most recent call last):
  File "/wanderer/fdroidserver/build_local_run.py", line 579, in main
    run_this_build(config, options, package_name, version_code)
  File "/wanderer/fdroidserver/build_local_run.py", line 237, in run_this_build
    scan_build_dir(options, app, build)
  File "/wanderer/fdroidserver/build_local_run.py", line 193, in scan_build_dir
    count = fdroidserver.scanner.scan_source(build_dir, build)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/wanderer/fdroidserver/scanner.py", line 733, in scan_source
    for name in suspects_found(line):
  File "/wanderer/fdroidserver/scanner.py", line 451, in suspects_found
    for n, r in _get_tool().regexs['err_gradle_signatures'].items():
                ^^^^^^^^^^^
  File "/wanderer/fdroidserver/scanner.py", line 413, in _get_tool
    scanner._SCANNER_TOOL = ScannerTool()
                            ^^^^^^^^^^^^^
  File "/wanderer/fdroidserver/scanner.py", line 334, in __init__
    options_refresh_scanner = options and options.refresh_scanner
                                          ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Namespace' object has no attribute 'refresh_scanner'

So what's happening here is that options (the object containing parsed command line arguments) wasn't initialized with the command line options of scanner.py. So some values it's expecting aren't there.

In this particular case function in build_local_run.py (stripped down copy of build.py) is requesting to get something scanned. I think scanner should comply instead of crashing

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information