Re: [PATCH] Don't require gawk for a simple print expression

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

 



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@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]