WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [patch] Calling awk and not gawk in the Xen scripts

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [patch] Calling awk and not gawk in the Xen scripts
From: Thomas Goirand <thomas@xxxxxxxxxx>
Date: Mon, 19 Apr 2010 04:40:27 +0800
Delivery-date: Sun, 18 Apr 2010 13:39:54 -0700
Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=goirand.fr; h=message-id :date:from:mime-version:to:subject:content-type; s=postfix; bh=q yw5qdUOu7Z518CqDax23yMXprI=; b=Ix5a8CajHzMkwnrELY5r0hIfQO31QfrSF ku94W+ARQ6igf/GfEl/UUoFUzLmOn0lm/GVdU0Krmm490N14qotiZ8mQTu0d9Xdm DMkRT8DrV0phIEwqzYTpKD84Nv6ijJQBzfeOGyj5E9K8GEBSAK1FM8ha4rJwCqF2 AYWDtoJW5M=
Domainkey-signature: a=rsa-sha1; c=nofws; d=goirand.fr; h=message-id:date :from:mime-version:to:subject:content-type; q=dns; s=postfix; b= G/UJKpth1xPSJiGNKi0TZRI02j6XbJrgu3VNouwyVSl15zcNGOYkdTyCljMAHlHM y0ALMfJJY3OvzW8FewuX/774JA5UXDliatLa14GA6sZVKYWw7hf1iAzipGGzzvLO H/v5ef/uR534fcFzWztlBnmm3MeSivSAT9lFD3ciQh8=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Openpgp: id=98EF9A49
Organization: GPLHost
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100329)
Hi,

I noticed that 2 scripts in Xen 4.0.0 are calling "gawk". Normally, in
most distributions, gawk is considered a specific version of awk.
Calling "gawk" and not "awk" generally means that you need specificities
of the "g" version of awk, as opposed to "mawk" which is another
implementation of the same tool.

So, unless I misread the scripts, Xen doesn't need to use gawk but just
any implementation of awk, and the attached patch can safely be applied.

If I am wrong (which I don't think I am at the first look) and that
there's a reason why gawk is used and not awk, then IMHO, the toplevel
README should mention it in the prerequisites.

Thomas
diff -u -r xen-4.0.0.orig/tools/hotplug/Linux/network-bridge 
xen-4.0.0/tools/hotplug/Linux/network-bridge
--- xen-4.0.0.orig/tools/hotplug/Linux/network-bridge   2010-04-08 
00:12:04.000000000 +0800
+++ xen-4.0.0/tools/hotplug/Linux/network-bridge        2010-04-19 
04:32:46.000000000 +0800
@@ -80,7 +80,7 @@
     local interf=$1
     local prefix=${interf%[[:digit:]]}
     local ifs=$(ip link show | grep " $prefix" |\
-                gawk '{ printf ("%s",substr($2,1,length($2)-1)) }' |\
+                awk '{ printf ("%s",substr($2,1,length($2)-1)) }' |\
                 sed s/$interf//)
     echo "$ifs"
 }
diff -u -r xen-4.0.0.orig/tools/hotplug/Linux/vtpm-common.sh 
xen-4.0.0/tools/hotplug/Linux/vtpm-common.sh
--- xen-4.0.0.orig/tools/hotplug/Linux/vtpm-common.sh   2010-04-08 
00:12:04.000000000 +0800
+++ xen-4.0.0/tools/hotplug/Linux/vtpm-common.sh        2010-04-19 
04:31:17.000000000 +0800
@@ -98,7 +98,7 @@
                avail=0
        else
                instances=$(cat $VTPMDB |                \
-                          gawk                          \
+                          awk                          \
                           '{                            \
                               if (1 != index($1,"#")) { \
                                 printf("%s ",$2);       \
@@ -120,7 +120,7 @@
 function vtpmdb_get_free_instancenum () {
        local ctr instances don found
        instances=$(cat $VTPMDB |                \
-                  gawk                          \
+                  awk                          \
                   '{                            \
                       if (1 != index($1,"#")) { \
                         printf("%s ",$2);       \
@@ -174,7 +174,7 @@
        inst=$2
 
        res=$(cat $VTPMDB |            \
-            gawk -vvmname=$vmname     \
+            awk -vvmname=$vmname     \
                  -vinst=$inst         \
             '{                        \
                 if ( 1 == index($1,"#")) {\
@@ -209,7 +209,7 @@
        VTPMDB_TMP="$VTPMDB".tmp
 
        $(cat $VTPMDB |            \
-        gawk -vvmname=$vmname     \
+        awk -vvmname=$vmname     \
         '{                        \
            if ( $1 != vmname ) {  \
              print $0;            \
@@ -350,13 +350,13 @@
 function vtpm_isLocalAddress() {
        local addr res
        addr=$(ping $1 -c 1 |  \
-              gawk '{ print substr($3,2,length($3)-2); exit }')
+              awk '{ print substr($3,2,length($3)-2); exit }')
        if [ "$addr" == "" ]; then
                echo "-1"
                return
        fi
        res=$(ifconfig | grep "inet addr" |  \
-            gawk -vaddr=$addr               \
+            awk -vaddr=$addr               \
             '{                              \
                if ( addr == substr($2, 6)) {\
                  print "1";                 \
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>