Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita05fa36

Browse files
committed
Restore SIGFPE handler after initializing PL/Perl.
Perl, for some unaccountable reason, believes it's a good idea to resetSIGFPE handling to SIG_IGN. Which wouldn't be a good idea even if itworked; but on some platforms (Linux at least) it doesn't work at all,instead resulting in forced process termination if the signal occurs.Given the lack of other complaints, it seems safe to assume that Perlnever actually provokes SIGFPE and so there is no value in the settinganyway. Hence, reset it to our normal handler after initializing Perl.Report, analysis and patch by Andres Freund.
1 parente62ad18 commita05fa36

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎src/pl/plperl/plperl.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@
2323
#include"commands/trigger.h"
2424
#include"executor/spi.h"
2525
#include"funcapi.h"
26+
#include"libpq/pqsignal.h"
2627
#include"mb/pg_wchar.h"
2728
#include"miscadmin.h"
2829
#include"nodes/makefuncs.h"
2930
#include"parser/parse_type.h"
3031
#include"storage/ipc.h"
32+
#include"tcop/tcopprot.h"
3133
#include"utils/builtins.h"
3234
#include"utils/fmgroids.h"
3335
#include"utils/guc.h"
@@ -684,6 +686,18 @@ plperl_init_interp(void)
684686
char*dummy_env[1]= {NULL};
685687

686688
PERL_SYS_INIT3(&nargs, (char***)&embedding, (char***)&dummy_env);
689+
690+
/*
691+
* For unclear reasons, PERL_SYS_INIT3 sets the SIGFPE handler to
692+
* SIG_IGN. Aside from being extremely unfriendly behavior for a
693+
* library, this is dumb on the grounds that the results of a
694+
* SIGFPE in this state are undefined according to POSIX, and in
695+
* fact you get a forced process kill at least on Linux. Hence,
696+
* restore the SIGFPE handler to the backend's standard setting.
697+
* (See Perl bug 114574 for more information.)
698+
*/
699+
pqsignal(SIGFPE,FloatExceptionHandler);
700+
687701
perl_sys_init_done=1;
688702
/* quiet warning if PERL_SYS_INIT3 doesn't use the third argument */
689703
dummy_env[0]=NULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp