[libvirt] [PATCH] nwfilter: use /bin/sh rather than requiring bash

Eric Blake eblake at redhat.com
Tue Nov 16 02:54:17 UTC 2010


On 11/15/2010 07:18 PM, Stefan Berger wrote:
>> I've gone ahead and pushed it.
>>
> Unfortunately it doesn't work. The code produces a file like this now
> for some basic probing. The file now has a syntax error.

Aaargh.  I thought I had got my libvirt-tck setup up-to-date, but it was
testing the pre-patch version of libvirt.

> 
> #!/bin/sh
> cmd='/sbin/iptables -n -L FORWARD'
> eval res=\$("${cmd}")

Yep - the ( and ) need quoting.

I don't have time to test right now, but you can feel free to push this
if it fixes the problem for you:

diff --git i/src/nwfilter/nwfilter_ebiptables_driver.c
w/src/nwfilter/nwfilter_ebiptables_driver.c
index c3a0d3e..7b2a505 100644
--- i/src/nwfilter/nwfilter_ebiptables_driver.c
+++ w/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -61,7 +61,7 @@
 #define CMD_DEF_PRE  "cmd='"
 #define CMD_DEF_POST "'"
 #define CMD_DEF(X) CMD_DEF_PRE X CMD_DEF_POST
-#define CMD_EXEC   "eval res=\\$(\"${cmd}\")" CMD_SEPARATOR
+#define CMD_EXEC   "eval res=\\$\\(\"${cmd}\"\\)" CMD_SEPARATOR
 #define CMD_STOPONERR(X) \
     X ? "if [ $? -ne 0 ]; then" \
         "  echo \"Failure to execute command '${cmd}'.\";" \


-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101115/9b04c265/attachment-0001.sig>


More information about the libvir-list mailing list