pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: ertugrul9090@gmail.com, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15511: Drop table error "invalid argument"
Date: Thu, 06 Dec 2018 16:08:14 -0500
Message-ID: <30307.1544130494@sss.pgh.pa.us> (raw)
In-Reply-To: <20181206210042.6fu2tkbxy3vehwul@alvherre.pgsql>
References: <20181206210042.6fu2tkbxy3vehwul@alvherre.pgsql>

Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> On 2018-Dec-06, Tom Lane wrote:
>> In principle, we could write some Perl code that exactly matches what
>> snprintf.c thinks is valid input, but I think that keeping it in sync
>> would be a nightmare.  The concept I had in mind was to make a variant
>> version of snprintf.c that just validates a format string, and can be
>> compared to snprintf.c by diff'ing.  (Or, perhaps, sprinkle snprintf.c
>> with #ifdefs so that compiling it with the right -D flag produces what
>> we want; though that might look too ugly.)  If you don't mind adding
>> a C compiler to the list of dependencies for pg-make-po, we could imagine
>> having it compile up such a program at startup and then apply it to
>> each catalog.

> I don't follow.  Why don't we just compile snprintf.c as-is and another
> .c file with a function that invokes vsnprintf on each translated string
> on a .po file and prints an error if vsnprintf returns EINVAL?

Because figuring out what additional arguments go with a particular
format string is pretty hard, and we can't just not do that, or
snprintf will likely dump core.  We need a lobotomized version that
doesn't attempt to fetch any of the variable parameters.

> This code runs completely under our control, and we can install whatever
> tools are needed.  We don't need a C compiler today, but installing one
> is trivial.  Also, we already have postgres source trees for each PG
> version available.

OK.  I'd visualize only adding the test code to HEAD, and pulling it from
there to use for all back branches.

			regards, tom lane




view thread (14+ messages)  latest in thread

Message-ID: <30307.1544130494@sss.pgh.pa.us>
Permalink:  ../30307.1544130494@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/30307.1544130494@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, peter.eisentraut@2ndquadrant.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #15511: Drop table error "invalid argument"
  In-Reply-To: <30307.1544130494@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox