bug-gnulib
[Top][All Lists]
Advanced

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

Re: perror.m4 test


From: Eric Blake
Subject: Re: perror.m4 test
Date: Sat, 15 Oct 2011 07:16:17 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110928 Fedora/3.1.15-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.4 Thunderbird/3.1.15

On 10/15/2011 03:49 AM, Bruno Haible wrote:
Hi Eric,

Daniel Richard G. wrote:
* "checking whether perror matches strerror": strerror(-1) returns
   an invalid pointer, and attempting to puts() this yields SIGBUS.
   (Wouldn't it be safer to pass EPERM or something similarly
   universal?)

This is the purpose of the test: testing whether you can safely pass
invalid error number, such as -1, to strerror.

I thought it was to test that perror() and strerror() gave the
same output.

Note that currently, the test passes despite the SIGBUS. It should
probably check that $? = 0 before comparing stdout vs. stderr.

I'm not sure. This test is about perror(). Should it fail just because
strerror returns an invalid pointer? Eric, what do you think?

perror() is required to give output containing the same string as strerror, and strerror() is required to give a valid string (possible "") on all values, including -1. Since -1 gives SIGBUS, then both strerror and perror need to be replaced on this platform, and the test needs to be fixed to recognize that a test that dies from a signal indicates failure.

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



reply via email to

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