* [PATCH] xend: update init script to avoid grep on non-existent file system
@ 2010-05-15 4:16 Richie
2010-05-15 7:35 ` Keir Fraser
0 siblings, 1 reply; 5+ messages in thread
From: Richie @ 2010-05-15 4:16 UTC (permalink / raw)
To: Xen Devel
[-- Attachment #1: Type: text/plain, Size: 321 bytes --]
I'm seeing a grep error during bare metal pvops kernel boot. In the
init script, the previous checks will avoid/perform the /proc/xen mount
as appropriate, but then it does a grep on /proc/xen/capabilities
without ensuring that /proc/xen is actually mounted. This is my attempt
(read: first patch :) ) to avoid it.
[-- Attachment #2: xend.patch --]
[-- Type: text/x-patch, Size: 673 bytes --]
# HG changeset patch
# User Richie <listmail@triad.rr.com>
# Date 1273894781 14400
# Node ID 90705b2abd84e75971d12dead966191731ab1361
# Parent baccadfd9418b8dee931945e5752cb118f5bf3cb
xend: update init script to avoid grep on non-existent file system
diff -r baccadfd9418 -r 90705b2abd84 tools/hotplug/Linux/init.d/xend
--- a/tools/hotplug/Linux/init.d/xend Fri May 14 08:05:05 2010 +0100
+++ b/tools/hotplug/Linux/init.d/xend Fri May 14 23:39:41 2010 -0400
@@ -31,7 +31,8 @@
mount -t xenfs xenfs /proc/xen
fi
-if ! grep -q "control_d" /proc/xen/capabilities ; then
+if ! test -d /proc/xen || \
+ ! grep -q "control_d" /proc/xen/capabilities ; then
exit 0
fi
[-- 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] 5+ messages in thread
* Re: [PATCH] xend: update init script to avoid grep on non-existent file system
2010-05-15 4:16 [PATCH] xend: update init script to avoid grep on non-existent file system Richie
@ 2010-05-15 7:35 ` Keir Fraser
2010-05-15 14:56 ` Richie
2010-05-15 16:00 ` Richie
0 siblings, 2 replies; 5+ messages in thread
From: Keir Fraser @ 2010-05-15 7:35 UTC (permalink / raw)
To: Richie, Xen Devel
On 15/05/2010 05:16, "Richie" <listmail@triad.rr.com> wrote:
> I'm seeing a grep error during bare metal pvops kernel boot. In the
> init script, the previous checks will avoid/perform the /proc/xen mount
> as appropriate, but then it does a grep on /proc/xen/capabilities
> without ensuring that /proc/xen is actually mounted. This is my attempt
> (read: first patch :) ) to avoid it.
Richie,
Can you try adding the -s option to grep instead (i.e., grep -qs)? Should be
a simpler way to achieve the same thing. I'll apply that instead if it works
okay for you.
-- Keir
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xend: update init script to avoid grep on non-existent file system
2010-05-15 7:35 ` Keir Fraser
@ 2010-05-15 14:56 ` Richie
2010-05-15 15:11 ` Keir Fraser
2010-05-15 16:00 ` Richie
1 sibling, 1 reply; 5+ messages in thread
From: Richie @ 2010-05-15 14:56 UTC (permalink / raw)
To: Keir Fraser; +Cc: Xen Devel
Sure. I agree much simpler, but is this blurb in the grep manpage a concern?
-s, --no-messages
Suppress error messages about nonexistent or unreadable files.
Portability note: unlike GNU grep, 7th Edition Unix grep did not
conform to POSIX, because it lacked -q and its -s option behaved
like GNU grep’s -q option. USG-style grep also lacked -q but
its -s option behaved like GNU grep. *Portable shell scripts
should avoid both -q and -s and should redirect standard and
error output to /dev/null instead*. (-s is specified by POSIX.)
I'm not sure where all the xend daemon can run? is it always running on
linux, thus implying (modern?) GNU grep? The reason I am bringing this
up is that I recall having grep related issues when running git on
Solaris (without gnu utilities installed) for this very reason. I will
re-sumbit accordingly.
Keir Fraser wrote:
> On 15/05/2010 05:16, "Richie" <listmail@triad.rr.com> wrote:
>
>
>> I'm seeing a grep error during bare metal pvops kernel boot. In the
>> init script, the previous checks will avoid/perform the /proc/xen mount
>> as appropriate, but then it does a grep on /proc/xen/capabilities
>> without ensuring that /proc/xen is actually mounted. This is my attempt
>> (read: first patch :) ) to avoid it.
>>
>
> Richie,
>
> Can you try adding the -s option to grep instead (i.e., grep -qs)? Should be
> a simpler way to achieve the same thing. I'll apply that instead if it works
> okay for you.
>
> -- Keir
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xend: update init script to avoid grep on non-existent file system
2010-05-15 14:56 ` Richie
@ 2010-05-15 15:11 ` Keir Fraser
0 siblings, 0 replies; 5+ messages in thread
From: Keir Fraser @ 2010-05-15 15:11 UTC (permalink / raw)
To: Richie; +Cc: Xen Devel
On 15/05/2010 15:56, "Richie" <listmail@triad.rr.com> wrote:
>
> I'm not sure where all the xend daemon can run? is it always running on
> linux, thus implying (modern?) GNU grep? The reason I am bringing this
> up is that I recall having grep related issues when running git on
> Solaris (without gnu utilities installed) for this very reason. I will
> re-sumbit accordingly.
Well, it's a Linux-specific hotplug script thet you're editing, isn't it.
-- Keir
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xend: update init script to avoid grep on non-existent file system
2010-05-15 7:35 ` Keir Fraser
2010-05-15 14:56 ` Richie
@ 2010-05-15 16:00 ` Richie
1 sibling, 0 replies; 5+ messages in thread
From: Richie @ 2010-05-15 16:00 UTC (permalink / raw)
To: Keir Fraser; +Cc: Xen Devel
[-- Attachment #1: Type: text/plain, Size: 640 bytes --]
Keir Fraser wrote:
> On 15/05/2010 05:16, "Richie" <listmail@triad.rr.com> wrote:
>
>
>> I'm seeing a grep error during bare metal pvops kernel boot. In the
>> init script, the previous checks will avoid/perform the /proc/xen mount
>> as appropriate, but then it does a grep on /proc/xen/capabilities
>> without ensuring that /proc/xen is actually mounted. This is my attempt
>> (read: first patch :) ) to avoid it.
>>
>
> Richie,
>
> Can you try adding the -s option to grep instead (i.e., grep -qs)? Should be
> a simpler way to achieve the same thing. I'll apply that instead if it works
> okay for you.
>
> -- Keir
>
>
>
[-- Attachment #2: xend_v2.patch --]
[-- Type: text/x-patch, Size: 626 bytes --]
# HG changeset patch
# User Richie <listmail@triad.rr.com>
# Date 1273938512 14400
# Node ID cc3ed74cfef3f4504712d1d53c0af8c8940e9ab8
# Parent baccadfd9418b8dee931945e5752cb118f5bf3cb
xend: suppress errors during capabilities check
diff -r baccadfd9418 -r cc3ed74cfef3 tools/hotplug/Linux/init.d/xend
--- a/tools/hotplug/Linux/init.d/xend Fri May 14 08:05:05 2010 +0100
+++ b/tools/hotplug/Linux/init.d/xend Sat May 15 11:48:32 2010 -0400
@@ -31,7 +31,7 @@
mount -t xenfs xenfs /proc/xen
fi
-if ! grep -q "control_d" /proc/xen/capabilities ; then
+if ! grep -qs "control_d" /proc/xen/capabilities ; then
exit 0
fi
[-- 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] 5+ messages in thread
end of thread, other threads:[~2010-05-15 16:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-15 4:16 [PATCH] xend: update init script to avoid grep on non-existent file system Richie
2010-05-15 7:35 ` Keir Fraser
2010-05-15 14:56 ` Richie
2010-05-15 15:11 ` Keir Fraser
2010-05-15 16:00 ` Richie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).