On 3/15/19 5:45 AM, Michal wrote: > Hi, > I terrible sorry if I'm wasting you time, but probably I found a bug. In > example like this: > find /home/certget/ssl/example.pem -mtime -0,1 > This will work on server with locales changed to "pl_PL.UTF-8" and on > servers with "en_US.UTF-8" I need to use "-mtime -0.1". It's very > irritating when I need to check if this same script works on every server.
Not a bug, but by design - the behavior of strtod() is locale-dependent.
In locales where ',' is treated as a decimal point (such as
pl_PL.UTF-8), strtod("0,1") returns 0.1 (the value 1/10); in locales
where '.' is decimal point (such as en_US.UTF-8), it returns 0 with ",1"
as trailing garbage.
> Is it possible to unify this and use for example always ".".
strtod() always parses "." as a decimal separator regardless of what
other characters it might ALSO parse depending on locale. Beyond that,
it is your responsibility to be aware of what locale your script is using.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
