Re: plperl crash with Debian 6 (64 bit), pl/perlu, libwww and https

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: plperl crash with Debian 6 (64 bit), pl/perlu, libwww and https
Дата
Msg-id 4E3F221F.6000307@dunslane.net
обсуждение исходный текст
Ответ на Re: plperl crash with Debian 6 (64 bit), pl/perlu, libwww and https  (Tim Bunce <Tim.Bunce@pobox.com>)
Список pgsql-hackers

On 08/07/2011 07:06 PM, Tim Bunce wrote:
>
> After a little digging and some discussion on the #p5p channel [thanks
> to ilmari++ leont++ and sorear++ for their help] it seems that local(%SIG)
> doesn't do what you might expect. The %SIG does become empty but the OS
> level handlers, even those installed by perl, *aren't changed*:
>
> $ perl -wE '$SIG{INT} = sub { say "Foo"}; { local %SIG; kill "INT", $$; };'
> Foo
> And, even worse, they're not reset at scope exit:
>
> $ perl -wE '$SIG{INT} = sub { say "Foo"}; { local %SIG; $SIG{INT} = sub {say "Bar" }} kill "INT", $$;'
> Bar
>
> That sure seems like a bug (I'll check with the perl5-porters list).

Yeah, that seems very bad. :-(

> Localizing an individual element of %SIG works fine.
> In C that's something like this (untested):
>
>      hv = gv_fetchpv("SIG", 0, SVt_PVHV);
>      keysv = ...SV containing "ALRM"...
>      he = hv_fetch_ent(hv, keysv, 0, 0);
>      if (he) {  /* arrange to restore existing elem */
>          save_helem_flags(hv, keysv,&HeVAL(he), SAVEf_SETMAGIC);
>      }
>      else {     /* arrange to delete a new elem */
>          SAVEHDELETE(hv, keysv);
>      }
>
>

Hmm. I think we'll need to test how much it's going to cost to add that 
to every plperl (or maybe just every plperlu) function call for the six 
or so signals we use.

cheers

andrew


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

Предыдущее
От: Tim Bunce
Дата:
Сообщение: Re: plperl crash with Debian 6 (64 bit), pl/perlu, libwww and https
Следующее
От: Tim
Дата:
Сообщение: Re: vacuumlo patch