bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vasprintf on DEC [was: m4-1.4.7 build feedback]


From: Nelson H. F. Beebe
Subject: Re: vasprintf on DEC [was: m4-1.4.7 build feedback]
Date: Wed, 27 Sep 2006 09:37:31 -0600 (MDT)

I've tracked down the problem with the failure of the 108.format test
in m4-1.4.7 (and earlier versions back to m4-1.4.5).

The DEC Alpha OSF/1 4.0 system is the ONLY one in our test lab of
about 25 different Unix platforms that lacks snprintf() in -lc.
A fair number of packages expect to have that function, so several
years ago, I did a Web search and found this distribution:

        http://www.ijs.si/software/snprintf/snprintf_2.2.tar.gz

I installed it in two libraries, -lsnprintf (for cc) and -lgccsnprintf
(for gcc), and have used it since.

The m4 tests show that it has a problem: floating-point formats are
not supported, sigh...  Here's the output of a test program that uses
%.0f, %.1f, %.2f, %.3f, and %.4f formats:

        %  ./a.out
        sprintf():      56790
        snprintf():     f
        sprintf():      56790.0
        snprintf():     f
        sprintf():      56789.99
        snprintf():     f
        sprintf():      56789.988
        snprintf():     f
        sprintf():      56789.9876
        snprintf():     f

We keep a directory of the output of nm for all installed libraries,
and I've just scanned it.  I found several that have snprintf, but
tests with most showed they have the same behavior, very likely
because they were linked with the snprintf_2.2 library code.

However, I finally found one library with its own snprintf():
/usr/local/lib/sasl2/libplain.so.  Linking the test program with that
library produces almost correct output:

        ./a.out
        sprintf():      56790
        snprintf():     56790.0         <-- WRONG
        sprintf():      56790.0
        snprintf():     56790.0
        sprintf():      56789.99
        snprintf():     56789.99
        sprintf():      56789.988
        snprintf():     56789.988
        sprintf():      56789.9876
        snprintf():     56789.9876

That library comes from the Cyrus SASL package:

        ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/

I then created a new configuration file for builds on the DEC Alpha
OSF/1 system to use -lplain instead of -lgccsnprintf or -lsnprintf,
and ran a build.  Unfortunately, m4-1.4.7 now fails two tests:

Failed checks were:
  ./029.defn:err ./108.format:out

Correct output of the 108.format test is

        The string "The brown fox jumped over the lazy dog" uses 38 characters
        56790
        300

but m4 with -lplain produces

        The string "The brown fox jumped over the lazy dog" uses 38 characters
        56790.0
        11

It looks like I have to go looking again for a better free
implementation of snprintf(), sigh...

-------------------------------------------------------------------------------
- Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
- University of Utah                    FAX: +1 801 581 4148                  -
- Department of Mathematics, 110 LCB    Internet e-mail: address@hidden  -
- 155 S 1400 E RM 233                       address@hidden  address@hidden -
- Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]