Failed to configure LOCALE for invalid locale name
I am getting this error when trying to launch redis-server on macOS. It works fine from the native terminal or iTerm, so I assume there's something wrong with Wave.
Output when executing redis-server without any additional arguments:
* oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
* Redis version=7.2.4, bits=64, commit=00000000, modified=0, pid=17456, just started
# Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
# Failed to configure LOCALE for invalid locale name.
I am on Wave Terminal 0.7.0, macOS Sonoma. You can reproduce it by installing Redis with brew install redis
Seems like this is the code responsible for the error message: https://github.com/redis/redis/blob/unstable/src/server.c#L2640
/* Make sure the locale is set on startup based on the config file. */
if (setlocale(LC_COLLATE,server.locale_collate) == NULL) {
serverLog(LL_WARNING, "Failed to configure LOCALE for invalid locale name.");
exit(1);
}
I thought it might be related to https://github.com/wavetermdev/waveterm/pull/211, but it probably isn't.
I found a temp fix. Output of locale from iTerm and system Terminal:
% locale
LANG=""
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
And from Wave:
LANG="en_US@rg=czzzzz.UTF-8"
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
So setting export LANG="" in Wave does the trick for now. Why does Wave do this?
thanks for submitting. we try to detect the locale and set it into the environment when launching (this helps with being able to display international characters correctly). but it looks like something went wrong with trying to detect yours and it got an invalid locale response. will look into it
This is really interesting to me. The command we use to determine the system locale on macos is
defaults read -g AppleLocale
On my machine, this spits out en_US, but it seems as though yours is throwing out en_US@rg=czzzzz instead. Looking into it more, the part after the @ is related to your region. I'll need to modify the code to only grab the part before the @ symbol, and then it should work properly