Closed Dariqq closed 3 weeks ago
Is the parsing of floats/doubles dependant on locales (whether , or . as seperator)?
It seems to be. If i run with LC_ALL=C
the ourput of /proc/loadavg
gets parsed correctly but with my default locale it is not
That was awful
this is after dropping the sysinfo call.
LC_ALL=C ./fastfetch -S loadavg --format json
[
{
"type": "Loadavg",
"result": [
0.41,
0.48,
0.54
]
}
]
./fastfetch -S loadavg --format json
[
{
"type": "Loadavg",
"result": [
0.0,
null,
null
]
}
]
This means that every scanf(%f) is buggy
Would it be safe to set LC_NUMERIC=C somewhere in the beginning?
mmh seems to parse string correctly when not using fastfetch
@CarterLi
Removing https://github.com/fastfetch-cli/fastfetch/blob/dev/src/common/init.c#L57 seems to work.
Hi,
Looking through the loadavg code and in
loadavg_linux.c
fastfetch seems to read/proc/uptime
instead of/proc/loadavg
.Also even if changing to
/proc/loadavg
(and removing the sysinfo code) the format stringsscanf
statement seems wrong: