Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gV0g4-0001zy-Gb for pgsql-bugs@arkaria.postgresql.org; Thu, 06 Dec 2018 20:55:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gV0g3-00052g-5N for pgsql-bugs@arkaria.postgresql.org; Thu, 06 Dec 2018 20:55:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gV0g2-00052Z-Rq for pgsql-bugs@lists.postgresql.org; Thu, 06 Dec 2018 20:55:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gV0fz-0004OX-U4 for pgsql-bugs@lists.postgresql.org; Thu, 06 Dec 2018 20:55:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wB6KtCFK029811; Thu, 6 Dec 2018 15:55:12 -0500 From: Tom Lane To: Alvaro Herrera cc: ertugrul9090@gmail.com, Peter Eisentraut , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15511: Drop table error "invalid argument" In-reply-to: <20181206200308.m6cxgag3o6yferrb@alvherre.pgsql> References: <20181206200308.m6cxgag3o6yferrb@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Thu, 06 Dec 2018 17:03:08 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29809.1544129712.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 06 Dec 2018 15:55:12 -0500 Message-ID: <29810.1544129712@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > On 2018-Dec-06, Tom Lane wrote: >> Is anybody interested in the idea of making our own validator for >> the .po files? I might be willing to code it up, if I knew what >> its API ought to be, but I don't know the workflow in that area. > I think it's definitely worthwhile to avoid introducing bogus files in > the Pg repo. > The work is done by these scripts: > https://git.postgresql.org/gitweb/?p=3Dpgtranslation/admin.git;a=3Dtree;= h=3Drefs/heads/master;hb=3Drefs/heads/master > cp-po does some validation while copying the file from the pgtranslation > repo back to Postgres, but I think that's the wrong time (at release > time). The good one I think is wwwtools/pg-make-po, which runs a few > times daily and produces the error file that ends up in the status table > in babel.postgresql.org. We'd want something that produces output that > can be appended to the $outdir/$catalogname-$lang.po.err file (lines > 103ff of that script). Hm. So that's all Perl code... 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. > Peter is the authority on this, of course. Yup. Peter, any comments? regards, tom lane