oid failures on Alpha solved

From: Brent Verner <brent(at)rcfile(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: oid failures on Alpha solved
Date: 2000-12-30 14:00:09
Message-ID: 20001230090009.A29966@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

It turns out the problem causing the oid failures is with our
snprintf. specifically we are formatting "%u" incorrectly:

using a enhanced-for-testing version of our snprintf I get.

formatting '-1040' with '%lu'
snprintf = 18446744073709550576
sprintf = 18446744073709550576

formatting '-1040' with '%u'
snprintf = 18446744073709550576
sprintf = 4294966256

oidout() is where the offending call originates, FWIW.
snprintf(result, 12, "%u", o);

I've massaged in the snprintf.c code from openssh into postgres, and
oid now passes the regression test, but have a couple of questions:
1) could the openssh code be a candidate to replace our version? It
looks quite a bit more 'featureful', and I'd imagine it is about
as safe as snprintf gets.
2) do we _need_ oidout() to "%u", or could we "%lu" and fully take
advantage of the longer long on 64bit platforms?

cheers.
brent

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-12-30 14:47:20 Re: Inheritance docs error.
Previous Message Hannu Krosing 2000-12-30 11:43:30 Re: Creating locales.