xrmx / bootchart

merge of bootchart-collector and pybootchartgui
GNU General Public License v2.0
233 stars 88 forks source link

dmesg parsing fails on non-ASCII bytes #38

Closed ghost closed 12 years ago

ghost commented 12 years ago

I've got this line in my dmesg output, with a UTF-8-encoded ® symbol (file /sys/bus/usb/devices/3-2/product confirms it):

[    5.339102] usb 3-2: Product: Natural® Ergonomic Keyboard 4000

pybootchartgui doesn't seem to like it much...

No path given, trying /var/log/bootchart.tgz
parsing '/var/log/bootchart.tgz'
parsing 'header'
  0.0 seconds
parsing 'dmesg'
Traceback (most recent call last):
  File "/usr/bin/pybootchartgui", line 23, in <module>
    sys.exit(main())
  File "/usr/lib64/python2.7/site-packages/pybootchartgui/main.py", line 124, in main
    res = parsing.Trace(writer, args, options)
  File "/usr/lib64/python2.7/site-packages/pybootchartgui/parsing.py", line 46, in __init__
    parse_paths (writer, self, paths)
  File "/usr/lib64/python2.7/site-packages/pybootchartgui/parsing.py", line 679, in parse_paths
    state = _do_parse(writer, state, name, tf.extractfile(name))
  File "/usr/lib64/python2.7/site-packages/pybootchartgui/parsing.py", line 637, in _do_parse
    state.kernel = _parse_dmesg(writer, file)
  File "/usr/lib64/python2.7/site-packages/pybootchartgui/parsing.py", line 494, in _parse_dmesg
    for line in file.read().decode().split('\n'):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 59783: ordinal not in range(128)
agaida commented 12 years ago

confirmed with Microsoft Nano Tranceiver, original dmesg output

[    2.211506] usb 1-2.1.1: Product: Microsoft\xffffffc2\xffffffae\xffffffae Nano Transceiver v2.0
[    2.216669] input: Microsoft Microsoft\xffffffc2\xffffffae\xffffffae Nano Transceiver v2.0 as /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.1/1-2.1.1/1-2.1.1:1.0/input/input0
[    2.216718] generic-usb 0003:045E:0745.0001: input,hidraw0: USB HID v1.11 Keyboard [Microsoft Microsoft\xffffffc2\xffffffae\xffffffae Nano Transceiver v2.0] on usb-0000:00:12.2-2.1.1/input0
[    2.222675] input: Microsoft Microsoft\xffffffc2\xffffffae\xffffffae Nano Transceiver v2.0 as /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.1/1-2.1.1/1-2.1.1:1.1/input/input1
[    2.222772] generic-usb 0003:045E:0745.0002: input,hidraw1: USB HID v1.11 Mouse [Microsoft Microsoft\xffffffc2\xffffffae\xffffffae Nano Transceiver v2.0] on usb-0000:00:12.2-2.1.1/input1
[    2.243098] input: Microsoft Microsoft\xffffffc2\xffffffae\xffffffae Nano Transceiver v2.0 as /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.1/1-2.1.1/1-2.1.1:1.2/input/input2
[    2.243240] generic-usb 0003:045E:0745.0003: input,hiddev0,hidraw2: USB HID v1.11 Device [Microsoft Microsoft\xffffffc2\xffffffae\xffffffae Nano Transceiver v2.0] on usb-0000:00:12.2-2.1.1/input2

resulting in Microsoft® Nano ..

xrmx commented 12 years ago

Thanks for filing the bug guys, @agaida seen your bootchart.tgz on debian bts.

xrmx commented 12 years ago

Could you please confirm this is working for you too?

ghost commented 12 years ago

Works for me now. Thanks!

agaida commented 12 years ago

Works for me™ Thanks!