* [PATCH] Fix stubdom-dm using "grep" improperly
@ 2011-01-10 5:09 John Weekes
2011-01-10 7:34 ` John Weekes
0 siblings, 1 reply; 6+ messages in thread
From: John Weekes @ 2011-01-10 5:09 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
[-- Attachment #1: Type: text/plain, Size: 1115 bytes --]
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@nuclearfallout.net>
--- 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
do
sleep 1
done
[-- Attachment #2: stubdom-dm.patch --]
[-- Type: text/x-patch, Size: 337 bytes --]
--- 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
do
sleep 1
done
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Fix stubdom-dm using "grep" improperly
2011-01-10 5:09 [PATCH] Fix stubdom-dm using "grep" improperly John Weekes
@ 2011-01-10 7:34 ` John Weekes
2011-01-11 16:42 ` [PATCH] Fix stubdom-dm using "grep" improperly [and 1 more messages] Ian Jackson
0 siblings, 1 reply; 6+ messages in thread
From: John Weekes @ 2011-01-10 7:34 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]
On 1/9/2011 9:09 PM, John Weekes wrote:
> 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@nuclearfallout.net>
Here's a corrected version done against the repo (i.e., with corrected
paths).
diff -r 7b4c82f07281 stubdom/stubdom-dm
--- a/stubdom/stubdom-dm Wed Jan 05 23:54:15 2011 +0000
+++ b/stubdom/stubdom-dm Mon Jan 10 02:28:48 2011 -0500
@@ -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
do
sleep 1
done
-John
[-- Attachment #2: stubdom-dm.patch --]
[-- Type: text/x-patch, Size: 335 bytes --]
diff -r 7b4c82f07281 stubdom/stubdom-dm
--- a/stubdom/stubdom-dm Wed Jan 05 23:54:15 2011 +0000
+++ b/stubdom/stubdom-dm Mon Jan 10 02:31:19 2011 -0500
@@ -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
do
sleep 1
done
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Fix stubdom-dm using "grep" improperly [and 1 more messages]
2011-01-10 7:34 ` John Weekes
@ 2011-01-11 16:42 ` Ian Jackson
2011-01-11 16:59 ` Stefano Stabellini
0 siblings, 1 reply; 6+ messages in thread
From: Ian Jackson @ 2011-01-11 16:42 UTC (permalink / raw)
To: John Weekes, Keir Fraser, Stefano Stabellini
Cc: xen-devel@lists.xensource.com
John Weekes writes ("[Xen-devel] [PATCH] Fix stubdom-dm using "grep" improperly"):
> 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.
Urgh. Thanks for this patch. This code is pretty horrid stuff, I
have to say. I have applied your fix to xen-unstable.
Keir, can you please also commit this to 4.0-testing ? It applies
cleanly.
Stefano: does xl in stubdom mode still use stubdom-dm ? If so can it
please not ? Certainly "xm list" isn't going to work!
Ian.
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Fix stubdom-dm using "grep" improperly [and 1 more messages]
2011-01-11 16:42 ` [PATCH] Fix stubdom-dm using "grep" improperly [and 1 more messages] Ian Jackson
@ 2011-01-11 16:59 ` Stefano Stabellini
2011-01-11 17:00 ` Ian Jackson
2011-01-11 18:15 ` John Weekes
0 siblings, 2 replies; 6+ messages in thread
From: Stefano Stabellini @ 2011-01-11 16:59 UTC (permalink / raw)
To: Ian Jackson
Cc: Keir Fraser, xen-devel@lists.xensource.com, John Weekes,
Stefano Stabellini
On Tue, 11 Jan 2011, Ian Jackson wrote:
> John Weekes writes ("[Xen-devel] [PATCH] Fix stubdom-dm using "grep" improperly"):
> > 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.
>
> Urgh. Thanks for this patch. This code is pretty horrid stuff, I
> have to say. I have applied your fix to xen-unstable.
>
> Keir, can you please also commit this to 4.0-testing ? It applies
> cleanly.
>
> Stefano: does xl in stubdom mode still use stubdom-dm ? If so can it
> please not ? Certainly "xm list" isn't going to work!
It doesn't.
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Fix stubdom-dm using "grep" improperly [and 1 more messages]
2011-01-11 16:59 ` Stefano Stabellini
@ 2011-01-11 17:00 ` Ian Jackson
2011-01-11 18:15 ` John Weekes
1 sibling, 0 replies; 6+ messages in thread
From: Ian Jackson @ 2011-01-11 17:00 UTC (permalink / raw)
To: Stefano Stabellini
Cc: Keir Fraser, xen-devel@lists.xensource.com, John Weekes
Stefano Stabellini writes ("Re: [Xen-devel] [PATCH] Fix stubdom-dm using "grep" improperly [and 1 more messages]"):
> On Tue, 11 Jan 2011, Ian Jackson wrote:
> > Stefano: does xl in stubdom mode still use stubdom-dm ? If so can it
> > please not ? Certainly "xm list" isn't going to work!
>
> It doesn't.
Yay.
Ian.
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Fix stubdom-dm using "grep" improperly [and 1 more messages]
2011-01-11 16:59 ` Stefano Stabellini
2011-01-11 17:00 ` Ian Jackson
@ 2011-01-11 18:15 ` John Weekes
1 sibling, 0 replies; 6+ messages in thread
From: John Weekes @ 2011-01-11 18:15 UTC (permalink / raw)
To: Stefano Stabellini, xen-devel@lists.xensource.com
>> Stefano: does xl in stubdom mode still use stubdom-dm ? If so can it
>> please not ? Certainly "xm list" isn't going to work!
> It doesn't.
Actually, if anyone's curious, I can't get my stubdom-based domUs to
actually start with "xl", which is part of why still use "xm". I haven't
had time to investigate further yet. Maybe it's because I'm testing with
"xm"-based domains already running, or maybe there's a configuration
file incompatibility.
-John
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-01-11 18:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-10 5:09 [PATCH] Fix stubdom-dm using "grep" improperly John Weekes
2011-01-10 7:34 ` John Weekes
2011-01-11 16:42 ` [PATCH] Fix stubdom-dm using "grep" improperly [and 1 more messages] Ian Jackson
2011-01-11 16:59 ` Stefano Stabellini
2011-01-11 17:00 ` Ian Jackson
2011-01-11 18:15 ` John Weekes
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.