bug-automake
[Top][All Lists]
Advanced

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

bug#10465: MSYS read-only file trouble


From: Eric Blake
Subject: bug#10465: MSYS read-only file trouble
Date: Mon, 09 Jan 2012 16:34:31 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0

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   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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