Skip to content

update: handle messed up namespaces in AndroidManifest.xml

This kind of parsing exception should be reported then ignored so that working APKs can be included in the index. There are so many weird things that make it into APKs, that does not automatically disqualify them from inclusion.

This APK has elements with messed up namespaces:

<uses-permission xmlns:n1="android" n1:name="android.permission.VIBRATE"/>

This was causing fdroid update to quit with an error on repo/org.sajeg.fallingblocks_3.apk:

2023-03-20 09:21:38,788 CRITICAL: Unknown exception found!
Traceback (most recent call last):
  File "/home/fdroid/fdroidserver/fdroid", line 22, in <module>
    fdroidserver.__main__.main()
  File "/home/fdroid/fdroidserver/fdroidserver/__main__.py", line 230, in main
    raise e
  File "/home/fdroid/fdroidserver/fdroidserver/__main__.py", line 211, in main
    mod.main()
  File "/home/fdroid/fdroidserver/fdroidserver/update.py", line 2247, in main
    apks, cachechanged = process_apks(apkcache, repodirs[0], knownapks,
  File "/home/fdroid/fdroidserver/fdroidserver/update.py", line 1627, in process_apks
    (skip, apk, cachethis) = process_apk(apkcache, apkfilename, repodir, knownapks,
  File "/home/fdroid/fdroidserver/fdroidserver/update.py", line 1487, in process_apk
    apk = scan_apk(apkfile)
  File "/home/fdroid/fdroidserver/fdroidserver/update.py", line 1235, in scan_apk
    scan_apk_androguard(apk, apk_file)
  File "/home/fdroid/fdroidserver/fdroidserver/update.py", line 1398, in scan_apk_androguard
    name = str(item.attrib[xmlns + 'name'])
  File "src/lxml/etree.pyx", line 2479, in lxml.etree._Attrib.__getitem__
KeyError: '{http://schemas.android.com/apk/res/android}name'

Merge request reports