[xen-tools] hook scripts issue, and patch

Eric Lemoine eric.lemoine at gmail.com
Thu Oct 19 17:20:22 CEST 2006


Hello,

I've recently run into problems because of the way the hook scripts
define functions and evaluates expressions.

By default on Ubuntu Edgy, dash is installed, and /bin/sh is a symlink
to dash. The xen-tools hook scripts use the keyword "function" for
function definitions, and [[ ]] for expression evaluation. These are
*not* supported by dash. This makes the hook scripts fail with errors
like this:

Running hook 99-clean-image
['/usr/lib/xen-tools/dapper.d/99-clean-image /tmp/NWz3ScGIho']
--
/usr/lib/xen-tools/common.sh: 19: function: not found
/tmp/NWz3ScGIho
/usr/lib/xen-tools/common.sh: 51: function: not found
/usr/lib/xen-tools/common.sh: 77: logMessage: not found
assert failed: /usr/lib/xen-tools/dapper.d/99-clean-image: []

The attached patch fixes the problem by not using the "function"
keyword for function definition and by using [ expression ] instead of
[[ expression ]] for expression evaluation in the hook shell scripts.
In this way the hook shell scripts work whether /bin/sh is a symlink
to /bin/bash or to /bin/dash.

Patch applies to current CVS.

Thanks,
-- 
Eric
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: application/octet-stream
Size: 6428 bytes
Desc: not available
URL: <http://sym.noone.org/pipermail/xen-tools-discuss/attachments/20061019/514d5fe1/attachment.obj>


More information about the xen-tools-discuss mailing list