Michael Stapelberg 5446ea33ef fix switching to/restoring from LC_NUMERIC (#6544)
Before this commit, we used setlocale(LC_NUMERIC, "");,
but that is not correct because it doesn’t nest:
load_layout.c (sets LC_NUMERIC=C) calls con_mark(),
which calls ipc_send_window_event() (sets LC_NUMERIC=C),
which calls setlocale(LC_NUMERIC, ""); when returning,
but now load_layout has LC_NUMERIC set per the environment,
whereas the function expects to remain in LC_NUMERIC=C.

Using newlocale and uselocale just swaps handles,
which is a little cleaner than querying the locale with
strdup(setlocale(LC_NUMERIC, NULL)); and restoring it later.

The test only fails with certain locales, e.g. LC_NUMERIC=de_DE.
I don’t think it’s important to set a locale in our test runner,
(which locales are available is very system-dependent),
as I am personally regularly testing with LC_NUMERIC=de_DE ;)

fixes https://github.com/i3/i3/issues/6391
2025-12-13 08:27:00 +01:00
2025-03-21 12:48:29 +00:00

Logo i3: A tiling window manager

Build Status Issue Stats Pull Request Stats

Packages Packages

i3 is a tiling window manager for X11.

For more information about i3, please see the project's website and online documentation.

For information about contributing to i3, please see CONTRIBUTING.md.

Description
Languages
C 58%
Perl 36.4%
Raku 2.6%
Ruby 1.2%
Meson 0.7%
Other 1%