Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jan 2024 20:12:15 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 276304] w(1) with produces invalid JSON output with --libxo json parameter on Croatian locale
Message-ID:  <bug-276304-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D276304

            Bug ID: 276304
           Summary: w(1) with produces invalid JSON output with --libxo
                    json parameter on Croatian locale
           Product: Base System
           Version: 14.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: vedran@miletic.net

% w --libxo json
{"uptime-information": {"time-of-day":"
9:01PM","uptime":2667682,"days":30,"hours":21,"minutes":1,"seconds":22,"upt=
ime-human":"
30 days,
21:01,","users":2,"load-average-1":0,25,"load-average-5":0,34,"load-average=
-15":0,30,
"user-table": {"user-entry":
[{"user":"vedranm","tty":"pts/1","from":"p508c7e40.dip0.t-ipconnect.de","lo=
gin-time":"
8:44PM","command":"w --libxo json"},
{"user":"vedranm","tty":"pts/2","from":"tmux(40223).%0","login-time":"=C4=
=8Det01PM","idle":20,"command":"btop"}]}}}

This is not valid JSON. One can notice the values 0,25, 0,34, and 0,30; num=
ber
separator is printed as comma, while JSON requires the dot to be used
regardless of locale. Setting locale to en_US.utf-8 like

% env LC_ALL=3Den_US.utf-8 w --libxo json

will produce correct result. Other comands, such as ps, output numbers with
decimals as strings (bug 265223) and avoid this issue.

--=20
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-276304-227>