GNU bug report logs - #10465
MSYS read-only file trouble

Previous Next

Package: automake;

Reported by: Peter Rosin <peda <at> lysator.liu.se>

Date: Mon, 9 Jan 2012 11:00:02 UTC

Severity: normal

Tags: patch

Done: Stefano Lattarini <stefano.lattarini <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eric Blake <eblake <at> redhat.com>
To: Peter Rosin <peda <at> lysator.liu.se>
Cc: 10465 <at> debbugs.gnu.org, Stefano Lattarini <stefano.lattarini <at> gmail.com>
Subject: bug#10465: MSYS read-only file trouble
Date: Mon, 09 Jan 2012 16:34:31 -0700
[Message part 1 (text/plain, inline)]
On 01/09/2012 03:42 PM, Peter Rosin wrote:
> FWIW, this "fixes" it, but I don't actually know why a subshell would
> make a difference?
> 
> $ sh --version
> GNU bash, version 3.1.17(1)-release (i686-pc-msys)

>  
> -{
> +(
>    (
>      # Ignore common signals (in this subshell only!), to avoid potential
>      # problems with Korn shells.  Some Korn shells are known to propagate
> @@ -634,7 +634,7 @@ exit 0
>  '
>  
>  # TODO: document that we consume the file descriptor 3 :-(
> -} 3>"$log_file"
> +) 3>"$log_file"

Ah - the classic bash bug documented in the autoconf manual:

https://www.gnu.org/software/autoconf/manual/autoconf.html#Limitations-of-Builtins

Bash 3.2 (and earlier versions) sometimes does not properly set ‘$?’
when failing to write redirected output of a compound command. This
problem is most commonly observed with ‘{...}’; it does not occur with
‘(...)’. For example:

          $ bash -c '{ echo foo; } >/bad; echo $?'
          bash: line 1: /bad: Permission denied
          0
          $ bash -c 'while :; do echo; done >/bad; echo $?'
          bash: line 1: /bad: Permission denied
          0

To work around the bug, prepend ‘:;’:

          $ bash -c ':;{ echo foo; } >/bad; echo $?'
          bash: line 1: /bad: Permission denied
          1

-- 
Eric Blake   eblake <at> redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 13 years and 191 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.