FS#68358 - [namcap] stumbles upon empty source=()

Attached to Project: Arch Linux
Opened by Erich Eckner (deepthought) - Wednesday, 21 October 2020, 08:00 GMT
Last edited by Eli Schwartz (eschwartz) - Wednesday, 21 October 2020, 10:50 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

If a package does not have any sources, namcap crashes when inspecting the PKGBUILD. Take, for example, this one:
https://aur.archlinux.org/packages/reflector-nomirrorlist/

Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.8/site-packages/namcap.py", line 247, in <module>
process_pkgbuild(package, active_modules)
File "/usr/lib/python3.8/site-packages/namcap.py", line 148, in process_pkgbuild
ret = rule.analyze(pkginfo, package)
File "/usr/lib/python3.8/site-packages/Namcap/rules/makedepends.py", line 59, in analyze
for s in pkginfo["source"]:
File "/usr/lib/python3.8/site-packages/Namcap/package.py", line 128, in __getitem__
return self._data[self.canonical_varname(key)]
KeyError: 'source'


Steps to reproduce:

> git clone https://aur.archlinux.org/reflector-nomirrorlist.git
> cd reflector-nomirrorlist
> namcap PKGBUILD

I'm no expert in the namcap code, but I believe, there should be a "if 'source' not in pkginfo: return" check before the loop line, in which namcap crashes. This would be similar to the checks for missing makedepends or depends a few ten lines above this one.
This task depends upon

Closed by  Eli Schwartz (eschwartz)
Wednesday, 21 October 2020, 10:50 GMT
Reason for closing:  Duplicate
Additional comments about closing:   FS#65042  and fixed in git

Loading...