mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 18:03:37 +08:00
Read glibc's version in a locale-independent way
We want to enable posix_spawn only for glibc >= 2.24, so we check
gnu_get_libc_version() at runtime. This returns a string with the
version number.
Because it's a version number it's spelt with a "." and never a ",",
but we interpret it as a float. This is iffy to begin with, but simple
enough. Only when the locale uses a ",", things break - it'll read it
as "2" and fail the check, which absolutely *tanks* performance on WSL1.
I'm unsure if this gives the proper runtime glibc version - it might,
whereas __GLIBC_MINOR__ and such definitely would not.
So fix the immediate problem by at least using a c locale - this is
already masked by 8dc3982408
, but better
safe than sorry.
This commit is contained in:
parent
7850a10c45
commit
c54b8dca33
|
@ -280,7 +280,7 @@ static bool allow_use_posix_spawn() {
|
|||
// uClibc defines __GLIBC__.
|
||||
#if defined(__GLIBC__) && !defined(__UCLIBC__)
|
||||
const char *version = gnu_get_libc_version();
|
||||
result = version && strtod(version, nullptr) >= 2.24;
|
||||
result = version && strtod_l(version, nullptr, fish_c_locale()) >= 2.24;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user