xkbcommon-compose.h: change recommended locale fallback code to treat empty string same as unset
The previous code would cause failures to find the Compose file if one of the environment variables LC_ALL, LC_CTYPE or LANG are set to the empty string. The description of the fallback procedure in loclale(7) talks about "non-null environment variable"; I interpreted this to mean the environment variable is unset, but it actually means unset or empty (I verified this by looking at what glibc and musl do). A recent bug in systemd https://github.com/systemd/systemd/issues/6407 exposed this issue. It causes these these variables to be set to the empty string in TTY sessions. Reported by "doodoo" in https://bbs.archlinux.org/viewtopic.php?id=228658 Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
ba9568bdb1
commit
f468f0b243
|
@ -180,12 +180,13 @@ enum xkb_compose_format {
|
|||
* you may nevertheless obtain the user's locale directly using
|
||||
* environment variables, as described in locale(7). For example,
|
||||
* @code
|
||||
* const char *locale;
|
||||
* locale = getenv("LC_ALL");
|
||||
* if (!locale)
|
||||
* if (!locale || !*locale)
|
||||
* locale = getenv("LC_CTYPE");
|
||||
* if (!locale)
|
||||
* if (!locale || !*locale)
|
||||
* locale = getenv("LANG");
|
||||
* if (!locale)
|
||||
* if (!locale || !*locale)
|
||||
* locale = "C";
|
||||
* @endcode
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue