Re: BUG #1741: %i missing in snprintf implementation - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: BUG #1741: %i missing in snprintf implementation
Date
Msg-id 200507011434.j61EYFa11724@candle.pha.pa.us
Whole thread Raw
In response to Re: BUG #1741: %i missing in snprintf implementation  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Tom Lane wrote:
> "Tim Mauch" <tgmauch@yahoo.com> writes:
> > The implementation of snprintf/vsnprintf in src/port/snprintf.c does not
> > allow the use of %i ( %d equivalent ).  This likely isn't a problem for
> > postgres itself, but when a program compiles with -lpq and the standard c
> > libraries are not previously included the use of %i in the format string of
> > snprintf causes segmentation faults.
> > This is easily fixed by adding "case 'i':" to the same block of code handled
> > by "case 'd':" and case 'D':" in the implementation.
>
> We are certainly not going to buy into the assumption that our snprintf
> has to support every odd feature that anyone anywhere thinks snprintf
> should have :-(.  The correct response to this is to figure out how your
> program's calls got linked to our snprintf, and stop that from
> happening.
>
> AFAICS, our library should be defining the global symbol pg_snprintf not
> snprintf.  Can you look into why that's not happening for you?

Uh, the pg_snprintf macro fix is not in 8.0.X, only 8.1.  The good news,
however, is that very few platforms used our snprintf in 8.0 (the ones
that don't have 64-bit integer support in snprintf).

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

pgsql-bugs by date:

Previous
From: "K.G.Sivaraman"
Date:
Subject: BUG #1745: Unable to delete data from the database
Next
From: "Lance Clifner"
Date:
Subject: BUG #1746: libpq/libpq-fs.h not included in distribution