From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=DKIM_ADSP_ALL, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30491 invoked from network); 13 Apr 2022 17:37:11 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 13 Apr 2022 17:37:11 -0000 Received: (qmail 13647 invoked by uid 550); 13 Apr 2022 17:37:07 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 13607 invoked from network); 13 Apr 2022 17:37:06 -0000 Date: Wed, 13 Apr 2022 10:36:51 -0700 From: "Gary E. Miller" To: musl@lists.openwall.com Message-ID: <20220413103651.0087ca81@spidey.rellim.com> In-Reply-To: <20220413140532.GT7074@brightrain.aerifal.cx> References: <20220412134355.59bd920e@spidey.rellim.com> <20220413142432.311e20f5@ncopa-desktop.lan> <20220413140532.GT7074@brightrain.aerifal.cx> Organization: Rellim X-Mailer: Claws Mail 4.1.0 (GTK 3.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/1320LY=8r1XhBvSmb12ndSn"; protocol="application/pgp-signature"; micalg=pgp-sha512 Subject: Re: [musl] *strerror_r() bug in musl --Sig_/1320LY=8r1XhBvSmb12ndSn Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Yo Rich! On Wed, 13 Apr 2022 10:05:33 -0400 Rich Felker wrote: > > > When _GNU_SOURCE is defined with glibc, then strerror_r() returns > > > a char *. =20 > >=20 > > I have met this in multiple places the last decade. The usual way to > > fix it is to also check for GNU libc in addition to _GNU_SOURCE. > >=20 > > #if defined (__GLIBC__) && defined (_GNU_SOURCE) > > /* non-standard GLIBC exception */ > > #else > > /* standard behavior for everything else */ > > #endif =20 >=20 > That, or probe for the signature with a configure-style check and use > the result of that, as in >=20 > #ifdef HAVE_GNU_STRERROR_R > // handle the GNU version > #else > // code written to the standard > #endif gpsd runs on a huge variety of hardware and software. We used to have rats nests of #ifdef's as suggested above. But that only works when your library code actually follows your documentation, and our dev actually read and understood your documentation. Since you doc fails to mention this "quirk", it is not possible to forsee this issue before debugging the rare crash. Now consider that gpsd supports well over 100 targets, back to POSIX 2001. glibc has a long history of changes around strerror_r(), and gpsd has to support each one. Then there are all the other libc. That is a lot of doc to check. And a lot of #ifdeff version chacks. OBTW: did I mention musl does not appear to have any #defines to specify its current version? Or even that it is musl? Or did I miss something else in the doc? So you expect me to use the glibc #defines, because musl lacks them. Not practical at scale. gpsd prefers to check at configure time for all the known library calls that are "quirky". So, what I did was add, yet another, configure time tesst RGDS GARY --------------------------------------------------------------------------- Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703 gem@rellim.com Tel:+1 541 382 8588 Veritas liberabit vos. -- Quid est veritas? "If you can't measure it, you can't improve it." - Lord Kelvin --Sig_/1320LY=8r1XhBvSmb12ndSn Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIzBAEBCgAdFiEEDImNR/2vUKZZKLG0LmvF3i7oaj4FAmJXCjUACgkQLmvF3i7o aj7Ysw//VrFU47MB9RuXoVsGKOA8/uGvArONy+H2YEvcpe04wpT+6T4O/q5wozhr tBfH34GyiQk1eLHn0Zkn4v8aNLZrsqSVAIvlZokvLu2hcYiUAIkKvR95anNF6DnA eQesvxCsThy05JouxGsZ/9TkKMErEPXB3LlmNglTcrQaWT9lk7utrOGc0Oc24C/+ dis5dAiFYk/C+5fMTDcTN0dQ7xBZJW4zLQ4vPr+8U+SXnK52uGtLkBTvRxMPP85s 9xWetyakxsHDpDCFPX1TgBkQ/sAlasA6jp9Z+2UqZXSRdzrXPzLyMqudmCv4ayyk f50M/kOQAZgHPGfMuVoCpHQ2nE0vUoGf2Hj57ObBtaJ5pWObr8r+HHVKVCZrQP57 OFM25zZIWYIbdiNuGEN+IvlNvsenHMJVUZ+Qvvt+oT+hAsoifvyuO1fqLzZ3CqpS ySM1KTpMAAlcIZv1B1B5HVhwsQF0k5CqCEJ1HGcyldoJdFaj7gZ0CUmzjOhh0QSE 6PwaTq/fFlpVcws8uM4rmJlo14t1nbqt6C7Iaxz/HlrZJ3fUn6xZwTA5KeBD6Pq5 GCQa1Kws7vL0vj53mmWskStsWdt6MmyWtbraiscfs1NhSkLj0z+Dj8TVCm3ZL8Fk kSXk234mb5WcJXRS97jTmeMx3MujXpSo23LZ07dLzwOpDNzZZqE= =6B0F -----END PGP SIGNATURE----- --Sig_/1320LY=8r1XhBvSmb12ndSn--