Bug 9230

Summary: Tracebacks sometimes apparently truncated
Product: [Build System, Metadata & Runtime] BitBake Reporter: Paul Eggleton <bluelightning>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: Medium+ CC: poky.bs.watcher, poky.watcher
Version: 2.0   
Target Milestone: 2.1 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Paul Eggleton 2016-03-09 04:57:08 UTC
I sometimes hit situations working on BitBake code where a printed exception traceback is truncated - the function where the exception is occurring isn't listed, instead it stops a function or two prior.

A trivial reproducer for this was the missing argument to ParameterError in fetch2/npm.py; simply run the following:

recipetool create npm://registry.npmjs.org

This should try to raise ParameterError except the requisite number of arguments haven't been passed; so what you get is a TypeError; however the last line in the trace isn't the errant one. Here's what I get:

---------- snip ----------
Traceback (most recent call last):
  File "/home/paul/poky/poky/scripts/recipetool", line 116, in <module>
    ret = main()
  File "/home/paul/poky/poky/scripts/recipetool", line 107, in main
    ret = args.func(args)
  File "/home/paul/poky/poky/scripts/lib/recipetool/create.py", line 366, in create_recipe
    checksums = scriptutils.fetch_uri(tinfoil.config_data, fetchuri, srctree, srcrev)
  File "/home/paul/poky/poky/scripts/lib/scriptutils.py", line 85, in fetch_uri
    fetcher = bb.fetch2.Fetch([uri], localdata)
  File "/home/paul/poky/poky/bitbake/lib/bb/fetch2/__init__.py", line 1493, in __init__
    self.ud[url] = FetchData(url, d, localonly)
TypeError: __init__() takes exactly 3 arguments (2 given)
---------- snip ----------

(Note that I've sent a patch to pass the correct number of arguments, so if that's been merged you'll naturally need to revert it locally to see this again.)

At a guess, this may have something to do with the object structure and the indirection that's being used (i.e. the call to self.method.urldata_init(self, d)). I'm unsure as to whether all of this is caused by a bug in our code or just a general python bug though.