On 3/12/19 10:15 AM, Laszlo Ersek wrote: > I'm acutely aware of portable vs. non-portable shell scripts. While > working on the code, I specifically checked that "local" was not > specified in SUSv4. The point is, I didn't care, because I didn't target > a POSIX system, but a GNU system. > > We already require GNU Make, to my knowledge. Perhaps not by decree, but > through the feature set that we use.
Indeed, qemu fails to build under BSD make. > I really want to keep "local", as it keeps the shell variable namespace > clean. Regarding the functions that I did put in the "global namespace", > I was careful to prefix them suitably. Yes, using local makes bash functions easier to write. (And I've been trying to argue that POSIX should adopt local, but there is a fundamental difference between ksh local (static scoping) and bash local (dynamic scoping) that neither shell is willing to switch their existing practice to meet at common ground - which is why POSIX hasn't standardized anything yet) > > IMO, it's perfectly fine to require the shell to be bash here, given > that this feature is meant for a subset of maintainers (and not for > end-users), and that building edk2 already requires a quite sizeable set > of packages installed (such as nasm, iasl, ...) So this feature is not > meant for any random POSIX system. > > What I did miss in fact was that "GNU Make" didn't imply "/bin/bash": Yep, I can see how that was not obvious, and I also agree that: > Thus, the real fix here is to be explicit about the bash requirement. I > should add > > SHELL=/bin/bash > > near the top of "Makefile.edk2". this should indeed force the use of bash for all shell snippets and $(shell) invocations in that makefile (and let you get away with 'source' instead of '.', as well as the use of 'local' within the sourced functions). -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature