Actions
Bug #9992
openkstat -j does not produce valid JSON
Status:
New
Priority:
Normal
Assignee:
-
Category:
cmd - userland programs
Start date:
2018-11-20
Due date:
% Done:
0%
Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
Description
The kstat command fails to produce valid JSON objects when used with a count of greater than one:
kstat -j unix::dbu_evict:tasks 1 2 [{ "module": "unix", "instance": 21, "name": "dbu_evict", "class": "taskq", "type": 1, "snaptime": 3383559.368276734, "data": { "tasks": 10536387 } }] [, { "module": "unix", "instance": 21, "name": "dbu_evict", "class": "taskq", "type": 1, "snaptime": 3383576.634575867, "data": { "tasks": 10536387 } }]
While the first JSON object is properly formatted, the second is not. There is an improper comma after the opening of the array and before the opening of the associate array:
[, {
This should instead look like the beginning of the first block:
[{
Updated by Joshua M. Clulow over 3 years ago
I suspect it's time we refactored the JSON emitter logic in kstat
to be in terms of something a bit more robust, like:
Note that while the code above appears to be MPLv2 licensed in that repository, we own the copyright at Joyent and we can definitely replace that with the CDDL for inclusion into illumos.
Actions