Bug 3926 - Parse error isn't handled correctly
Summary: Parse error isn't handled correctly
Status: RESOLVED FIXED
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: 1.4
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 1.4
Assignee: Christopher Larson
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-02-22 11:46 UTC by Ross Burton
Modified: 2013-02-26 15:35 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: Regression (Used to work)
Verified:
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.