[Bug 1405873] [NEW] -json output not valid when -class filter used

HuckleBerry huck.berry+ubunone at gmail.com
Fri Dec 26 22:16:04 UTC 2014


Public bug reported:

When lshw is invoked with the -json option, a single JSON object
describing the entire system is produced. Hardware components are nested
within the JSON object structure. When the -class filter option is used
with -json, one would expect an array of JSON objects, each representing
one of the matching hardware components. Instead, the output appears to
simply exclude the non-relevant parts of the original JSON object,
keeping the parts of the structure that match the filter. The result of
which is not a valid JSON object, which is sometimes missing required
commas and is always missing the enclosing array brackets.

Examples from two machines with varying hardware layouts are attached
(with additional -sanitze option used). Machine 1 with the 'disk' class
is the most incorrect.

Machine 1
sudo lshw -version = B.02.16
sudo dpkg -s lshw | grep Version = Version: 02.16-2
lsb_release -rd = Ubuntu 13.10
sudo lshw | grep '*-'
  *-core
     *-firmware
     *-memory:0 UNCLAIMED
        *-bank UNCLAIMED
     *-memory:1
        *-bank
     *-cache:0
     *-cache:1
     *-cache:2
     *-cpu
     *-memory:2 UNCLAIMED
     *-memory:3 UNCLAIMED
     *-pci
        *-pci:0
        *-display
        *-multimedia:0
        *-usb:0
        *-communication
        *-network
        *-usb:1
        *-multimedia:1
        *-pci:1
        *-pci:2
           *-network
        *-pci:3
           *-usb
        *-usb:2
        *-isa
        *-storage
        *-serial UNCLAIMED
     *-scsi:0
        *-disk
     *-scsi:1
        *-disk
           *-volume:0
           *-volume:1
           *-volume:2
     *-scsi:2
        *-disk
           *-volume:0
           *-volume:1
           *-volume:2
     *-scsi:3
        *-disk
     *-scsi:4
        *-disk
     *-scsi:5
        *-disk
           *-volume:0
           *-volume:1
  *-power UNCLAIMED

Machine 2
sudo lshw -version = B.02.16
sudo dpkg -s lshw | grep Version = Version: 02.16-2ubuntu1.2
lsb_release -rd = Ubuntu 14.04.1 LTS
 sudo lshw | grep '*-'
  *-core
     *-firmware:0
     *-cpu:0
     *-memory:0
        *-bank:0
        *-bank:1
     *-firmware:1
     *-cpu:1
     *-memory:1
     *-memory:2 UNCLAIMED
     *-memory:3 UNCLAIMED
     *-pci
        *-isa
        *-ide
        *-bridge UNCLAIMED
        *-display UNCLAIMED
        *-generic
  *-network

** Affects: lshw (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "attachment.tar.gz"
   https://bugs.launchpad.net/bugs/1405873/+attachment/4288047/+files/attachment.tar.gz

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to lshw in Ubuntu.
https://bugs.launchpad.net/bugs/1405873

Title:
  -json output not valid when -class filter used

Status in lshw package in Ubuntu:
  New

Bug description:
  When lshw is invoked with the -json option, a single JSON object
  describing the entire system is produced. Hardware components are
  nested within the JSON object structure. When the -class filter option
  is used with -json, one would expect an array of JSON objects, each
  representing one of the matching hardware components. Instead, the
  output appears to simply exclude the non-relevant parts of the
  original JSON object, keeping the parts of the structure that match
  the filter. The result of which is not a valid JSON object, which is
  sometimes missing required commas and is always missing the enclosing
  array brackets.

  Examples from two machines with varying hardware layouts are attached
  (with additional -sanitze option used). Machine 1 with the 'disk'
  class is the most incorrect.

  Machine 1
  sudo lshw -version = B.02.16
  sudo dpkg -s lshw | grep Version = Version: 02.16-2
  lsb_release -rd = Ubuntu 13.10
  sudo lshw | grep '*-'
    *-core
       *-firmware
       *-memory:0 UNCLAIMED
          *-bank UNCLAIMED
       *-memory:1
          *-bank
       *-cache:0
       *-cache:1
       *-cache:2
       *-cpu
       *-memory:2 UNCLAIMED
       *-memory:3 UNCLAIMED
       *-pci
          *-pci:0
          *-display
          *-multimedia:0
          *-usb:0
          *-communication
          *-network
          *-usb:1
          *-multimedia:1
          *-pci:1
          *-pci:2
             *-network
          *-pci:3
             *-usb
          *-usb:2
          *-isa
          *-storage
          *-serial UNCLAIMED
       *-scsi:0
          *-disk
       *-scsi:1
          *-disk
             *-volume:0
             *-volume:1
             *-volume:2
       *-scsi:2
          *-disk
             *-volume:0
             *-volume:1
             *-volume:2
       *-scsi:3
          *-disk
       *-scsi:4
          *-disk
       *-scsi:5
          *-disk
             *-volume:0
             *-volume:1
    *-power UNCLAIMED

  Machine 2
  sudo lshw -version = B.02.16
  sudo dpkg -s lshw | grep Version = Version: 02.16-2ubuntu1.2
  lsb_release -rd = Ubuntu 14.04.1 LTS
   sudo lshw | grep '*-'
    *-core
       *-firmware:0
       *-cpu:0
       *-memory:0
          *-bank:0
          *-bank:1
       *-firmware:1
       *-cpu:1
       *-memory:1
       *-memory:2 UNCLAIMED
       *-memory:3 UNCLAIMED
       *-pci
          *-isa
          *-ide
          *-bridge UNCLAIMED
          *-display UNCLAIMED
          *-generic
    *-network

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions



More information about the foundations-bugs mailing list