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 ebl...@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature