According to Bruno Haible on 2/20/2010 7:56 PM:
>> test `echo hi | { ./conftest$ac_exeext; echo $?; cat > /dev/null; }` = 1
> 
> I like this too, in this case.

Then I will be committing this:

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

Eric Blake             e...@byu.net
From 03b4536a87a2f5c215319a4369077563acc4a6e6 Mon Sep 17 00:00:00 2001
From: Eric Blake <ebl...@redhat.com>
Date: Mon, 22 Feb 2010 15:15:56 -0700
Subject: [PATCH] lseek: avoid bash 3.2 broken pipe bug

Avoid a spurious message caused by SIGPIPE handling, as well as
avoiding bash 3.2 messages even when SIGPIPE is not handled.

* m4/lseek.m4 (gl_FUNC_LSEEK): Drain pipe, to avoid spurious
warning from bash 3.2.
Reported by Ben Pfaff, with analysis from Bruno Haible.

Signed-off-by: Eric Blake <ebl...@redhat.com>
---
 ChangeLog   |    5 +++++
 m4/lseek.m4 |    5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ddb7216..892c85e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-02-22  Eric Blake  <ebl...@redhat.com>

+       lseek: avoid bash 3.2 broken pipe bug
+       * m4/lseek.m4 (gl_FUNC_LSEEK): Drain pipe, to avoid spurious
+       warning from bash 3.2.
+       Reported by Ben Pfaff, with analysis from Bruno Haible.
+
        bootstrap: support non-FSF copyright holder
        * build-aux/bootstrap (COPYRIGHT_HOLDER, with_gettext): Allow
        bootstrap.conf override of COPYRIGHT_HOLDER.
diff --git a/m4/lseek.m4 b/m4/lseek.m4
index f308495..9bf4dc2 100644
--- a/m4/lseek.m4
+++ b/m4/lseek.m4
@@ -1,4 +1,4 @@
-# lseek.m4 serial 4
+# lseek.m4 serial 5
 dnl Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -21,7 +21,8 @@ int main ()
 }],
          [if test -s conftest$ac_exeext \
              && ./conftest$ac_exeext < conftest.$ac_ext \
-             && { echo hi | ./conftest$ac_exeext; test $? = 1; }; then
+             && test 1 = "`echo hi \
+               | { ./conftest$ac_exeext; echo $?; cat >/dev/null; }`"; then
             gl_cv_func_lseek_pipe=yes
           else
             gl_cv_func_lseek_pipe=no
-- 
1.6.6.1

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to