Re: [PATCH] pgindent truncates last line of files missing a trailing newline

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Akshay Joshi <akshay(dot)joshi(at)enterprisedb(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] pgindent truncates last line of files missing a trailing newline
Date: 2026-03-27 19:08:22
Message-ID: c5ffe163-4758-4562-b3f6-6bfb00e58f49@dunslane.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2026-03-26 Th 12:29 PM, Tom Lane wrote:
> Akshay Joshi<akshay(dot)joshi(at)enterprisedb(dot)com> writes:
>> I have addressed the review comments from Andrew.
>> Attached is the v2 patch, ready for review.
> I'm not sure I want to expend the brain cells to figure out whether
> this is a correct/complete patch. If pg_bsd_indent were less of an
> undercommented spaghetti-code nightmare, maybe fixing it here would
> be reasonable. But as things stand, why don't we just fix this in
> the perl wrapper, as attached?

Well, I thought we were trying to reduce the fixups we did in pgindent.
However, I take your point about the ugly nature of the pg_bsd_indent
code. So I'm ok with this fix, which is quite straightforward.

>
> (In any case, I'm not in favor of adding a test case, because that
> would require putting a trailing-newline-less .c file into our tree.
> At best there would be a permanent hazard of something "fixing"
> the file.)
>
>

fair point.

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-03-27 19:16:07 Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions
Previous Message SATYANARAYANA NARLAPURAM 2026-03-27 19:03:46 Re: Skipping schema changes in publication