bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strerror.m4 test fails incorrectly on solaris 8 and earlier [and bon


From: Eric Blake
Subject: Re: strerror.m4 test fails incorrectly on solaris 8 and earlier [and bonus gnutls bug]
Date: Tue, 28 Oct 2008 05:44:45 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Gary V. Vaughan on 10/27/2008 11:49 PM:
> The current test code inside strerror.m4 says:
> 
> AC_LANG_PROGRAM(
>             [[#include <string.h>
>             ]],
>             [[return !*strerror (-2);]])
> 
> Which is fine for Solaris 9 and 10 which return "Unknown Error",
> but causes a SIGSEGV on older Solaris machines

This is intentional.  The gnulib module for strerror is _supposed_ to
replace the Solaris 8 strerror, because of this very bug.  Use of the
strerror module entitles you to write code that can correctly assume that
strerror never returns NULL, even on out-of-range input.

> The easy fix would be to change both instances of 'strerror(-2)'
> to 'strerror(1)' in strerror.m4, but that is still prone to the
> same failure if 1 is not a valid errno.  Maybe forcing an errno
> setting error by opening a non-existent file is more prudent?

No, that would be breaking the module's promise of always returning a
valid string.

> 
> I found this while linking against gnutls, which uses the string
> module, which then uses '#define strerror rpl_strerror' in its lgpl
> library when strerror is not found.  That, in turn, leads to an
> undefined rpl_strerror symbol in libgnutls.so.

That might be a bug - if the gnulib strerror module is not in use, then
the #define strerror rpl_strerror should not be in place.  But since it
looks like gnutls has been subsequently fixed to avoid strerror
altogether, I'm not sure if this still indicates any problems.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkG+y0ACgkQ84KuGfSFAYCK1ACfaSkOzljDOiH3nwamnXKPdl0V
cZkAoMbXi64Q9cvQckwVqmNIi5neJeHW
=ejdr
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]