[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] tools/hotplug: Fix hotplug hook script arrangements not to always fail



# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1307109870 -3600
# Node ID 921dcd80f79120bd9938b4ee0fec7428b2da0f6e
# Parent  0791661a32d8eba917c87feacf2c955b85521ad1
tools/hotplug: Fix hotplug hook script arrangements not to always fail

The new feature introduced in 23401:a44b12ee2fd3 was broken; it in
general always fails, at least if there are no hotplug scripts.

If there are no hooks, call_hooks ends up running this:
  [ -x ".....*.hook" ] && . "..... *.hook"

This does not directly trigger set -e and sigerr.  However, it is the
last command exected in call_hooks.  So the return status of
call_hooks is an error, and thus a sigerr happens when call_hooks
returns.

The bug affects xl and xm.  However xl does not detect failure of the
hotplug script.

Change the script to use if...then rather than &&, as the latter has
very confusing and undesirable semantics.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r 0791661a32d8 -r 921dcd80f791 tools/hotplug/Linux/xen-hotplug-common.sh
--- a/tools/hotplug/Linux/xen-hotplug-common.sh Thu Jun 02 18:46:35 2011 +0100
+++ b/tools/hotplug/Linux/xen-hotplug-common.sh Fri Jun 03 15:04:30 2011 +0100
@@ -106,7 +106,7 @@
 #
 call_hooks() {
   for f in /etc/xen/scripts/${1}-${2}.d/*.hook; do
-    [ -x "$f" ] && . "$f"
+    if [ -x "$f" ]; then . "$f"; fi
   done
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.