Subject: bug#10465: MSYS read-only file trouble

From: Peter Rosin <[email-masked]>
Date: Tue, 10 Jan 2012 10:07:36 +0100

Stefano Lattarini skrev 2012-01-10 09:48:
> Hi Eric, Peter, and thanks to both for the super-quick diagnosis and fix.
> 
> On 01/10/2012 12:52 AM, Peter Rosin wrote:
>> Eric Blake skrev 2012-01-10 00:34:
*snip*
>>> Ah - the classic bash bug documented in the autoconf manual:
>>>
*snip*
>>
>> That works too, and is cheaper!  Thanks for pointing to that workaround!
>>
>> So, better version:
>>
> The patch is good, but I have a couple of nits below.  Addressing them is
> not a requirement for an ACK, though (even if I'd prefer to have them
> addressed obviously).  Feel free to push when you are ready.

Ok, I have now pushed as below.

Cheers,
Peter

>From 8525b870d5caa0a04858aa436ad6949ec277fc0c Mon Sep 17 00:00:00 2001
From: Peter Rosin <[email-masked]>
Date: Tue, 10 Jan 2012 10:01:29 +0100
Subject: [PATCH] tap/awk: avoid redirection issues with bash 3.2 and earlier

Fixes automake bug#10465.

* lib/tap-driver.sh: Add workaround for bash 3.2 and earlier, which
sometimes does not properly set '$?' when failing to write redirected
output of a compound command.  See the Autoconf manual for more details.

The workaround was pointed out by Eric Blake.
---
 lib/tap-driver.sh |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/lib/tap-driver.sh b/lib/tap-driver.sh
index c011298..725e779 100755
--- a/lib/tap-driver.sh
+++ b/lib/tap-driver.sh
@@ -115,7 +115,10 @@ else
   init_colors=''
 fi
 
-{
+# :; is there to work around a bug in bash 3.2 (and earlier) which
+# does not always set '$?' properly on redirection failure.
+# See the Autoconf manual for more details.
+:;{
   (
     # Ignore common signals (in this subshell only!), to avoid potential
     # problems with Korn shells.  Some Korn shells are known to propagate
-- 
1.7.5.1