Project

General

Profile

Actions

Bug #7703

closed

in some locales, kstat -j produces invalid JSON

Added by Robert Mustacchi over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
cmd - userland programs
Start date:
2016-12-29
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

If your locale setting has a comma as decimal delimiter, kstat -j returns invalid JSON:

[root@nessi ~]# LC_ALL=de_DE.UTF-8 kstat -m acpi  -j | json 0 > /dev/null 
json: error: input is not JSON: Bad string at line 7, column 22:
            "snaptime": 1105095,740386387,
    .....................^
[root@nessi ~]#

To get correct JSON one have to change the locale:

[root@nessi ~]# LC_ALL=C kstat -m acpi  -j | json 0 > /dev/null
[root@nessi ~]#

kstat should not honor the locale if it outputs JSON.

Actions #1

Updated by Electric Monk over 5 years ago

  • Status changed from New to Closed

git commit 774814910cba5b65219849ca27b13b2fbe8127ee

commit  774814910cba5b65219849ca27b13b2fbe8127ee
Author: Bryan Cantrill <bryan@joyent.com>
Date:   2016-12-30T14:59:04.000Z

    7701 kstat -j does not produce valid JSON
    7702 kstat(1) doesn't deal well with uninitialized named kstats
    7703 in some locales, kstat -j produces invalid JSON
    Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Peter Tribble <peter.tribble@gmail.com>
    Approved by: Richard Lowe <richlowe@richlowe.net>

Actions

Also available in: Atom PDF