Re: snprintf causes regression tests to fail

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Nicolai Tufar <ntufar(at)gmail(dot)com>
Cc: Magnus Hagander <mha(at)sollentuna(dot)net>, pgsql-hackers(at)postgresql(dot)org, pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: snprintf causes regression tests to fail
Date: 2005-03-02 01:55:11
Message-ID: 200503020155.j221tBU28123@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

I have some new information. If I add the attached patch to snprintf.c,
I should see see snprintf() being called printing "0", vsnprintf()
printing "1" and dopr(), "2". However, I only see "0" printing in the
server logs.

I think this means it is finding our /port/snprintf(), but when it calls
vsnprintf, it must be using some other version, probably the operating
system version that doesn't support %lld.

I am also attaching the 'nm' output from libpgport_srv.a which does show
vsnprintf as being defined.

Win32 doesn't like multiply defined symbols so we use
-Wl,--allow-multiple-definition to allow multiple symbols.

I bet if I define LONG_LONG_INT_FORMAT as '%I64d' it would pass the
regression tests. (I will test now.) Our config/c-library.m4 file
confirms that format for MinGW:

# MinGW uses '%I64d', though gcc throws an warning with -Wall,

The big question is why our own vsnprintf() is not being called from
snprintf() in our port file.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 642 bytes
unknown_filename text/plain 8.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-03-02 02:32:39 Re: snprintf causes regression tests to fail
Previous Message Tom Lane 2005-03-02 00:28:35 Re: [HACKERS] snprintf causes regression tests to fail

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Tom Lane 2005-03-02 02:32:39 Re: snprintf causes regression tests to fail
Previous Message Tom Lane 2005-03-02 00:28:35 Re: [HACKERS] snprintf causes regression tests to fail

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2005-03-02 02:32:39 Re: snprintf causes regression tests to fail
Previous Message Thomas F.O'Connell 2005-03-01 23:23:52 Re: Where to see the patch queue (was Re: [PATCHES] Patch