Bug 213478 - procstat --libxo produces non-compliant JSON and XML output
Summary: procstat --libxo produces non-compliant JSON and XML output
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: 11.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-standards (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-14 15:31 UTC by Dancho Penev
Modified: 2017-05-16 18:50 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dancho Penev 2016-10-14 15:31:08 UTC
Just tried the new functionality for machine readable output of "procstat" and found two issues with non standard compliant output generated for JSON and XML formats. Suppose that this is an issue with "libxo" library, not "procstat" but didn't dig further.
For JSON output hexadecimal numbers are printed as normal numbers while JSON standard says that numbers can be only decimal digits, in my opinion they needs to be printed as strings. Here is example output showing the issue:

# procstat --libxo:PJ -v 841
{
  "__version": "1",
  "procstat": {
    "vm": {
      "841": {
        "process_id": 841,
        "vm": [
          {
            "kve_start": 0x400000,
            "kve_end": 0x8f9000,
...


For XML output PID is used as name the element while XML element name must start with letter or underscore. Here is an example:

<procstat __version="1">
  <vm>
    <841>
      <process_id>841</process_id>
      <vm>
...
Comment 1 Dancho Penev 2016-10-14 15:32:33 UTC
Fixing OS version, it's 11 not 10.
Comment 2 Jilles Tjoelker freebsd_committer freebsd_triage 2016-10-16 12:38:00 UTC
This seems a valid bug. JSON containing "numbers" like 0x400000 is often rejected completely.

I don't know the best way to fix this.
Comment 3 Phil Shafer freebsd_committer freebsd_triage 2016-10-20 00:53:48 UTC
These are fixed in libxo-0.6.4, which I'll import shortly.

Thanks,
 Phil
Comment 4 Phil Shafer freebsd_committer freebsd_triage 2017-05-16 18:50:25 UTC
Fixed in libxo-0.6.4