Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240229172738.0a9a62da@flerken.lan>
Date: Thu, 29 Feb 2024 16:27:38 +0000
From: Marian Buschsieweke <marian.buschsieweke@...teo.net>
To: musl@...ts.openwall.com
Subject: strtod behaving differently in glibc and musl

Hi,

ngspice is parsing tokens from a string input that may either be numeric of
strings using strtod. The man page states explicitly that if the input is not a
valid number (and also no special token such as "inf" or "nan"), that it should
return zero and set endptr to nptr. In this regard both musl and glibc behave
the same.

The difference is that musl will set errno to EINVAL a non-numeric input (which,
from the common sense point of view, makes sense). glibc sets errno to zero,
which is the behavior that ngspice is expecting.

The man page for strtod is surprisingly ambiguous in this regard. To me, it is
unclear which behavior is correct and whether this should be fixed on the musl
side or on the ngspice side.

Any thoughts on this?

Thanks!

Kind regards,
Marian

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.