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

Also available in: Atom PDF