Re: [libvirt] [RFC PATCH] build: avoid %zu in translated strings

2010-08-28 Thread Bruno Haible
Hi Eric, after looking into this deeper, it (happily) appears that I may have been mistaken. It looks like the gnulib vasprintf module _already_ performs printf parsing on mingw; and that as a virtue of that printf parsing, %zu and %llu are already rewritten into modifiers understood by

Re: [libvirt] [RFC PATCH] build: avoid %zu in translated strings

2010-08-18 Thread Daniel P. Berrange
On Tue, Aug 17, 2010 at 04:05:03PM -0600, Eric Blake wrote: Mingw64 lacks %zu, and has the unfortunate setup where sizeof(long)==4 but sizeof(size_t)==8. Since gnulib's printf-posix module is not LGPLv2+, the best we can do is manually cast to the only portable int type known to hold size_t,

Re: [libvirt] [RFC PATCH] build: avoid %zu in translated strings

2010-08-18 Thread Eric Blake
On 08/18/2010 03:04 AM, Daniel P. Berrange wrote: I find the PRI* stuff rather fugly. Can't we just use %llu and cast to (unsigned long long) Unfortunately, %llu is equally non-portable to mingw. And yes, we also have some %llu encoded into translated strings, which would also need help.

Re: [libvirt] [RFC PATCH] build: avoid %zu in translated strings

2010-08-18 Thread Daniel P. Berrange
On Wed, Aug 18, 2010 at 07:41:16AM -0600, Eric Blake wrote: On 08/18/2010 03:04 AM, Daniel P. Berrange wrote: I find the PRI* stuff rather fugly. Can't we just use %llu and cast to (unsigned long long) Unfortunately, %llu is equally non-portable to mingw. And yes, we also have some

Re: [libvirt] [RFC PATCH] build: avoid %zu in translated strings

2010-08-18 Thread Eric Blake
[re-adding bug-gnulib for another question] On 08/18/2010 07:51 AM, Daniel P. Berrange wrote: On Wed, Aug 18, 2010 at 07:41:16AM -0600, Eric Blake wrote: On 08/18/2010 03:04 AM, Daniel P. Berrange wrote: I find the PRI* stuff rather fugly. Can't we just use %llu and cast to (unsigned long

Re: [libvirt] [RFC PATCH] build: avoid %zu in translated strings

2010-08-18 Thread Daniel P. Berrange
On Wed, Aug 18, 2010 at 07:41:16AM -0600, Eric Blake wrote: On 08/18/2010 03:04 AM, Daniel P. Berrange wrote: I find the PRI* stuff rather fugly. Can't we just use %llu and cast to (unsigned long long) Unfortunately, %llu is equally non-portable to mingw. And yes, we also have some

Re: [libvirt] [RFC PATCH] build: avoid %zu in translated strings

2010-08-18 Thread Eric Blake
On 08/18/2010 08:35 AM, Daniel P. Berrange wrote: These printf-args/parse files appear to handle long long int %llu combinations correctly. Since mingw32 lacks any vasprintf() at all, we will be using this gnulib replacement. The vasprintf-posix seems to only be used where vasprintf() exists

Re: [libvirt] [RFC PATCH] build: avoid %zu in translated strings

2010-08-18 Thread Eric Blake
On 08/18/2010 08:30 AM, Eric Blake wrote: Still, I'm reluctant to bite the bullet and go with the LGPLv2+ cascade on vasprintf-posix. So maybe the solution is an intermediate module: LGPLv2+ vasprintf - bare bones, guarantees a wrapper around system printf, so %zu and %llu are unsafe

Re: [libvirt] [RFC PATCH] build: avoid %zu in translated strings

2010-08-18 Thread Daniel P. Berrange
On Wed, Aug 18, 2010 at 09:54:51AM -0600, Eric Blake wrote: On 08/18/2010 08:30 AM, Eric Blake wrote: Still, I'm reluctant to bite the bullet and go with the LGPLv2+ cascade on vasprintf-posix. So maybe the solution is an intermediate module: LGPLv2+ vasprintf - bare bones, guarantees a

Re: [libvirt] [RFC PATCH] build: avoid %zu in translated strings

2010-08-18 Thread Eric Blake
On 08/18/2010 10:07 AM, Daniel P. Berrange wrote: Do we actually have any places where printf/sprintf hurts ? [v]as[n]printf are already safe, thanks to the vasprintf module. snprintf is safe, but only indirectly, due to the getaddrinfo module dragging it in (if getaddrinfo is changed to not

[libvirt] [RFC PATCH] build: avoid %zu in translated strings

2010-08-17 Thread Eric Blake
Mingw64 lacks %zu, and has the unfortunate setup where sizeof(long)==4 but sizeof(size_t)==8. Since gnulib's printf-posix module is not LGPLv2+, the best we can do is manually cast to the only portable int type known to hold size_t, and rely on gnulib's inttypes.h. * src/remote/remote_driver.c

Re: [libvirt] [RFC PATCH] build: avoid %zu in translated strings

2010-08-17 Thread Eric Blake
On 08/17/2010 04:05 PM, Eric Blake wrote: Mingw64 lacks %zu, and has the unfortunate setup where sizeof(long)==4 but sizeof(size_t)==8. Since gnulib's printf-posix module is not LGPLv2+, the best we can do is manually cast to the only portable int type known to hold size_t, and rely on