lshw -json output invalid

Bug #1843063 reported by Rod Smith
34
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Checkbox Provider - Base
Invalid
High
Unassigned
OEM Priority Project
Fix Released
High
Yuan-Chen Cheng
lshw (Ubuntu)
Fix Released
High
Unassigned
Focal
Fix Released
High
Unassigned

Bug Description

Beginning with Ubuntu 19.10 (Eoan) pre-release versions, the "lshw -json" output appears to be invalid, and can't be parsed with either Python's json library or the jq stand-alone command:

$ sudo lshw -json | jq .
parse error: Expected separator between values at line 25, column 8

The Python json library reports "Expecting ',' delimiter: line 25 column 8 (char 718)".

The first offending snippet looks like this:

  "capabilities" : {
    "smbios-2.7" : "SMBIOS version 2.7",
    "dmi-2.7" : "DMI version 2.7",
    "smp" : "Symmetric Multi-Processing",
    "vsyscall32" : "32-bit processes"
  } {
      "id" : "core",
      "class" : "bus",

Note the "} {" line. In pre-Eoan versions of Ubuntu, the equivalent snippet looks like this:

  "capabilities" : {
    "smbios-2.7" : "SMBIOS version 2.7",
    "dmi-2.7" : "DMI version 2.7",
    "vsyscall32" : "32-bit processes"
  },
  "children" : [
    {
      "id" : "core",
      "class" : "bus",

It looks like the new version is dropping the ', "children" : [' part.

On the offending system:

$ lsb_release -rd
Description: Ubuntu Eoan Ermine (development branch)
Release: 19.10

$ apt-cache policy lshw
lshw:
  Installed: 02.18.85-0.3
  Candidate: 02.18.85-0.3
  Version table:
 *** 02.18.85-0.3 500
        500 http://us.archive.ubuntu.com/ubuntu eoan/main amd64 Packages
        100 /var/lib/dpkg/status

Jeff Lane  (bladernr)
Changed in lshw (Ubuntu):
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Jeff Lane  (bladernr) wrote :

https://ezix.org/project/wiki the source is there, however, there are several JSON related bugs, some of which seem to be the same as this, but have been open for several years without update.

We may need to fix this ourselves.

Changed in plainbox-provider-checkbox:
importance: Undecided → High
status: New → Confirmed
tags: added: eoan
Changed in oem-priority:
assignee: nobody → Yuan-Chen Cheng (ycheng-twn)
status: New → Confirmed
importance: Undecided → High
tags: added: oem-priority
Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

command that can do testing: lshw -json 2>/dev/null | python -m json.tool

Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

per my test, this fix this bug: https://github.com/lyonel/lshw/pull/48

Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

ppa for testing: https://launchpad.net/~ycheng-twn/+archive/ubuntu/lshw
TODO: change log need refine (might need to refine in patch file)

Revision history for this message
Rod Smith (rodsmith) wrote :

I've tested the PPA in the application that originally prompted my bug report, and it's working fine. Will this be merged into Ubuntu's version of lshw before 20.04 is released?

Changed in plainbox-provider-checkbox:
status: Confirmed → Invalid
Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

fix in #4 is not perfect, since it still will create bad json for command like

lshw -json -c bridge

need to update the patch.

Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

https://launchpad.net/~ycheng-twn/+archive/ubuntu/lshw-3 have the patch to fix the issue.

Please kindly test it and report your test status.

Revision history for this message
Jeff Lane  (bladernr) wrote :

Hi, so what are the chances that this will be fixed in 20.04?

Revision history for this message
Andrew Cloke (andrew-cloke) wrote :

(To be explicit) note that the Server Certification tests are dependant on the lshw json output, so this issue currently breaks the Server Certification test suite.

tags: added: rls-ff-incoming
Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

My plan was to have the patch in #7 merged in upstream (https://ezix.org/src/pkg/lshw/pulls/28), and then land the patch in Debian/Ubuntu.

However, due to my workload is in peak time, maybe I won't manage to go that path.

I believe we can land the patch in #7 to ubuntu. Feel free to do so.

summary: - lshw -json output invalid in Eoan
+ lshw -json output invalid
tags: removed: rls-ff-incoming
Changed in lshw (Ubuntu Focal):
status: Confirmed → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lshw - 02.18.85-0.3ubuntu1

---------------
lshw (02.18.85-0.3ubuntu1) focal; urgency=medium

  * Cherrypick upstream pull-request/patch to fix json output. LP:
    #1843063

 -- Dimitri John Ledkov <email address hidden> Thu, 30 Jan 2020 16:24:24 +0000

Changed in lshw (Ubuntu Focal):
status: Triaged → Fix Released
Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

test passed on focal with version 02.18.85-0.3ubuntu1 for me.

Changed in oem-priority:
status: Confirmed → Fix Released
Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

Guess it will be trivial to backport to eoan. Shall we?

tags: added: id-5e331fce1c6faf366695a774
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.