On 04/29/2014 01:42 AM, Jiri Denemark wrote:
>
> I'm currently seeing some test failures on i386 Debian wheezy:
Thanks for doing 32-bit testing.
>
> virstoragetest
> --------------
>
> 97) Chain lookup 27 ... index: expected 0, got 4294967295 FAILED
Yeah, our virStrToLong_* APIs are not doing a very good job here. The
problem is that virStrToLong_ui happily parses -1 as 4294967295 on
systems where sizeof(unsigned long) == sizeof(unsigned int).
We DO have places in our code base where we WANT to parse -1 as
ULONG_MAX (it is a convenience of virsh to be able to have one spelling
that works for both 32- and 64-bit hosts).
I'm not
sure what's the best solution for this. Should we parse the string with
strtoull instead of strtoul to make it a little bit better since
unsigned long long will always be bigger than unsigned int? Anyway, I
hate strtou* for silently parsing negative numbers.
Outright rejecting negative numbers by default in our strto* wrappers
does not feel right; maybe we need to flavors of the unsigned wrappers,
the normal one that accepts negatives, and a new stricter one that
rejects negatives. At any rate, I'll investigate today and propose
something.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org