postgresql/src/bin
Tom Lane 92e6c1c9be Avoid calling gettext() in signal handlers.
It seems highly unlikely that gettext() can be relied on to be
async-signal-safe.  psql used to understand that, but someone got
it wrong long ago in the src/bin/scripts/ version of handle_sigint,
and then the bad idea was perpetuated when those two versions were
unified into src/fe_utils/cancel.c.

I'm unsure why there have not been field complaints about this
... maybe gettext() is signal-safe once it's translated at least
one message?  But we have no business assuming any such thing.

In cancel.c (v13 and up), I preserved our ability to localize
"Cancel request sent" messages by invoking gettext() before
the signal handler is set up.  In earlier branches I just made
src/bin/scripts/ not localize those messages, as psql did then.

(Just for extra unsafety, the src/bin/scripts/ version was
invoking fprintf() from a signal handler.  Sigh.)

Noted while fixing signal-safety issues in PQcancel() itself.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/2937814.1641960929@sss.pgh.pa.us
2022-01-17 13:30:04 -05:00
..
initdb Translation updates 2021-11-08 10:09:20 +01:00
pg_archivecleanup Translation updates 2021-11-08 10:09:20 +01:00
pg_basebackup pg_receivewal, pg_recvlogical: allow canceling initial password prompt. 2021-11-21 14:13:35 -05:00
pg_config Translation updates 2021-11-08 10:09:20 +01:00
pg_controldata Translation updates 2021-11-08 10:09:20 +01:00
pg_ctl Translation updates 2021-11-08 10:09:20 +01:00
pg_dump Adjust pg_dump's priority ordering for casts. 2021-11-22 17:16:29 -05:00
pg_resetwal Translation updates 2021-11-08 10:09:20 +01:00
pg_rewind Translation updates 2021-11-08 10:09:20 +01:00
pg_test_fsync Translation updates 2021-11-08 10:09:20 +01:00
pg_test_timing Translation updates 2021-11-08 10:09:20 +01:00
pg_upgrade Move into separate file all the SQL queries used in pg_upgrade tests 2021-12-02 10:31:43 +09:00
pg_verify_checksums Translation updates 2021-11-08 10:09:20 +01:00
pg_waldump Translation updates 2021-11-08 10:09:20 +01:00
pgbench Fix CREATE INDEX CONCURRENTLY for the newest prepared transactions. 2021-10-23 18:36:43 -07:00
pgevent Update copyright for 2018 2018-01-02 23:30:12 -05:00
psql Make psql's \password default to CURRENT_USER, not PQuser(conn). 2021-11-12 14:55:32 -05:00
scripts Avoid calling gettext() in signal handlers. 2022-01-17 13:30:04 -05:00
Makefile Allow on-line enabling and disabling of data checksums 2018-04-05 22:04:48 +02:00