[libvirt] [PATCH] Don't require gawk for a simple print expression
Eric Blake
eblake at redhat.com
Tue Aug 28 15:20:05 UTC 2012
On 08/28/2012 01:57 AM, Guido Günther wrote:
> Fedora uses gawk as awk so there's no change and in behavior while
> Debian/Ubuntu use mawk by default.
>
> This was reported by Luca Capello in
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=636712
> ---
> src/nwfilter/nwfilter_ebiptables_driver.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
ACK. I confirmed that our only use of awk was for the simple script
'{print $1}', so this patch is a good quick fix.
But down the road, I would welcome a patch to simplify
iptablesLinkIPTablesBaseChain() to avoid gawk altogether. Right now, we
are using gawk to split out the first field of $($IPT -L $chain -n
--line-number | grep " $chain "); but the shell is already sufficient to
split out a whitespace separated field. That is, instead of:
r=$(echo $res | $awk '{print $1}')
if [ "${r}" != "$pos" ]; then
we could use:
set dummy $res
r=$2
if [ "$r" != "$pos" ]; then
provided that we audit that the rest of our generated shell script
output doesn't care that we overwrote positional arguments with set.
--
Eric Blake eblake at redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120828/a2a8db31/attachment-0001.sig>
More information about the libvir-list
mailing list