[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: |
Tue, 13 Sep 2016 10:02:51 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
On 09/13/2016 02:33 AM, Markus Armbruster wrote:
>>> info->qemu = g_new0(VersionTriple, 1);
>>> - err = qemu_strtoll(version, &tmp, 10, &info->qemu->major);
>>> - assert(err == 0);
>>> - tmp++;
>>> -
>>
>> The old code silently ignores any garbage after the third integer (it
>> populates &tmp, but never checks the value of tmp).
>
> It also accepts any separator character between the integers, not just
> '.'.
True, and didn't we have a release of qemu a few years ago (perhaps it
was a downstream Red Hat release; I can't quickly find it now...) where
we accidentally released the version string with a comma instead of a dot?
>>> 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.
>
> Nope:
>
> $ echo "2.7.50garbage" | cut -d. -f3
> 50garbage
That's not a fourth field. I was thinking '2.7.50.0' ignoring '.0'.
>
> The compiler will choke on
>
> info->qemu->micro = QEMU_VERSION_MICRO;
>
> because it's
>
> info->qemu->micro = 50garbage;
>
> after preprocessing.
>
> The commit message could mention that VERSION is now parsed more
> strictly (configure checks '.', the compiler checks integers), but I
> guess it's not worth the bother now.
Indeed, the fact that we now separate on exactly '.' instead of the end
of an integer is different.
>
>> 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>
>
> Does your R-by stand?
Yes - while the parsing may have changed, it doesn't affect the common
case of a correctly-formed VERSION file. I'm okay if you want to tweak
the commit message to call out a summary of this conversation, but since
the patch is already on qapi-next staging, I'm also okay if it doesn't
change.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v6 00/18] qapi: remove the 'middle' mode, Marc-André Lureau, 2016/09/12
- [Qemu-devel] [PATCH v6 02/18] qapi-schema: use generated marshaller for 'qmp_capabilities', Marc-André Lureau, 2016/09/12
- [Qemu-devel] [PATCH v6 03/18] qapi-schema: add 'device_add', Marc-André Lureau, 2016/09/12
- [Qemu-devel] [PATCH v6 04/18] monitor: simplify invalid_qmp_mode(), Marc-André Lureau, 2016/09/12
- [Qemu-devel] [PATCH v6 05/18] monitor: register gen:false commands manually, Marc-André Lureau, 2016/09/12
- [Qemu-devel] [PATCH v6 06/18] qapi: Support unregistering QMP commands, Marc-André Lureau, 2016/09/12
- [Qemu-devel] [PATCH v6 07/18] qmp: Hack to keep commands configuration-specific, Marc-André Lureau, 2016/09/12
- [Qemu-devel] [PATCH v6 08/18] qapi: export the marshallers, Marc-André Lureau, 2016/09/12
- [Qemu-devel] [PATCH v6 10/18] monitor: implement 'qmp_query_commands' without qmp_cmds, Marc-André Lureau, 2016/09/12
- [Qemu-devel] [PATCH v6 09/18] monitor: use qmp_find_command() (using generated qapi code), Marc-André Lureau, 2016/09/12
- [Qemu-devel] [PATCH v6 12/18] qapi: remove the "middle" mode, Marc-André Lureau, 2016/09/12