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-changelog

[Xen-changelog] [xen-unstable] Calling awk and not gawk in the Xen scrip

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Calling awk and not gawk in the Xen scripts
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 19 Apr 2010 18:50:18 -0700
Delivery-date: Mon, 19 Apr 2010 18:51:03 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1271664030 -3600
# Node ID e5376ececd8b614d7006d413137563e241a70e6d
# Parent  551a8406e840ba575995b69ea5da49b8eba1d9a4
Calling awk and not gawk in the Xen scripts

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.

From: Thomas Goirand <thomas@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 tools/hotplug/Linux/network-bridge |    2 +-
 tools/hotplug/Linux/vtpm-common.sh |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff -r 551a8406e840 -r e5376ececd8b tools/hotplug/Linux/network-bridge
--- a/tools/hotplug/Linux/network-bridge        Mon Apr 19 08:59:14 2010 +0100
+++ b/tools/hotplug/Linux/network-bridge        Mon Apr 19 09:00:30 2010 +0100
@@ -80,7 +80,7 @@ find_alt_device () {
     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 -r 551a8406e840 -r e5376ececd8b tools/hotplug/Linux/vtpm-common.sh
--- a/tools/hotplug/Linux/vtpm-common.sh        Mon Apr 19 08:59:14 2010 +0100
+++ b/tools/hotplug/Linux/vtpm-common.sh        Mon Apr 19 09:00:30 2010 +0100
@@ -98,7 +98,7 @@ function vtpmdb_is_free_instancenum () {
                avail=0
        else
                instances=$(cat $VTPMDB |                \
-                          gawk                          \
+                          awk                          \
                           '{                            \
                               if (1 != index($1,"#")) { \
                                 printf("%s ",$2);       \
@@ -120,7 +120,7 @@ function vtpmdb_get_free_instancenum () 
 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 @@ function vtpmdb_validate_entry () {
        inst=$2
 
        res=$(cat $VTPMDB |            \
-            gawk -vvmname=$vmname     \
+            awk -vvmname=$vmname     \
                  -vinst=$inst         \
             '{                        \
                 if ( 1 == index($1,"#")) {\
@@ -209,7 +209,7 @@ function vtpmdb_remove_entry () {
        VTPMDB_TMP="$VTPMDB".tmp
 
        $(cat $VTPMDB |            \
-        gawk -vvmname=$vmname     \
+        awk -vvmname=$vmname     \
         '{                        \
            if ( $1 != vmname ) {  \
              print $0;            \
@@ -350,13 +350,13 @@ function vtpm_isLocalAddress() {
 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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Calling awk and not gawk in the Xen scripts, Xen patchbot-unstable <=