Re: BUG #1741: %i missing in snprintf implementation

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tim Mauch <tgmauch(at)yahoo(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1741: %i missing in snprintf implementation
Date: 2005-07-01 14:34:15
Message-ID: 200507011434.j61EYFa11724@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Tom Lane wrote:
> "Tim Mauch" <tgmauch(at)yahoo(dot)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(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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Lance Clifner 2005-07-01 14:38:25 BUG #1746: libpq/libpq-fs.h not included in distribution
Previous Message K.G.Sivaraman 2005-07-01 14:30:02 BUG #1745: Unable to delete data from the database