On 04/19/2018 03:47 PM, Richard Henderson wrote: > On 04/19/2018 10:41 AM, Richard Henderson wrote: >> On 04/19/2018 03:58 AM, Alex Bennée wrote: >>> + --cross-cc-*) cc_arch=${opt#--cross-cc-} >>> + eval "cross_cc_${cc_arch}=\$optarg" >> >> This doesn't work as intended. >> >> Given e.g. --cross-cc-aarch64=aarch64-linux-gcc >> >> + cc_arch=aarch64=aarch64-linux-gcc >> + eval 'cross_cc_aarch64=aarch64-linux-gcc=$optarg' >> ++ cross_cc_aarch64=aarch64-linux-gcc=aarch64-linux-gcc >> >> Which sets the variable "cross_cc_aarch64" >> to "aarch64-linux-gcc=aarch64-linux-gcc". >> Which of course won't exist to execute. > > - --cross-cc-*) cc_arch=${opt#--cross-cc-} > + --cross-cc-*) cc_arch=$(expr "$opt" : '--cross-cc-\([^=]*\)')
Forking an expr subshell may not be needed; how about: --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*} to strip both the --cross-cc- prefix, and any suffix starting at the first =. > > seems to do the trick. Obviously a similar change will be needed for > --cross-cc-flags-*. > > > r~ > > -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature