Nico: I have you in CC since you sponsored the upload and it would be
nice if you could also sponsor an upload to fix this RC bug.

On Tue, 2007-04-17 at 10:35 +0200, Bastian Blank wrote:
> > >> Automatic build of wmweather+_2.9-3 on debian-31.osdl.marist.edu by 
> > >> sbuild/s390 98
> > > [...]
> > >> if s390-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/include 
> > >> -I/usr/include   -I/usr/include/w3c-libwww -DHAVE_CONFIG_H -MT 
> > >> wmgeneral.o -MD -MP -MF ".deps/wmgeneral.Tpo" -c -o wmgeneral.o 
> > >> wmgeneral.c; \
> > >>  then mv -f ".deps/wmgeneral.Tpo" ".deps/wmgeneral.Po"; else rm -f 
> > >> ".deps/wmgeneral.Tpo"; exit 1; fi
> > >> In file included from /usr/include/stdio.h:839,
> > >>                  from wmgeneral.c:70:
> > >> /usr/include/bits/stdio-ldbl.h:39: error: 'vsnprintf' undeclared here 
> > >> (not in a function)
> > 
> > Have you been able to reproduce the bug outside of the build daemon?
> 
> Yes. And I found the following:
> | # 221 "../config.h"
> | #define vsnprintf(str,size,format,ap) my_vsnprintf(str, size, format, ap)
> | # 2 "wmgeneral.c" 2
> 
> So it is a clear bug in wmweather+ by redefining C99 functions.

Hm, this is enclosed in:

#ifndef HAVE_WORKING_VSNPRINTF
# define vsnprintf(str, size, format, ap) my_vsnprintf(str, size, format, ap)
#endif

After some hours of digging with autoconf and the supplied m4 scripts, I
found out that the whole snprintf/vsnprintf action (see m4/snprintf.m4)
is there just to ensure that a working-as-expected snprintf() is
available. If it's not, it's defined in b0rken/snprintf.c using
vsnprintf(), which in turn has then to be available in a
working-as-expected way. Result is that configure checks for both
snprintf() and vsnprintf() and HAVE_WORKING_VSNPRINTF is only taken care
of when HAVE_WORKING_SNPRINTF is undefined. Unfortunately, this is a bug
since it's then also undefined in case vsnprintf() exists (but
snprintf() is fine) - rendering HAVE_WORKING_VSNPRINTF half-useless.

I see three solutions:

(a) Patch config.h such that the above #ifdef check includes also a
check for undefined HAVE_WORKING_SNPRINTF. This would be a one-liner,
fixes that the #define of vsnprintf() only happens when there is really
no working vsnprintf() available, and since vsnprintf() is not used
elsewhere in wmweather+ it's not too bad that vsnprintf() would be
broken (i.e. maybe non-existent). Existing but broken vsnprintf() would
still be redefined, which makes it a bad solution, and it's ugly anyway.

(b) Fix the m4 scripts such that configure takes always care of setting
HAVE_WORKING_VSNPRINTF correctly. This would make the diff much bigger
since autoreconf is required and would also not fix the case that
vsnprintf() is existent but buggy.

(c) Patch b0rken/snprintf.c to directly use my_vsnprintf() instead and
remove the (re)definition of vsnprintf() from config.h completely. This
fixes all possible cases of nonexistent/broken vsnprintf(). However, the
function would be possibly broken - but it's not used anyway. (Again:
Only snprintf() is used in the code.)

Since (c) looks best for now, I attach a (trivial) patch to implement
it. (Unfortunately I could only test the build on my machine where it
already worked before.)

Could someone please have a short look into this if my solution is ok? I
don't want to (make someone) upload this as FTBFS again...

Thanks for considering!

Martin



diff -ru wmweather+-2.9/b0rken/snprintf.c wmweather+-2.9_new/b0rken/snprintf.c
--- wmweather+-2.9/b0rken/snprintf.c    2002-09-22 22:00:54.000000000 +0200
+++ wmweather+-2.9_new/b0rken/snprintf.c        2007-04-17 16:31:52.000000000 +0200
@@ -35,7 +35,7 @@
     fprintf(stderr, "Using snprintf replacement\n");

     va_start(ap, format);
-    r=vsnprintf(str, size, format, ap);
+    r=my_vsnprintf(str, size, format, ap);
     va_end(ap);
     return r;
 }
Only in wmweather+-2.9_new/: config.h
diff -ru wmweather+-2.9/config.h.in wmweather+-2.9_new/config.h.in
--- wmweather+-2.9/config.h.in  2004-06-05 15:33:10.000000000 +0200
+++ wmweather+-2.9_new/config.h.in      2007-04-17 16:35:26.000000000 +0200
@@ -216,6 +216,3 @@
 typedef signed ssize_t;
 #endif

-#ifndef HAVE_WORKING_VSNPRINTF
-# define vsnprintf(str, size, format, ap) my_vsnprintf(str, size, format, ap)
-#endif

Reply via email to