You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@znep.com> on 1997/01/13 02:20:52 UTC

please test snprintf (really this time)

Please get http://www.worldgate.com/~marcs/ap/snprintf-test.tar.gz
and extract it.  It contains ap_snprintf routines and a test program
that isn't very pretty but has some use.  Then try the following:

	- if you don't have *cvt(), uncomment the CVTFLAGS line in the
	  Makefile to use the ones in ap_snprintf.c.  If your OS
	  does have them, and is something that isn't marked below as
	  having them, let me know.  In any case, be sure to try
	  the tests once with CVTFLAGS uncommented since I'm leaning
	  towards saying it should be shipped to use our own (stolen)
	  *cgt()'s for all systems.
	- if your OS has snprintf, make diff will show the differences
	  between the same program using ap_snprintf and your vendor
	  snprintf.
	- make good-diff will show the differences between what
	  ap_snprintf should output (ie. what it does for me) and what
	  it does on your platform.  Some differences, mainly related
	  to [-]0, are expected.

Please report any compile time warnings or (especially) errors and any
unexpected output in the diffs to me.

I have tested it and it works for me on:
  SunOS falun 5.5 Generic_103093-06 sun4m (*cvt)
  SunOS obed-le0 4.1.4 1 sun4m (*cvt)
  IRIX cab101 5.3 11091812 IP22 (*cvt)
  BSD/OS valis.worldgate.com 2.0.1 BSDI BSD/OS 2.0.1
  AIX gpu5 1 4 000002929000 (*cvt)
  FreeBSD alive.ampr.ab.ca 2.1.5-RELEASE 

It is very important to test this on as many other platforms as
possible because otherwise the gods will be angry and will make
bad things happen.


Re: please test snprintf (really this time)

Posted by Dean Gaudet <dg...@arctic.org>.
The diffs between linux (libc 5.4.17 and 5.3.12) native snprintf and
ap_snprintf are huge, they all look like 0 differences though.  The
good-diff only has the -0 differences for mynegdouble.  I've included the
diff against native.

IRIX 6.2 doesn't have snprintf.  Attached is the good-diff using SGI's cc. 
This was on a 32-bit system.  It looks like a lot of 0 differences. 

Dean

On Sun, 12 Jan 1997, Marc Slemko wrote:

> Please get http://www.worldgate.com/~marcs/ap/snprintf-test.tar.gz
> and extract it.  It contains ap_snprintf routines and a test program
> that isn't very pretty but has some use.  Then try the following:
> 
> 	- if you don't have *cvt(), uncomment the CVTFLAGS line in the
> 	  Makefile to use the ones in ap_snprintf.c.  If your OS
> 	  does have them, and is something that isn't marked below as
> 	  having them, let me know.  In any case, be sure to try
> 	  the tests once with CVTFLAGS uncommented since I'm leaning
> 	  towards saying it should be shipped to use our own (stolen)
> 	  *cgt()'s for all systems.
> 	- if your OS has snprintf, make diff will show the differences
> 	  between the same program using ap_snprintf and your vendor
> 	  snprintf.
> 	- make good-diff will show the differences between what
> 	  ap_snprintf should output (ie. what it does for me) and what
> 	  it does on your platform.  Some differences, mainly related
> 	  to [-]0, are expected.
> 
> Please report any compile time warnings or (especially) errors and any
> unexpected output in the diffs to me.
> 
> I have tested it and it works for me on:
>   SunOS falun 5.5 Generic_103093-06 sun4m (*cvt)
>   SunOS obed-le0 4.1.4 1 sun4m (*cvt)
>   IRIX cab101 5.3 11091812 IP22 (*cvt)
>   BSD/OS valis.worldgate.com 2.0.1 BSDI BSD/OS 2.0.1
>   AIX gpu5 1 4 000002929000 (*cvt)
>   FreeBSD alive.ampr.ab.ca 2.1.5-RELEASE 
> 
> It is very important to test this on as many other platforms as
> possible because otherwise the gods will be angry and will make
> bad things happen.
> 
> 

Re: please test snprintf (really this time)

Posted by Alexei Kosut <ak...@nueva.pvt.k12.ca.us>.
On Sun, 12 Jan 1997, Marc Slemko wrote:

> Please get http://www.worldgate.com/~marcs/ap/snprintf-test.tar.gz
> and extract it.  It contains ap_snprintf routines and a test program
> that isn't very pretty but has some use.  Then try the following:
> 
> 	- if you don't have *cvt(), uncomment the CVTFLAGS line in the
> 	  Makefile to use the ones in ap_snprintf.c.  If your OS
> 	  does have them, and is something that isn't marked below as
> 	  having them, let me know.  In any case, be sure to try
> 	  the tests once with CVTFLAGS uncommented since I'm leaning
> 	  towards saying it should be shipped to use our own (stolen)
> 	  *cgt()'s for all systems.

That doesn't work with HP-UX 9.04 (9000/826) and gcc 2.7.2 (it doesn't
compile at all with HP's cc, but I have the cheap, non-working one):

        gcc -DNEED_CVT -Wall -ansi -c ap_snprintf.c
ap_snprintf.c:108: conflicting types for `ap_ecvt'
/usr/local/lib/gcc-lib/hppa1.0-hp-hpux9.04/2.7.2/include/stdlib.h:242:
previous declaration of `ap_ecvt'
ap_snprintf.c:114: conflicting types for `ap_fcvt'
/usr/local/lib/gcc-lib/hppa1.0-hp-hpux9.04/2.7.2/include/stdlib.h:240:
previous declaration of `ap_fcvt'
ap_snprintf.c:125: conflicting types for `ap_gcvt'
/usr/local/lib/gcc-lib/hppa1.0-hp-hpux9.04/2.7.2/include/stdlib.h:241:
previous declaration of `ap_gcvt'
*** Error code 1

Without NEED_CVT, it works fine. (they're also defined in
/usr/include/stdlib.h, not just the gcc headers). How about including
stdlib.h *after* redefining ecvt, fcvt and gcvt? HP-UX uses size_t
instead of int in the function decls, so you end up defining the ap_*
functions differently, once in stdlib.h, and then again in
ap_snprintf.c. If you move the define to the top of the file, it
compiles and runs fine.

> 	- if your OS has snprintf, make diff will show the differences
> 	  between the same program using ap_snprintf and your vendor
> 	  snprintf.

HP-UX has snprintf(), but test-sn gives me a very different output
than test-ap: All the precisions are off. Section 2 of test-ap.out,
for example, is comprised of "000", whereas section 2 of test-sn.out
is comprised of "00000000000000000000" and "000000000.000000e+00" and
some other variations. Things like that all over. I can email the
output if someone wants it.

Timewise, they both seem to take about the same amount of time:
sometimes test-ap is .1 or .2 seconds faster, sometimes test-sn is.

> 	- make good-diff will show the differences between what
> 	  ap_snprintf should output (ie. what it does for me) and what
> 	  it does on your platform.  Some differences, mainly related
> 	  to [-]0, are expected.

no differences, I passed.

> Please report any compile time warnings or (especially) errors and any
> unexpected output in the diffs to me.

        gcc -Wall -ansi test.c -o test-sn
test.c: In function `main':
test.c:38: warning: implicit declaration of function `snprintf'

This is because although there is an snprintf in libc, it does not
exist in any of the header files. Is this a clue to us not to use it?
It would appear so.

-- 
________________________________________________________________________
Alexei Kosut <ak...@nueva.pvt.k12.ca.us>      The Apache HTTP Server
URL: http://www.nueva.pvt.k12.ca.us/~akosut/   http://www.apache.org/