bug-gnulib
[Top][All Lists]
Advanced

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

Re: error: avoid gcc warning


From: Eric Blake
Subject: Re: error: avoid gcc warning
Date: Mon, 20 Jun 2011 11:13:39 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

On 06/18/2011 04:08 PM, Bruno Haible wrote:
> Eric Blake wrote on 2011-06-07:
>>> It's because /usr/include/string.h on this system does not always declare
>>> strerror_r (only if _REENTRANT or _THREAD_SAFE is defined). This fixes it
>>> (without requiring the 'strerror_r' module).
>>
>> This raises an interesting question.  The 'error' module should probably
>> depend on strerror_r, not strerror.
> 
> But given that the 'strerror_r' module requires replacement code on many more
> platforms, including glibc platforms, it feels like overkill. The current
> situation is fine, IMO.

Cygwin 1.7.10 is adding error() and friends.  Once that is done, then
cygwin will no longer be compiling the gnulib error.c, and no longer
worry about this issue.

Bug 1.7.9 has a char* strerror_r, while still needing the gnulib
error.c.  Most other platforms have int strerror_r, so they are immune,
but cygwin 1.7.9 actually results in a compilation error if both error
and strerror_r modules are in use at the same time.  That's because
error's configure tests set STRERROR_R_CHAR_P (matching the
configure-time test), but the use of the strerror_r-posix module has
changed the signature to return int, and now error.c is miscompiling and
trying to treat the int return as the char* value to print.

If nothing else, the code needs to be made robust to witness macros for
which (if any) gnulib strerror_r modules are simultaneously in use.  I'm
a bit short on time today, but hope to get to it sometime this week.

As another issue, glibc 2.14 introduced a fix to upstream error.c to
avoid a coredump possible in error_at_line() in certain conditions (in
fact, this glibc bug was found while black-box testing how error()
behaved in order to implement the cygwin 1.7.10 version of error); maybe
it's worth enhancing the gnulib error module to replace even glibc
error.c when the glibc bug is detected at configure time with older
glibc, although error_at_line is not as frequently used.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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