pgsql: Strip Windows newlines from extension script files manually.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Strip Windows newlines from extension script files manually.
Date: 2024-10-28 17:07:40
Message-ID: E1t5TDQ-002s4c-MZ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Strip Windows newlines from extension script files manually.

Revert commit 924e03917 in favor of adding code to convert \r\n to \n
explicitly, on Windows only. The idea of letting text mode do the
work fails for a couple of reasons:

* Per Microsoft documentation, text mode also causes control-Z to be
interpreted as end-of-file. While it may be unlikely that extension
scripts contain control-Z, we've historically allowed it, and breaking
the case doesn't seem wise.

* Apparently, on some Windows configurations, "r" mode is interpreted
as binary not text mode. We could force it with "rt" but that would
be inconsistent with our code elsewhere, and it would still require
Windows-specific coding.

Thanks to Alexander Lakhin for investigation.

Discussion: https://postgr.es/m/79284195-4993-7b00-f6df-8db28ca60fa3@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6cfb3a33746990602c790199adc2debb2c4bbb87

Modified Files
--------------
src/backend/commands/extension.c | 38 ++++++++++++++++++++++++++++++++++----
1 file changed, 34 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2024-10-28 18:35:02 Re: pgsql: Implement pg_wal_replay_wait() stored procedure
Previous Message Peter Eisentraut 2024-10-28 16:46:03 Re: pgsql: Remove unused #include's from contrib, pl, test .c files