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/
Home Products Support Community News


[Xen-devel] [PATCH] Fix stubdom-dm using "grep" improperly

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Fix stubdom-dm using "grep" improperly
From: John Weekes <lists.xen@xxxxxxxxxxxxxxxxxx>
Date: Sun, 09 Jan 2011 21:09:52 -0800
Delivery-date: Sun, 09 Jan 2011 21:10:36 -0800
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20101207 Thunderbird/3.1.7
stubdom-dm uses "grep" on "xm list" output to determine whether it is already running. The existing behavior is to use "grep $domname-dm" but this will result in a false-positive in the case of another domU running whose name ends with the full new name; for instance, if "abctest-dm" is running, a new "test-dm" will spin forever, waiting for it the end.

Any easy fix is to have it use "grep -w" instead of "grep", searching for the whole word only.

It also might be worth considering a switch to "xl list" from "xm list", here and in other places.

This bug appears to exist in xen-4.0-testing, as well.

Since it's a one-liner, a signed-off may not be needed, but just in case..

Signed-off-by: John Weekes <lists.xen@xxxxxxxxxxxxxxxxxx>

--- a/xen-unstable.hg/stubdom/stubdom-dm 2010-08-10 23:20:26.187051097 -0500 +++ b/xen-unstable.hg/stubdom/stubdom-dm 2011-01-09 22:43:15.951806650 -0600
@@ -91,7 +91,7 @@
 # stubdomain
 # Wait for any previous stubdom to terminate
-while xm list | grep $domname-dm
+while xm list | grep -w $domname-dm
        sleep 1

Attachment: stubdom-dm.patch
Description: Text Data

Xen-devel mailing list