Date: Mon, 09 Feb 2015 20:31:10 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 197499] wc libxo emits invalid JSON when used on multiple files Message-ID: <bug-197499-8@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197499 Bug ID: 197499 Summary: wc libxo emits invalid JSON when used on multiple files Product: Base System Version: 11.0-CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: freebsd-bugs@FreeBSD.org Reporter: allanjude@FreeBSD.org When using wc's libxo JSON output method, it emits invalid JSON. Steps to recreate: wc --libxo json /etc/defaults/* The output is (pretty-printed for readability): { "wc": { "file": [ { "lines": 111, "words": 644, "characters": 3999, "filename": "/etc/defaults/bluetooth.device.conf" }, { "lines": 87, "words": 403, "characters": 2439, "filename": "/etc/defaults/devfs.rules" }, { "lines": 385, "words": 1228, "characters": 11700, "filename": "/etc/defaults/periodic.conf" }, { "lines": 692, "words": 4576, "characters": 36171, "filename": "/etc/defaults/rc.conf" }, "total": { "lines": 1275, "words": 6851, "characters": 54309, "filename": "total" } ] } } The problem is that the 'total' segment, is a key/value pair, but that is not allowed inside an array. The output would either need to be changed to remove the key (the other elements in the array use the filename for identification), or be made a sibling of the 'file' 2nd level element, like so: { "wc": { "file": [ { "lines": 111, "words": 644, "characters": 3999, "filename": "/etc/defaults/bluetooth.device.conf" }, { "lines": 87, "words": 403, "characters": 2439, "filename": "/etc/defaults/devfs.rules" }, { "lines": 385, "words": 1228, "characters": 11700, "filename": "/etc/defaults/periodic.conf" }, { "lines": 692, "words": 4576, "characters": 36171, "filename": "/etc/defaults/rc.conf" } ], "total": { "lines": 1275, "words": 6851, "characters": 54309, "filename": "total" } } } -- You are receiving this mail because: You are the assignee for the bug.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-197499-8>