HomeFreeBSD

w(1): fix libxo output being locale dependant

Description

w(1): fix libxo output being locale dependant

by being locale dependant the json export is invalid in locales where
the separator for float is a comma.
The Json and the XML are invalid for login-time when days contains
contains characters which are not unicode.

Forcing locale to be C, makes this json and xml output valid and also
identical accross locales, so reliable for parsers

PR: 276304
Reported by: Vedran Miletic <vedran@miletic.net>

Details

Provenance
baptAuthored on Oct 14 2024, 7:37 AM
Parents
rGbc7afab6a1fa: Fix compilation of bsnmp tests.
Branches
Unknown
Tags
Unknown

Event Timeline

With or without the XO_STYLE_TEXT test, this will set the locale for the entire program, which may not be appropriate. It needs to only affect libxo handle-based output, so writing to other files is not affected.

I need to find a way for libxo to use its own locale setting, or to push/pop the current locale settings but this is not compatible with the current libc plumbing.

Thanks,
Phil

Ahh: vsnprintf_l() and vsprintf_l() are perfect.

Thanks,
Phil