xend: update init script to avoid grep on non-existent file system
PATCH 1/1 xend: update init script to avoid grep on non-existent file system
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.
# HG changeset patch
# User Richie <[email protected]>
# Date 1273894781 14400
# Node ID 90705b2abd84e75971d12dead966191731ab1361
# Parent baccadfd9418b8dee931945e5752cb118f5bf3cb
xend: update init script to avoid grep on non-existent file system
tools/hotplug/Linux/init.d/xend +2 -1
@@ -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
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 5 lines · Richie
I'm seeing a grep error during bare metal pvops kernel boot. In the init script, the previous checks will avoid/perform the
/proc/xenmount as appropriate, but then it does a grep on/proc/xen/capabilitieswithout ensuring that/proc/xenis 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
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.
Quoted 20 lines · Keir Fraser
Quoted 6 lines · Richie
I'm seeing a grep error during bare metal pvops kernel boot. In the init script, the previous checks will avoid/perform the
/proc/xenmount as appropriate, but then it does a grep on/proc/xen/capabilitieswithout ensuring that/proc/xenis 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
Quoted 6 lines · Richie
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
Quoted 10 lines · Keir Fraser
Quoted 6 lines · Richie
I'm seeing a grep error during bare metal pvops kernel boot. In the init script, the previous checks will avoid/perform the
/proc/xenmount as appropriate, but then it does a grep on/proc/xen/capabilitieswithout ensuring that/proc/xenis actually mounted. This is my attempt (read: first patch :) ) to avoid it.
Quoted 10 lines
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
# HG changeset patch
# User Richie <[email protected]>
# Date 1273938512 14400
# Node ID cc3ed74cfef3f4504712d1d53c0af8c8940e9ab8 # Parent baccadfd9418b8dee931945e5752cb118f5bf3cb
xend: suppress errors during capabilities check
tools/hotplug/Linux/init.d/xend +1 -1
@@ -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
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel