From 78842e9cc26d051ba2882055c93f99df5840d7c9 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 15 Mar 2021 10:10:09 +0100 Subject: [PATCH] scanner: should not exit with error when apkanalyzer fails apkanalyzer produces useful output when it can run, but it does not support all recent JDK versions, and also some DEX versions, so this cannot count on it to always produce useful output or even to run without exiting with an error. 211dd65ff0263e3b680dcd21f9e0efa3dd7e50d7 was based on false assumptions that apkanalyzer can always produce output. fdroiddata!8585 fdroiddata!8584 --- fdroidserver/scanner.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index 239e82b4..436abf1e 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -103,12 +103,20 @@ def get_gradle_compile_commands(build): def scan_binary(apkfile): - logging.info("Scanning APK for known non-free classes.") + """Scan output of apkanalyzer for known non-free classes + + apkanalyzer produces useful output when it can run, but it does + not support all recent JDK versions, and also some DEX versions, + so this cannot count on it to always produce useful output or even + to run without exiting with an error. + + """ + + logging.info(_('Scanning APK with apkanalyzer for known non-free classes.')) result = common.SdkToolsPopen(["apkanalyzer", "dex", "packages", "--defined-only", apkfile], output=False) - problems = 0 if result.returncode != 0: - problems += 1 - logging.error(result.output) + logging.warning(_('scanner not cleanly run apkanalyzer: %s') % result.output) + problems = 0 for suspect, regexp in CODE_SIGNATURES.items(): matches = regexp.findall(result.output) if matches: