qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Cc: armbru@redhat.com
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	[thread overview]
Message-ID: <bf1ec459-af7b-fb2b-8f8e-1e49a6a511fd@redhat.com> (raw)
In-Reply-To: <20160912091913.15831-2-marcandre.lureau@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1746 bytes --]

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 <marcandre.lureau@redhat.com>
> ---
>  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 <eblake@redhat.com>

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-09-12 20:05 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12  9:18 [Qemu-devel] [PATCH v6 00/18] qapi: remove the 'middle' mode Marc-André Lureau
2016-09-12  9:18 ` [Qemu-devel] [PATCH v6 01/18] build-sys: define QEMU_VERSION_{MAJOR, MINOR, MICRO} Marc-André Lureau
2016-09-12 20:05   ` Eric Blake [this message]
2016-09-13  7:33     ` Markus Armbruster
2016-09-13 15:02       ` Eric Blake
2016-09-12  9:18 ` [Qemu-devel] [PATCH v6 02/18] qapi-schema: use generated marshaller for 'qmp_capabilities' Marc-André Lureau
2016-09-12  9:18 ` [Qemu-devel] [PATCH v6 03/18] qapi-schema: add 'device_add' Marc-André Lureau
2016-09-12  9:18 ` [Qemu-devel] [PATCH v6 04/18] monitor: simplify invalid_qmp_mode() Marc-André Lureau
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 05/18] monitor: register gen:false commands manually Marc-André Lureau
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 06/18] qapi: Support unregistering QMP commands Marc-André Lureau
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 07/18] qmp: Hack to keep commands configuration-specific Marc-André Lureau
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 08/18] qapi: export the marshallers Marc-André Lureau
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 09/18] monitor: use qmp_find_command() (using generated qapi code) Marc-André Lureau
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 10/18] monitor: implement 'qmp_query_commands' without qmp_cmds Marc-André Lureau
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 11/18] monitor: remove mhandler.cmd_new Marc-André Lureau
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 12/18] qapi: remove the "middle" mode Marc-André Lureau
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 13/18] qapi: check invalid arguments on no-args commands Marc-André Lureau
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 14/18] tests: add a test to check invalid args Marc-André Lureau
2016-09-12 11:23   ` Markus Armbruster
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 15/18] monitor: use qmp_dispatch() Marc-André Lureau
2016-09-20 14:48   ` Alberto Garcia
2016-09-20 21:58     ` Marc-André Lureau
2016-09-20 22:00       ` Marc-André Lureau
2016-09-21  6:15         ` Markus Armbruster
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 16/18] build-sys: remove qmp-commands-old.h Marc-André Lureau
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 17/18] qmp-commands.hx: fix some styling Marc-André Lureau
2016-09-12  9:19 ` [Qemu-devel] [PATCH v6 18/18] Replace qmp-commands.hx by docs/qmp-commands.txt Marc-André Lureau
2016-09-12 21:22   ` Eric Blake
2016-09-13  7:37     ` Markus Armbruster
2016-09-12 21:52   ` Peter Maydell
2016-09-12 22:37     ` Marc-André Lureau
2016-09-13  7:41       ` Markus Armbruster
2016-09-12 11:46 ` [Qemu-devel] [PATCH v6 00/18] qapi: remove the 'middle' mode Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf1ec459-af7b-fb2b-8f8e-1e49a6a511fd@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).