qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v6 01/18] build-sys: define QEMU_VERSION_{MAJOR,


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v6 01/18] build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO}
Date: Mon, 12 Sep 2016 15:05:15 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 09/12/2016 04:18 AM, Marc-André Lureau wrote:
> There are better chances to find what went wrong at build time than a
> later assert in qmp_query_version
> 
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
>  qmp.c                 | 16 +++-------------
>  scripts/create_config |  6 ++++++
>  2 files changed, 9 insertions(+), 13 deletions(-)
> 

> -
> -    err = qemu_strtoll(tmp, &tmp, 10, &info->qemu->micro);
> -    assert(err == 0);
> +    info->qemu->major = QEMU_VERSION_MAJOR;
> +    info->qemu->minor = QEMU_VERSION_MINOR;
> +    info->qemu->micro = QEMU_VERSION_MICRO;
>      info->package = g_strdup(QEMU_PKGVERSION);
>  
>      return info;

The old code silently ignores any garbage after the third integer (it
populates &tmp, but never checks the value of tmp).

> diff --git a/scripts/create_config b/scripts/create_config
> index 1dd6a35..e6929dd 100755
> --- a/scripts/create_config
> +++ b/scripts/create_config
> @@ -7,7 +7,13 @@ while read line; do
>  case $line in
>   VERSION=*) # configuration
>      version=${line#*=}
> +    major=$(echo "$version" | cut -d. -f1)
> +    minor=$(echo "$version" | cut -d. -f2)
> +    micro=$(echo "$version" | cut -d. -f3)
>      echo "#define QEMU_VERSION \"$version\""
> +    echo "#define QEMU_VERSION_MAJOR $major"
> +    echo "#define QEMU_VERSION_MINOR $minor"
> +    echo "#define QEMU_VERSION_MICRO $micro"

The new code likewise ignores any fourth field.

Do we care either way?  Unless someone else has a reason for why we
should care, I'm fine with:
Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]