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

Re: [libvirt] GNU awk vs BSD awk?

On 12/01/2010 09:08 PM, Justin Clift wrote:
> Hi Eric,
> One of the OSX Homebrew guys, CC'd, has asked (casually) whether our dependency on GNU awk is very deeply ingrained, or if we could be convinced to allow usage of other make's instead (ie BSD).

GNU awk, or GNU make?  There's a difference :)

With regards to make, libvirt is firmly in the camp of GNU make and
nothing else.  We use too many extensions specific to gmake that just
aren't present in other implementations, and it is too difficult to
figure out how to rewrite those in the lowest-common-denominator of
POSIX make syntax.  (Side note - the Austin Group, which is in charge of
updating the POSIX standard, is currently reviewing several proposals to
increase the lowest-common-denominator, such as by standardizing
something similar to gmake's $(shell) or BSD makes != assignment, but
that is a lengthy process, and you can't expect it to make a difference

With regards to awk, libvirt should be able to get by with any
POSIX-compliant awk; if you find a counter-example where things are
broken while using BSD awk, it should be relatively easy to patch things
to get it working again.  Note, however, that there are multiple awk
flavors out there; oawk (called awk on some systems) is NOT
posix-compliant, and is inadequate for libvirt's needs; while mawk,
nawk, BSD awk, and gawk should all be interchangeable given a script
that sticks only to POSIX features.  In fact, autoconf requires a decent
awk just for running ./configure, and substitutes $AWK appropriately.  I
see several uses where libvirt is hard-coded to awk (for example,
tools/virt-pki-validate), but most of those are portable even to oawk,
because they avoid POSIX features that were not present in older awk;
but I have not audited all of libvirt's awk usages.

gives a good overview of features to look for when auditing awk scripts
for POSIX vs. oawk compliance, as well as some common bugs in
almost-POSIX-compliant implementations and how to work around those bugs.

Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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