Skip Menu |

This queue is for tickets about the Mail-DKIM CPAN distribution.

Report information
The Basics
Id: 130928
Status: resolved
Priority: 0/
Queue: Mail-DKIM

People
Owner: mbradshaw [...] cpan.org
Requestors: FANY [...] cpan.org
Cc: IT-1288 [...] jira.mensa.de
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: IT-1288 [...] jira.mensa.de
Subject: Mail::DKIM::Verifier calls my $SIG{__DIE__} handler
My qmail-dmarc script included in App::Qmail::DMARC uses a ${__SIG__} handler to ensure that in case of emergency, :-) things get properly logged: https://metacpan.org/source/FANY/App-Qmail-DMARC-0.43/bin/qmail-dmarc Recently my log contained the message "died: not available". This message comes from the Mail::DKIM::Signature->fetch_public_key method which gets called by Mail::DKIM::Verifier when I call its ->CLOSE method: eval { $pkey = $signature->get_public_key; }; The solution is described in "perldoc -f eval": Using the "eval {}" form as an exception trap in libraries does have some issues. Due to the current arguably broken state of "__DIE__" hooks, you may wish not to trigger any "__DIE__" hooks that user code may have installed. You can use the "local $SIG{__DIE__}" construct for this purpose, as this example shows: # a private exception trap for divide-by-zero eval { local $SIG{'__DIE__'}; $answer = $a / $b; }; warn $@ if $@; In fact, you should IMHO typically do this in each evalĀ {}. Should I send you a pull request for https://github.com/marcbradshaw/mail-dkim? Regards fany
Hi Fany, Thanks for the report. Yes, please do send through that pull request. On Wed Nov 06 21:19:15 2019, FANY wrote: Show quoted text
> My qmail-dmarc script included in App::Qmail::DMARC uses a ${__SIG__} > handler to ensure that in case of emergency, :-) things get properly > logged: https://metacpan.org/source/FANY/App-Qmail-DMARC- > 0.43/bin/qmail-dmarc > > Recently my log contained the message "died: not available". > This message comes from the Mail::DKIM::Signature->fetch_public_key > method which gets called by Mail::DKIM::Verifier when I call its > ->CLOSE method: > > eval { $pkey = $signature->get_public_key; }; > > The solution is described in "perldoc -f eval": > > Using the "eval {}" form as an exception trap in libraries > does have some issues. Due to the current arguably broken > state of "__DIE__" hooks, you may wish not to trigger any > "__DIE__" hooks that user code may have installed. You can > use the "local $SIG{__DIE__}" construct for this purpose, as > this example shows: > > # a private exception trap for divide-by-zero > eval { local $SIG{'__DIE__'}; $answer = $a / $b; }; > warn $@ if $@; > > In fact, you should IMHO typically do this in each evalĀ {}. > > Should I send you a pull request for > https://github.com/marcbradshaw/mail-dkim? > > Regards > fany
Thanks for your quick reply! I prepared a pull request: https://github.com/marcbradshaw/mail-dkim/pull/4 Regards fany