Bug 9750 - yocto-bsp create: no graceful error message for wrong format in input file
Summary: yocto-bsp create: no graceful error message for wrong format in input file
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: Scripts and Tools (show other bugs)
Version: 2.2
Hardware: x86 Multiple
: Medium minor
Target Milestone: 2.2 M2
Assignee: Humberto Ibarra
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-06-09 17:20 UTC by Humberto Ibarra
Modified: 2016-07-07 14:57 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Humberto Ibarra 2016-06-09 17:20:36 UTC
spinoff from #9720

A file with bad format was given to yocto-bsp create. The script should be expected to fail gracefully but instead it threw an error trace and an exception. Here are the commands executed:

$ yocto-bsp list arm properties > arm.properties
$ yocto-bsp create myarm arm --infile=arm.properties 
Traceback (most recent call last):
  File "/home/lsandov1/poky/scripts/yocto-bsp", line 150, in <module>
    ret = main()
  File "/home/lsandov1/poky/scripts/yocto-bsp", line 145, in main
    invoke_subcommand(args, parser, yocto_bsp_help_usage, subcommands)
  File "/home/lsandov1/poky/scripts/lib/bsp/help.py", line 73, in invoke_subcommand
    subcommands.get(args[0], subcommand_error)[0](args[1:], usage)
  File "/home/lsandov1/poky/scripts/yocto-bsp", line 89, in yocto_bsp_create_subcommand
    yocto_bsp_create(machine, karch, scripts_path, bsp_output_dir, options.codedump, options.properties_file)
  File "/home/lsandov1/poky/scripts/lib/bsp/engine.py", line 1615, in yocto_bsp_create
    yocto_common_create(machine, arch, scripts_path, bsp_output_dir, codedump, properties_file, properties)
  File "/home/lsandov1/poky/scripts/lib/bsp/engine.py", line 1554, in yocto_common_create
    properties = json.load(infile)
  File "/usr/lib/python3.4/json/__init__.py", line 268, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.4/json/__init__.py", line 318, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.4/json/decoder.py", line 346, in decode
    raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column 31 - line 552 column 1 (char 30 - 12750)

Need to add a clearer message pointing to the error.
Comment 1 Humberto Ibarra 2016-07-04 19:54:08 UTC
Sent patch

https://lists.yoctoproject.org/pipermail/poky/2016-July/010609.html