Bug 9136

Summary: make graph-size fails with "ValueError: too many values to unpack"
Product: buildroot Reporter: Matthias <porto.rio>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: buildroot, yann.morin.1998
Priority: P5    
Version: 2016.05   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:
Attachments: Proposed patch to resolve the described bug

Description Matthias 2016-08-04 08:14:24 UTC
Created attachment 6576 [details]
Proposed patch to resolve the described bug

We encountered a problem when executing make graph-size in conjunction with package usb-modeswitch.

make graph-size command fails with following error output:
Traceback (most recent call last):
  File "/home/elinux/Porto/Rio.Porto.OperatingSystem/work/buildroot-2016.05/support/scripts/size-stats", line 207, in <module>
    pkgdict = build_package_dict(args.builddir)
  File "/home/elinux/Porto/Rio.Porto.OperatingSystem/work/buildroot-2016.05/support/scripts/size-stats", line 69, in build_package_dict
    pkg, fpath = l.split(",")
ValueError: too many values to unpack
Makefile:735: recipe for target 'graph-size' failed
make[1]: *** [graph-size] Error 1
Makefile:16: recipe for target '_all' failed
make: *** [_all] Error 2

Parsing of packages-file-list.txt fails because of the following line:

usb_modeswitch_data,./usr/share/usb_modeswitch/05c6:1000:uMa=Co.,Ltd

where the path component itself contains a "," character, that is used for spliting.

See support/scripts/size-stats, line 69:
pkg, fpath = l.split(",")

With that line above, split command returns a list of three elements rather than a tuple leading to the error: "ValueError: too many values to unpack"

Proposed fix: set split maxsplit argument to 1:
pkg, fpath = l.split(",", 1)

See also attached patch.
Comment 1 Yann E. MORIN 2016-08-06 09:38:34 UTC
Matthias,

Thanks for spotting the issue.
Patch looks good; can you submit it to the list, as
explained in the manual, please?
    https://buildroot.org/downloads/manual/manual.html#submitting-patches

Regards,
Yann E. MORIN.
Comment 2 Thomas Petazzoni 2016-08-09 10:27:57 UTC
Fixed in https://git.buildroot.org/buildroot/commit/?id=34b1bdeba40bf303dc8821421745d5b38a729984. Thanks for reporting the bug! Next time, please send your patches to the mailing list :)
Comment 3 Matthias 2016-08-09 14:16:12 UTC
Thanks for fixing it. I was about to send the patch to the mailing list, but you have been faster :-)