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

Re: [Xen-devel] [Qemu-devel] [PATCH 16/16] configure: do_compiler: Dump some extra info under bash



On 04/23/2018 11:38 AM, Ian Jackson wrote:

> You are right.  Perhaps my testing was inadequate.  I wrote this a
> long while ago, and if there was a syntax along these lines that DTRT
> in both bash and dash in my tests it is long gone.  Starting de novo,
> the following code works for me:
> 
>     (echo >>config.log "
>  funcs: ${FUNCNAME[*]}
>  lines: ${BASH_LINENO[*]}
>  files: ${BASH_SOURCE[*]}") 2>/dev/null ||:

That's still fork-heavy.  You could do:

test -n "$BASH_VERSION" && eval '
echo >>config.log "
funcs: ${FUNCNAME[*]}
lines: ${BASH_LINENO[*]}
files: ${BASH_SOURCE[*]}"'

which avoids the fork, but remains silent on dash.

> 
> With bash I get the expected information in config.log, which looks
> like this:
> 
>  funcs: do_compiler do_cc compile_prog cc_has_warning_flag main
>  lines: 91 124 1720 1724 0
>  files: ./configure ./configure ./configure ./configure ./configure

Is files: really useful information?  The other two are (as it gives a
full stack trace), but if we aren't actively sourcing lots of other
files, seeing a bunch of ./configure doesn't add much.

> 
> With dash the script runs but there is nothing from this segment in
> the log.  Without the 2>/dev/null, it prints
>   ./configure: 63: ./configure: Bad substitution
> so the syntax error is indeed being suprresed and ignored.
> 
> The ( ) is necessary because syntax errors are not like set -e errors:
> they cause the shell process to exit.

See above - a well-quoted eval is sufficient to avoid a subshell.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.