bug-gnulib
[Top][All Lists]
Advanced

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

Re: perror.m4 test


From: Bruno Haible
Subject: Re: perror.m4 test
Date: Sat, 22 Oct 2011 14:27:45 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Eric Blake wrote:
> > 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.

OK. Daniel provided a patch, but I find it stylistically better to use
'if', '&&' or '||' than 'test $?'. I'm committing this:


2011-10-22  Bruno Haible  <address@hidden>

        perror: Recognize when test program crashes.
        * m4/perror.m4 (gl_FUNC_PERROR): If the test program crashes due to
        strerror, set gl_cv_func_perror_works to no.
        Reported by Daniel Richard G. <address@hidden>.

--- m4/perror.m4.orig   Sat Oct 22 14:23:12 2011
+++ m4/perror.m4        Sat Oct 22 14:23:05 2011
@@ -1,4 +1,4 @@
-# perror.m4 serial 5
+# perror.m4 serial 6
 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -36,9 +36,10 @@
                 puts (str);
                 errno = -1;
                 perror ("");
+                return 0;
               ]])],
-           [CONFTEST_OUTPUT=1 ./conftest$EXEEXT >conftest.txt1 2>conftest.txt2
-            if cmp conftest.txt1 conftest.txt2 >/dev/null; then
+           [if CONFTEST_OUTPUT=1 ./conftest$EXEEXT >conftest.txt1 
2>conftest.txt2 \
+               && cmp conftest.txt1 conftest.txt2 >/dev/null; then
               gl_cv_func_perror_works=yes
             else
               gl_cv_func_perror_works=no
-- 
In memoriam Nunilo and Alodia <http://en.wikipedia.org/wiki/Nunilo_and_Alodia>



reply via email to

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