FS#49733 - [namcap] crash if a package contains some kind of binary data files

Attached to Project: Arch Linux
Opened by Michael (MST) - Thursday, 16 June 2016, 13:05 GMT
Last edited by Doug Newgard (Scimmia) - Saturday, 10 December 2016, 06:50 GMT
Task Type Bug Report
Category Arch Projects
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Running namcap against [1] sdlpop it crashes with this error:


$ namcap sdlpop-1.16-2-x86_64.pkg.tar.xz
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.5/site-packages/namcap.py", line 250, in <module>
process_realpackage(package, active_modules)
File "/usr/lib/python3.5/site-packages/namcap.py", line 103, in process_realpackage
rule.analyze(pkginfo, pkgtar)
File "/usr/lib/python3.5/site-packages/Namcap/rules/shebangdepends.py", line 109, in analyze
pkglist, orphans = findowners(scriptlist)
File "/usr/lib/python3.5/site-packages/Namcap/rules/shebangdepends.py", line 72, in findowners
stdout = subprocess.PIPE, stderr = subprocess.PIPE)
File "/usr/lib/python3.5/subprocess.py", line 950, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1483, in _execute_child
restore_signals, start_new_session, preexec_fn)
ValueError: embedded null byte


I think the reason for the error is that some of these [2] files start with !#
but are data files in some kind of binary format.

For example [3] res2012.bin (opened with nano) starts with:

#!#^@^@^@^@##^K44^T^@


I don't know if it's relevant, but when I open that file with kate, kate complains:

res2012.bin was opened with UTF-8 encoding but contained invalid characters.


I attached a PKGBUILD to reproduce the error with that file.


Package Version:
namcap 3.2.7-1

Steps to reproduce:
- build sdlpop from AUR and run namcap against it
- or use the attached PKGBUILD


[1]
https://aur.archlinux.org/packages/sdlpop

[2]
https://github.com/NagyD/SDLPoP/tree/master/data/levels-original
https://github.com/NagyD/SDLPoP/tree/master/data/levels-test
https://github.com/NagyD/SDLPoP/tree/master/data/LEVELS.DAT

[3]
https://github.com/NagyD/SDLPoP/blob/master/data/LEVELS.DAT/res2012.bin
   PKGBUILD (0.3 KiB)
This task depends upon

Closed by  Doug Newgard (Scimmia)
Saturday, 10 December 2016, 06:50 GMT
Reason for closing:  Fixed
Comment by Michael (MST) - Thursday, 16 June 2016, 16:17 GMT
The attached patch fixes it.
I don't know if there are better ways to do it.
Comment by Kyle Keen (keenerd) - Saturday, 18 June 2016, 13:18 GMT
Fixed in commit f406eb97.

And thank you for bringing the best PoP port I have ever seen to my attention.

Loading...