Re: [libvirt] [PATCH] portability fixes to tools/virt-pki-validate.in

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

 



On 04/21/2010 03:00 PM, Dustin Kirkland wrote:
> portability fixes to tools/virt-pki-validate.in
> 
> A few fixes will help make tools/virt-pki-validate.in useful on Debian
> and Ubuntu.  And one fix should be useful to everyone (see #4).
> 
>  1) note our gnutls-bin package (in addition to your gnutls-utils
> package) in the no-certtool error text
> 
>  2) adjust the ORG-setting sed regular expressions to work with both Red
> Hat and Ubuntu style cacert.pem Issuer format

I'm not very qualified to speak on 1 or 2...

> 
>  3) fix a bashism, == should be = in the case where /bin/sh is a symlink
> to dash

But 3 is a definite bug worth fixing.

> 
>  4) $(SYSCONFDIR) cannot evaluate; set a single shell SYSCONFDIR
> variable to the autoconf @SYSCONFDIR@ value, and use $SYSCONFDIR
> everywhere

As is 4.

> @@ -129,8 +130,8 @@ then
>      echo "as root do: chmod 644 $CA/cacert.pem"
>      exit 1
>  fi
> -ORG=`$CERTOOL -i --infile $CA/cacert.pem | grep Issuer | sed 's+Issuer: CN=++'`
> -if [ "$ORG" == "" ]
> +ORG=`$CERTOOL -i --infile $CA/cacert.pem | grep Issuer | sed -e 's+\s*Issuer: .*CN=++' -e 's+,EMAIL=.*++'`

I tend to cringe at 'grep | sed', since pretty much anything you can do
with grep can be subsumed into sed for one less process:

ORG=`$CERTOOL ... | sed '/Issuer/ s+...++'`

Not that it was your bug, but we might as well fix it while we are here.

>  if [ "$SERVER" = "1" ]
>  then
> -    if [ -r $(SYSCONFDIR)/sysconfig/libvirtd ]
> +    if [ -r $SYSCONFDIR/sysconfig/libvirtd ]

To be safe, we need quoting: [ -r "$SYSCONFDIR/sysconfig/libvirtd" ]
(multiple instances).

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]