You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2005/10/11 19:00:26 UTC

[Bug 4631] New: DnsResolver is using Net::DNS without eval{} protection

http://bugzilla.spamassassin.org/show_bug.cgi?id=4631

           Summary: DnsResolver is using Net::DNS without eval{} protection
           Product: Spamassassin
           Version: 3.1.0
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Libraries
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: jm@jmason.org


debian bug 333330 notes:

starting spamassassin via the init script resolves with the error:

mybabe:~# /etc/init.d/spamassassin restart
Restarting SpamAssassin Mail Filter Daemon: [9296] error: Can't locate
object method "new" via package "Ne
t::DNS::Resolver" at /usr/share/perl5/Mail/SpamAssassin/DnsResolver.pm
line 87.
spamd.



looks to me a lot like the reporter doesn't have Net::DNS installed, but
DnsResolver is using that module without eval{} protection -- hence causing a
crash.   Net::DNS is still listed as an optional module in our documentation.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4631] [review] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|__DIE__ hooks affecting     |[review] __DIE__ hooks
                   |exception handling by evals |affecting exception handling
                   |                            |by evals






------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] [review] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631





------- Additional Comments From spamassassin@dostech.ca  2005-11-28 22:14 -------
Yeah, I know they work, but not ideally.  I actually thought of that paragraph
from eval's perldoc when I first saw the problem and considered it as a solution.

However, I figured the chances of everyone remembering to do that in both our
code AND third party-plugins were pretty slim.

Using the local $SIG constructs are certainly faster, so if people remember they
might at well use them.  The other code can catch leaks from plugins, etc.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dev@spamassassin.apache.org
         AssignedTo|spamassassin@dostech.ca     |dev@spamassassin.apache.org
             Status|ASSIGNED                    |NEW
            Summary|DnsResolver is using        |__DIE__ hooks affecting
                   |Net::DNS without eval{}     |exception handling by evals
                   |protection                  |






------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wtogami@redhat.com




------- Additional Comments From spamassassin@dostech.ca  2005-11-12 01:31 -------
*** Bug 4659 has been marked as a duplicate of this bug. ***



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] [review] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631





------- Additional Comments From jm@jmason.org  2005-11-28 22:35 -------
yeah, this is not a replacement for patch 3247; purely supplementary, for
efficiency.

I have an idea on how to consolidate those timeouts using closures; separate
issue though.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] DnsResolver is using Net::DNS without eval{} protection

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|dev@spamassassin.apache.org |spamassassin@dostech.ca
             Status|NEW                         |ASSIGNED




------- Additional Comments From spamassassin@dostech.ca  2005-11-12 01:26 -------
Created an attachment (id=3247)
 --> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=3247&action=view)
patch

Stupid broken __DIE__ hooks... evals often don't work as exception handlers
when you've installed your own __DIE__ hooks.

Getting Logger.pm to check to see if the message is coming from an eval in one
of our modules should do the trick.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4631] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|dev@spamassassin.apache.org |spamassassin@dostech.ca




------- Additional Comments From spamassassin@dostech.ca  2005-11-12 01:29 -------
trunk r332683



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] [review] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|                            |needs 1 vote






------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] [review] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631





------- Additional Comments From jm@jmason.org  2005-12-08 22:18 -------
ping: 1 more vote needed



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] [review] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631





------- Additional Comments From jm@jmason.org  2005-11-28 21:51 -------
'evals often don't work as exception handlers when you've installed your own
__DIE__ hooks'

well, they do work -- it's just that the fake-die messages used (kludgily) as
exceptions in perl are "leaked".  btw, I knew there was a good way to fix this;
here it is, as described in perldoc -f eval:

When using the eval{} form as an exception trap in libraries, 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 shown in this example:

    # a very private exception trap for divide-by-zero
    eval { local $SIG{'__DIE__'}; $answer = $a / $b; };
    warn $@ if $@;

see http://www.perl.com/doc/manual/html/pod/perlfunc/eval.html .

r349500 is a checkin that adds those, as well, in trunk, in addition to patch 3247.

ps: we really need a way to consolidate those timeout blocks; way too much code
duplication there...



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] DnsResolver is using Net::DNS without eval{} protection

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631





------- Additional Comments From duncf@debian.org  2005-11-04 21:55 -------
Net::DNS and its dependencies I should say



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4631] [review] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631





------- Additional Comments From spamassassin@dostech.ca  2005-11-28 22:23 -------
BTW, +1 on adding 3281, so 1 vote needed for both patches for 3.1.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] [review] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631


spamassassin@dostech.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From spamassassin@dostech.ca  2005-12-09 03:25 -------
3.1: Committed revision 355320.




------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] [review] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631


duncf@debian.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Status Whiteboard|needs 1 vote                |ready to commit




------- Additional Comments From duncf@debian.org  2005-12-09 03:20 -------
+1



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] [review] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631





------- Additional Comments From jm@jmason.org  2005-11-28 21:55 -------
Created an attachment (id=3281)
 --> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=3281&action=view)
additional patch

here's a patch that adds the local{__DIE__} stuff.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.

[Bug 4631] DnsResolver is using Net::DNS without eval{} protection

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631


duncf@debian.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal




------- Additional Comments From duncf@debian.org  2005-11-04 21:55 -------
Turns out this error message and similar ones happen when Net::DNS is not
installed. Surely there must be a way of silencing these! (I hope...)

The most common error message is:
Restarting SpamAssassin Mail Filter Daemon: [13804] error: Can't locate
Net/DNS.pm in @INC (@INC contains: ../lib /usr/share/perl5 /etc/perl
/usr/local/lib/perl/5.8.7 /usr/local/share/perl/5.8.7 /usr/lib/perl5
/usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl
/usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/local/lib/perl/5.8.0
/usr/local/share/perl/5.8.0) at
/usr/share/perl5/Mail/SpamAssassin/DnsResolver.pm line 86.
spamd.

Note that these messages are just warnings, spamd still starts; but they are
logged as "error".



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4631] DnsResolver is using Net::DNS without eval{} protection

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4631


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major
   Target Milestone|Undefined                   |3.1.1




------- Additional Comments From jm@jmason.org  2005-10-11 10:00 -------
3.1.1.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4631] [review] __DIE__ hooks affecting exception handling by evals

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4631





------- Additional Comments From jm@jmason.org  2005-11-12 02:22 -------
+1



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.