Page MenuHomeFreeBSD

uptime: Avoid overriding more locale categories than necessary
Needs ReviewPublic

Authored by markj on Sun, Nov 2, 5:07 PM.
Tags
None
Referenced Files
F137810258: D53539.diff
Wed, Nov 26, 12:57 AM
F137748418: D53539.diff
Tue, Nov 25, 11:12 AM
Unknown Object (File)
Sun, Nov 23, 8:50 PM
Unknown Object (File)
Sat, Nov 22, 7:09 AM
Unknown Object (File)
Wed, Nov 19, 3:07 AM
Unknown Object (File)
Tue, Nov 11, 5:40 AM
Unknown Object (File)
Thu, Nov 6, 9:38 PM
Unknown Object (File)
Thu, Nov 6, 9:38 PM
Subscribers

Details

Reviewers
bapt
des
Summary

uptime(1) prints floating point numbers to represent the current load
averages. When emitting JSON, these numbers cannot use a comma as the
decimal separator. Commit bd490be57438 fixed a bug along these lines,
but in so doing it overrides all locale categories. As a result, we
emit 12h time in non-text mode, but for that field we should probably
just respect the user's configured locale.

PR: 290328
Fixes: bd490be57438 ("w(1): fix libxo output being locale dependant")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68358
Build 65241: arc lint + arc unit

Event Timeline

markj requested review of this revision.Sun, Nov 2, 5:07 PM

I don't think this is the correct solution either. For one, it is a local fix for a problem that affects all libxo consumers. For another, it will use the wrong decimal separators when emitting HTML (which should be localized, but won't if this patch is committed). I think libxo should be modified to always use the C locale when formatting numbers in json output, and bd490be57438 should be reverted.

In D53539#1222315, @des wrote:

I don't think this is the correct solution either. For one, it is a local fix for a problem that affects all libxo consumers. For another, it will use the wrong decimal separators when emitting HTML (which should be localized, but won't if this patch is committed). I think libxo should be modified to always use the C locale when formatting numbers in json output, and bd490be57438 should be reverted.

This all makes sense. @phil do you have any comments on the libxo side of things? Does libxo have a particular stance on this kind of problem?