From: Ian Jackson Subject: [PATCH] network-bridge shell quoting Date: Thu, 10 Jan 2008 15:19:04 +0000 Message-ID: <18310.14184.419042.537735@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="tz7eAaBpln" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --tz7eAaBpln Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit 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 --tz7eAaBpln Content-Type: text/plain Content-Description: fix shell quoting in network-bridge Content-Disposition: inline; filename="xen-network-addr-test.patch" Content-Transfer-Encoding: 7bit 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 } --tz7eAaBpln Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --tz7eAaBpln--