[Bug 1405873] Re: -json output not valid when -class filter used
There are no fixes yet for Ubuntu 19.10 (Eoan Ermine). sudo lshw -json -quiet | python3 -m json.tool Expecting ',' delimiter: line 26 column 8 (char 792) sudo dpkg -s lshw | grep Version Version: 02.18.85-0.3 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1405873] Re: -json output not valid when -class filter used
One can see the full extent of the brokenness of the command (in all versions I've seen) using #!/usr/bin/env python3 from itertools import combinations, chain, repeat from subprocess import check_output as sco import json cmd = ['lshw', '-json', '-quiet'] classes = 'system bus memory processor bridge display generic multimedia storage network'.split() if __name__ == '__main__': for flags in chain(*(combinations(classes, n) for n in range(len(classes: flags = chain(*zip(repeat('-c'), flags)) flags = list(flags) if True: try: json.loads(sco(cmd + flags)) print(" ".join(flags), "was OK") except json.decoder.JSONDecodeError as e: print(' '.join(flags)) print(e) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1405873] Re: -json output not valid when -class filter used
https://github.com/lyonel/lshw/tree/B.02.18 outputs valid json with lshw -json -quiet though it does have the problem described in https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1593233 i.e. can only run as root, and crashes otherwise. Using git bisect, the change that broke output was https://github.com/lyonel/lshw/pull/28 See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=929206 ** Bug watch added: Debian Bug tracker #929206 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=929206 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1405873] Re: -json output not valid when -class filter used
this has actually got worse, as it now (as of 19.10 / 02.18.85-0.3 at least) breaks when no class is used e.g. $ lshw -json -quiet | python3 -m json.tool Expecting ',' delimiter: line 26, column 8 (char 785) lshw -xml | xmllint - seems to indicate xml output works ok, but the format is annoying :( -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1405873] Re: -json output not valid when -class filter used
I can confirm, this is still broken. In my output, I'm missing the leading and trailing square bracket. Also, between some stanzas there are close and open curly braces (on the same line) without a comma in between. Since those are the only two syntactical errors in the output I'm working with, this simple one-liner works around it: (echo "["; lshw -json -C network | sed 's/} .*{/}, {/'; echo "]") | jq . -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1405873] Re: -json output not valid when -class filter used
Still broken: $ sudo lshw -json -C network | jq . { "id": "network", "class": "network", ... "100bt-fd": "100Mbit/s (full duplex)", "1000bt-fd": "1Gbit/s (full duplex)", "autonegotiation": "Auto-negotiation" } } parse error: Expected value before ',' at line 48, column 4 $ Note that there is no leading [ $ sudo lshw -json -C network | head -5 { "id"; : "network", "class"; : "network", "claimed" : true, "handle" : "PCI::00:19.0", But there is a comma at line 48. Why is jq failing there? Because there is no [. If I insert one, then the problem disappears. $ sudo lshw -json -C network | head -52 | tail -6 } }, { "id"; : "network", "class" : "network", "claimed" : true, Note that there is no ] at the end of the file, which also causes jq to fail. $ sudo lshw -json -C network | tail -6 }, "capabilities" : { "ethernet" : true, "physical" : "Physical interface" } } $ -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1405873] Re: -json output not valid when -class filter used
Confirmed json output is still broken in various ways. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1405873] Re: -json output not valid when -class filter used
hmm is this still broken in the latest git? -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1405873] Re: -json output not valid when -class filter used
Can confirm, still not fixed in B.02.17 (Xenial). Example: $ sudo lshw -json -c display { [snip .. 3 graphics cards] }, which is not JSON. I think the listing of multiple devices it the unsupported case. Should have been [ { [snip .. 3 graphics cards] } ] which has outer brackets, and no trailing comma. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1405873] Re: -json output not valid when -class filter used
I'm going to give up on the `lshw -class -json` combination. * https://github.com/ClusterHQ/flocker/pull/2769 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1405873] Re: -json output not valid when -class filter used
Broken upstream. There are a bunch of related issues: * http://www.ezix.org/project/query?status=assigned=new=reopened=lshw=~json=priority -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1405873] Re: -json output not valid when -class filter used
Status changed to 'Confirmed' because the bug affects multiple users. ** Changed in: lshw (Ubuntu) Status: New = Confirmed -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1405873] Re: -json output not valid when -class filter used
Seeing the same bugs (Missing array brackets and missing commas in between objects) lsb_release -rd Description:Ubuntu 14.04.2 LTS Release:14.04 lshw -version B.02.16 lshw -json -C storage -C drive -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1405873 Title: -json output not valid when -class filter used To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/1405873/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs