What were you trying to do that didn't work?
When running the lshw command with the -json option on a RHEL8 system, the JSON output is malformed. This issue affects the ability to automatically parse hardware information, which is crucial for various system management and monitoring tasks.
What is the impact of this issue to you/customer?
The malformed JSON output from the lshw command significantly impacts our business operations in the following ways:
Compliance and Auditing: Accurate hardware inventory is essential for compliance and auditing purposes. The malformed JSON output compromises our ability to maintain an up-to-date and accurate hardware inventory, which can lead to compliance violations.
Please provide the package NVR for which the bug is seen:
[root@localhost ~]# rpm -aq | grep lshw
lshw-B.02.19.2-6.el8.x86_64
How reproducible is this bug?:
Upon further checking with and comparing the outputs with RHEL 8 and RHEL 9/10
~~~
[root@rhel8 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.10 (Ootpa)
[root@rhel8 ~]# lshw -C display -json
{
"id" : "display",
"class" : "display",
"claimed" : true,
"handle" : "PCI:0000:00:01.0",
"description" : "VGA compatible controller",
"product" : "Virtio 1.0 GPU",
"vendor" : "Red Hat, Inc.",
"physid" : "1",
"businfo" : "pci@0000:00:01.0",
"logicalname" : "/dev/fb0",
"version" : "01",
"width" : 64,
"clock" : 33000000,
"configuration" :
,
"capabilities" : {
"msix" : "MSI-X",
"vga_controller" : true,
"bus_master" : "bus mastering",
"cap_list" : "PCI capabilities listing",
"rom" : "extension ROM",
"fb" : "framebuffer"
},
"children" : [
]
},
[root@rhel8 ~]# lshw -C display -json &> /tmp/lshw.json
[root@rhel8 ~]# jq empty /tmp/lshw.json && echo "Valid JSON" || echo "Malformed JSON"
parse error: Expected value before ',' at line 32, column 4
Malformed JSON
~~~
Expected results:
When we verifty the lshw.json file it should return "Valid JSON"
root@rhel8:~# jq empty /tmp/lshw.json && echo "Valid JSON" || echo "Malformed JSON"
Valid JSON
Actual results:
[root@rhel8 ~]# jq empty /tmp/lshw.json && echo "Valid JSON" || echo "Malformed JSON"
parse error: Expected value before ',' at line 32, column 4
Malformed JSON