[libvirt] [PATCH 2/2] virt-*-validate.in: quote all variable references

Eric Blake eblake at redhat.com
Mon Feb 21 17:33:40 UTC 2011


On 02/20/2011 01:29 PM, Dan Kenigsberg wrote:
> Alas, the shell is not a real programming language.
> 
> Patch generated by manual confirmation of vim's
> s/[^"]\@<=\$\S\+\s\@=/"&"/gc
> and
> s/\(echo \)\@<=[^"].*\$.*$/"&"/c matches.
> 
> This patch generate a lot of noise and carries little benefits, as
> I do not really expect $PKI to contain spaces or backticks. I'm just
> fuming, and would not really mind if this patch is ignored

$PKI containing backticks wouldn't matter; really the issue is $PKI
containing spaces subject to IFS splitting.

>  # Check the directory structure
>  #
>  SYSCONFDIR="@SYSCONFDIR@"

But since was assume SYSCONFDIR might contain spaces (which may very
well be the case on some mingw installation)...

>  PKI="$SYSCONFDIR/pki"

then yes, $PKI may contain spaces...

> -if [ ! -d $PKI ]
> +if [ ! -d "$PKI" ]

and changes like this are important.

> @@ -185,7 +185,7 @@ then
>  
>      fi
>  else
> -    echo Did not found $LIBVIRT/clientcert.pem client certificate
> +    echo Did not found "$LIBVIRT/clientcert.pem" client certificate

Yuck - let's fix this grammar in the process.

Everything else looks good, and I agree with danpb's ack.  I've pushed
this with the following squashed in:

diff --git i/tools/virt-pki-validate.in w/tools/virt-pki-validate.in
index 8a4249d..01825d1 100755
--- i/tools/virt-pki-validate.in
+++ w/tools/virt-pki-validate.in
@@ -185,7 +185,7 @@ then

     fi
 else
-    echo Did not found "$LIBVIRT/clientcert.pem" client certificate
+    echo Did not find "$LIBVIRT/clientcert.pem" client certificate
     echo The machine cannot act as a client
     echo "see
http://libvirt.org/remote.html#Remote_TLS_client_certificates"
     echo on how to regenerate it
@@ -237,7 +237,7 @@ then

     fi
 else
-    echo Did not found $LIBVIRT/servercert.pem server certificate
+    echo Did not find $LIBVIRT/servercert.pem server certificate
     echo The machine cannot act as a server
     echo "see
http://libvirt.org/remote.html#Remote_TLS_server_certificates"
     echo on how to regenerate it


-- 
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/20110221/708a3dc0/attachment-0001.sig>


More information about the libvir-list mailing list