[libvirt] [PATCH v2] virsh: fix build without readline

Erik Skultety eskultet at redhat.com
Mon Jan 15 09:51:44 UTC 2018


On Sat, Jan 13, 2018 at 06:46:00PM +0400, Roman Bogorodskiy wrote:
> Completion in virsh is enabled when readline is available. In order to
> fix build when it's not available, do the following:
>
>  * Unconditionally add virsh-completer.[ch] and
>    virt-admin-completer.[ch] to the build, and provide stub functions
>    for when readline is not available. This way virsh builds without
>    complaining about missing symbols used for 'completer' in
>    vshCmdOptDef;
>  * In cmdComplete(), mark unused arguments when there's no readline
>    with ATTRIBUTE_UNUSED.
> ---

...

>
>
> +#ifdef WITH_READLINE
>  char **
>  virshDomainNameCompleter(vshControl *ctl,
>                           const vshCmd *cmd ATTRIBUTE_UNUSED,
> @@ -147,3 +148,25 @@ virshDomainInterfaceCompleter(vshControl *ctl,
>      virStringListFree(ret);
>      return NULL;
>  }
> +#else
> +char **
> +virshDomainNameCompleter(vshControl *ctl ATTRIBUTE_UNUSED,
> +                         const vshCmd *cmd ATTRIBUTE_UNUSED,
> +                         unsigned int flags)
> +{
> +    virCheckFlags(-1, NULL);
> +
> +    return NULL;
> +}

Do you actually need to define these "no readline" function versions? I'm
asking because the completer callbacks are transitively invoked from
vshReadlineCompletion (and friends) which is only called from the cmdComplete
which both your and Michal's patch handles. So, are you experiencing any
problems on any platforms without these hunks? (I compiles fine with just the
first and last hunk applied, obviously no readline support)

Anyhow, I went ahead and reviewed Michal's patches, so unless you really need
the hunks I mentioned in the previous paragraph, let's go with Michal's instead.

Erik




More information about the libvir-list mailing list