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] network-bridge shell quoting

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] network-bridge shell quoting
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Thu, 10 Jan 2008 15:19:04 +0000
Delivery-date: Thu, 10 Jan 2008 07:22:24 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
In tools/examples/network-bridge, the attached patch should be
applied.

In the old code, if addr_pfx (for example) is unset or empty, the if
test involves executing
  [ ]
which produces an error message before exiting nonzero ie false.
The attached changes suppresses this spurious error message by
properly quoting addr_pfx, and adding `-n' to make the argument
unparsing for [ more robust.

This was inspired by, but not derived from (insofar as one 2-line fix
to the same bug can be derived from another), an identically named
patch in the CentOS 5.1 SRPM.

Ian.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

diff -r 8922a1469284 tools/examples/network-bridge
--- a/tools/examples/network-bridge     Wed Jan 09 22:21:58 2008 +0000
+++ b/tools/examples/network-bridge     Thu Jan 10 15:13:15 2008 +0000
@@ -96,12 +96,12 @@ get_ip_info() {
     
 do_ifup() {
     if ! ifup $1 ; then
-        if [ ${addr_pfx} ] ; then
+        if [ -n "$addr_pfx" ] ; then
             # use the info from get_ip_info()
             ip addr flush $1
             ip addr add ${addr_pfx} dev $1
             ip link set dev $1 up
-            [ ${gateway} ] && ip route add default via ${gateway}
+            [ -n "$gateway" ] && ip route add default via ${gateway}
         fi
     fi
 }
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] network-bridge shell quoting, Ian Jackson <=