[virt-tools-list] [virt-what] review of allow to use sysctl

Richard W.M. Jones rjones at redhat.com
Tue Aug 28 17:05:09 UTC 2018


On Sat, Aug 25, 2018 at 12:36:54PM +0300, Anatoly Pugachev wrote:
> Hello!
> 
> virt-what$ git desc
> v1.18-6-gd7fd8a7
> 
> Latest commit in git "Allow using sysctl, for example when /proc isn't
> available"
> doesn't look good for me. Can someone please review/revert this commit
> or explain me what does this code do (git show -1):
> 
> +use_sysctl() {
> +    # Lacking /proc, on some systems sysctl can be used instead.
> +    OS=$(uname) || fail "failed to get operating system name"
> +
> +    [ "$OS" == "OpenBSD" ]
> +}
> 
> Running on a linux:
> 
> virt-what# PATH=$PATH:. ./virt-what
> ./virt-what: 45: [: Linux: unexpected operator

I cannot reproduce this warning.  What does uname print on your machine?

$ uname
Linux

Does '[' (ie. test) exist on your path?

$ which [
/usr/bin/[

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the virt-tools-list mailing list