Bug 3926

Summary: Parse error isn't handled correctly
Product: [Build System, Metadata & Runtime] BitBake Reporter: Ross Burton <ross.burton>
Component: bitbakeAssignee: Christopher Larson <kergoth>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: kergoth, poky.bs.watcher, poky.watcher, sgw
Version: 1.4   
Target Milestone: 1.4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: Regression (Used to work)
Verified: Documentation change: ---

Description Ross Burton 2013-02-22 11:46:14 UTC

    
Comment 1 Ross Burton 2013-02-22 11:48:26 UTC
Pressing enter in the summary isn't recommended.

If a recipe has invalid syntax, i.e.:

"""
S = "${WORKDIR}"

TODO make machine-specific and re-use rootless_x to either run as root, or add
xuser to weston-launch group?
"""

Then bitbake doesn't handle this as you'd expect:

$ bitbake core-image-wayland
ERROR: Command execution failed: Traceback (most recent call last):                                    File "/home/ross/Yocto/poky/bitbake/lib/bb/command.py", line 92, in runAsyncCommand
    self.cooker.updateCache()
  File "/home/ross/Yocto/poky/bitbake/lib/bb/cooker.py", line 1330, in updateCache
    if not self.parser.parse_next():
  File "/home/ross/Yocto/poky/bitbake/lib/bb/cooker.py", line 1703, in parse_next
    self.virtuals += len(result)
TypeError: object of type 'ParseError' has no len()

There is a except bb.parse.ParseError, but in this case the error isn't being raised, but being returned in the result.  Annoyingly this means you can't extract a stack from the exception.
Comment 2 Ross Burton 2013-02-22 11:54:44 UTC
Introduced by 325410e2b20920a9903d0cafcb992b3452dcdb15.
Comment 3 Ross Burton 2013-02-22 11:56:31 UTC
Just got this:

ERROR: Command execution failed: Traceback (most recent call last):
  File "/home/ross/Yocto/poky/bitbake/lib/bb/command.py", line 92, in runAsyncCommand
    self.cooker.updateCache()
  File "/home/ross/Yocto/poky/bitbake/lib/bb/cooker.py", line 1330, in updateCache
    if not self.parser.parse_next():
  File "/home/ross/Yocto/poky/bitbake/lib/bb/cooker.py", line 1703, in parse_next
    self.virtuals += len(result)
TypeError: object of type 'ExpansionError' has no len()".

Reverting 325410e2b20920a9903d0cafcb992b3452dcdb15 gives me:

ERROR: ExpansionError during parsing /home/ross/Yocto/poky/meta/recipes-graphics/wayland/weston-init.bb: Failure expanding variable do_install: ShellSyntaxError: LexToken(Fi,'fi',0,0)
followed by:
  LexToken(NEWLINE,'\n',0,0)
Comment 4 Christopher Larson 2013-02-25 17:49:20 UTC
Patch submitted to bitbake-devel.