Re: stopgap fix for signal handling during restore_command
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>, Michael Paquier <michael@paquier.xyz>, Robert Haas <robertmhaas@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Fujii Masao <fujii@postgresql.org>, Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-03-01T23:13:04Z
Lists: pgsql-hackers
Hi, On 2023-03-01 14:47:51 -0800, Nathan Bossart wrote: > On Tue, Feb 28, 2023 at 08:36:03PM -0800, Nathan Bossart wrote: > > On Sun, Feb 26, 2023 at 12:12:27PM -0800, Andres Freund wrote: > >> Partially I just want something that can easily be searched for, that can have > >> comments attached to it documenting why what it is doing is safe. > >> > >> It'd not be a huge amount of work to have a slow and restricted string > >> interpolation support, to make it easier to write messages. Converting floats > >> is probably too hard to do safely, and I'm not sure %m can safely be > >> supported. But basic things like %d would be pretty simple. > >> > >> Basically a loop around the format string that directly writes to stderr using > >> write(), and only supports a signal safe subset of normal format strings. > > > > Got it, thanks. I will try to put something together along these lines, > > although I don't know if I'll pick up the interpolation support in this > > thread. > > Here is an attempt at adding a signal safe function for writing to STDERR. Cool. > I didn't add support for format strings, but looking ahead, I think one > challenge will be avoiding va_start() and friends. In any case, IMO format > string support probably deserves its own thread. Makes sense to split that off. FWIW, I think we could rely on va_start() et al to be signal safe. The standardese isn't super clear about this, because they aren't functions, and posix only talks about functions being async signal safe... Greetings, Andres Freund
Commits
-
windows: msvc: Define STDIN/OUT/ERR_FILENO.
- bc322c73cfaa 11.22 landed
- 0e32652a7916 12.17 landed
- ebc093fa6481 13.13 landed
- 555bc89c9060 14.10 landed
-
Avoid calling proc_exit() in processes forked by system().
- d0e7f95b4845 11.22 landed
- e2e16904224a 12.17 landed
- ac1dfc303d0e 13.13 landed
- 54fc9dca5b10 14.10 landed
- c9265ae80b6a 15.5 landed
- ee06199fcb0a 16.1 landed
- 97550c071197 17.0 landed
-
Move extra code out of the Pre/PostRestoreCommand() section.
- 882e522d6468 15.5 landed
- d1c56ad37b96 16.1 landed
- 8fb13dd6ab5b 17.0 landed