Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCFEY-0001Us-9r for pgsql-hackers@arkaria.postgresql.org; Sun, 21 May 2017 01:00:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dCFEW-0000mp-GH for pgsql-hackers@arkaria.postgresql.org; Sun, 21 May 2017 01:00:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dCFEV-0000mQ-MP for pgsql-hackers@postgresql.org; Sun, 21 May 2017 01:00:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dCFEL-0005aW-EV for pgsql-hackers@postgresql.org; Sun, 21 May 2017 01:00:30 +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 v4L10Fr3000323; Sat, 20 May 2017 21:00:16 -0400 From: Tom Lane To: Piotr Stefaniak cc: Alvaro Herrera , Peter Eisentraut , "pgsql-hackers@postgresql.org" Subject: Re: pgindent (was Re: [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.) In-reply-to: <28060.1495161064@sss.pgh.pa.us> References: <20170517171600.fyxl3lhseszeuqrx@alvherre.pgsql> <880.1495045872@sss.pgh.pa.us> <5316.1495051919@sss.pgh.pa.us> <11874.1495057567@sss.pgh.pa.us> <15819.1495145176@sss.pgh.pa.us> <28060.1495161064@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 18 May 2017 22:31:04 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <321.1495328415.1@sss.pgh.pa.us> Date: Sat, 20 May 2017 21:00:15 -0400 Message-ID: <322.1495328415@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org I wrote: > Also, I found two places where an overlength comment line is simply busted > altogether --- notice that a character is missing at the split point: I found the cause of that: you need to apply this patch: --- freebsd_indent/pr_comment.c~ 2017-05-17 14:59:31.548442801 -0400 +++ freebsd_indent/pr_comment.c 2017-05-20 20:51:16.447332977 -0400 @@ -344,8 +353,8 @@ pr_comment(void) { int len = strlen(t_ptr); - CHECK_SIZE_COM(len); - memmove(e_com, t_ptr, len); + CHECK_SIZE_COM(len + 1); + memmove(e_com, t_ptr, len + 1); last_bl = strpbrk(e_com, " \t"); e_com += len; } As the code stands, the strpbrk call is being applied to a not-null-terminated string and therefore is sometimes producing an insane value of last_bl, messing up decisions later in the comment. Having the memmove include the trailing \0 resolves that. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers