Re: In MacOS, psql reacts on SIGINT in a strange fashion (Linux is fine)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: In MacOS, psql reacts on SIGINT in a strange fashion (Linux is fine)
Дата
Msg-id 271520.1713052173@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: In MacOS, psql reacts on SIGINT in a strange fashion (Linux is fine)  (Dmitry Koterov <dmitry.koterov@gmail.com>)
Ответы Re: In MacOS, psql reacts on SIGINT in a strange fashion (Linux is fine)  (Dmitry Koterov <dmitry.koterov@gmail.com>)
Re: In MacOS, psql reacts on SIGINT in a strange fashion (Linux is fine)  (Thomas Munro <thomas.munro@gmail.com>)
Список pgsql-hackers
Dmitry Koterov <dmitry.koterov@gmail.com> writes:
> I wish it was zsh... I tested it with zsh, but with bash (and with
> low-level kill syscall), I observed the same effect unfortunately.

> So it's still a puzzle.

> 1. Even more, when I send a kill() low-level syscall using e.g. Perl - perl
> -e 'kill("INT", 16107)' - it is the same.
> 2. If any other program but psql is used (e.g. vim or my custom Perl script
> which ignores SIGINT), the effect is not reproducible.

> Can it be e.g. readline? Or something related to tty or session settings
> which psql could modify (I did not find any in the source code though).

OK, I tried dtruss'ing psql on macOS.  What I see is that with
Apple's libedit, the response to SIGINT includes this:

kill(0, 2)               = 0 0

that is, "SIGINT my whole process group".  If I build with libreadline
from MacPorts, I just see

kill(30902, 2)           = 0 0

(30902 being the process's own PID).  I'm not real sure why either
library finds it necessary to re-signal the process --- maybe they
trap SIGINT and then try to hide that by reinstalling the app's
normal SIGINT handler and re-delivering the signal.  But anyway,
libedit seems to be vastly exceeding its authority here.  If
signaling the whole process group were wanted, it would have been
the responsibility of the original signaller to do that.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: In MacOS, psql reacts on SIGINT in a strange fashion (Linux is fine)
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: In MacOS, psql reacts on SIGINT in a strange fashion (Linux is fine)