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 2012/09/16 20:10:28 UTC

[Bug 6837] New: spamd does not require IO::Socket::IP

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6837

          Priority: P2
            Bug ID: 6837
          Assignee: dev@spamassassin.apache.org
           Summary: spamd does not require IO::Socket::IP
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: toddr@cpanel.net
          Hardware: All
            Status: NEW
           Version: 3.3 SVN branch
         Component: Building & Packaging
           Product: Spamassassin

If I run --version from command line, I get this:

$> spamd --version
SpamAssassin Server version 3.3.1
  running on Perl 5.8.8
Sep 16 13:07:21.262 [4820] error: Can't locate IO/Socket/IP.pm in @INC (@INC
contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8) at
/usr/lib/perl5/site_perl/5.8.8/IO/Socket/SSL.pm line 85.
  with SSL support (IO::Socket::SSL 1.76)
  with zlib support (Compress::Zlib 2.055)

It appears spamd is not requiring IO::Socket::IP in any meta or makefiles? That
or should --version be optionally requiring the module?

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

[Bug 6837] spamd does not require IO::Socket::IP

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

--- Comment #4 from Mark Martinec <Ma...@ijs.si> ---
$ man perlvar:

$^S     Current state of the interpreter.

  $^S         State
  ---------   -------------------------------------
  undef       Parsing module, eval, or main program
  true (1)    Executing an eval
  false (0)   Otherwise


The problem is a combination of two things:
- spamd sets a __DIE__ signal handler very early during its startup,
  in a BEGIN {} block;
- the $^S variable does not distinguish between an error during parsing,
  and an error in eval during parsing, both are seen by a signal handler
  as $^S being undef.

So what happens is that if a signal is thrown from code read by
a 'require', even an eval {} within that code cannot change the
fact that the $^S is undef (indicating a parser error)
when caught by an outer __DIE__ handler.

Here is a demonstration:

perl -e '
  $SIG{__DIE__} = sub {printf("CAUGHT: /%s/: %s\n",
                       !defined $^S ? "undef" : $^S, $_[0])};
  eval "BEGIN {eval{require Nosuch}}"'

I see a couple of possible workarounds, although none seems perfect:

1. add the:
     local $SIG{__DIE__} = sub {};
   in sub print_version and elsewhere where a late 'require'
   is used which may be throwing a signal;

2. within a __DIE__ signal handler $SIG{__DIE__} = sub { ... }
   change:
     log_message("error", $_[0]) if unless $^S;
   into:
     log_message("error", $_[0]) if defined $^S && !$^S;

3. move declaration of a $SIG{__DIE__} signal handler outside of
   a BEGIN {} block and down past most of the code which dynamically
   calls a 'require', i.e. just before the event loop.

I think the case 3 is the cleanest, although there may still be a
case of a late dynamic call to 'require' some module, like the
Compress::Zlib in spamd, or perhaps something in some plugin.

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

[Bug 6837] spamd does not require IO::Socket::IP

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

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Building & Packaging        |spamc/spamd
   Target Milestone|Undefined                   |3.4.0

--- Comment #6 from Mark Martinec <Ma...@ijs.si> ---
Let's try #3.

trunk (3.4.0):
  Bug 6837: (was: spamd does not require IO::Socket::IP) -
  spamd reports failed eval attempt in a required module as an error
Sending spamd/spamd.raw
Committed revision 1387594.

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

[Bug 6837] spamd does not require IO::Socket::IP

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

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kmcgrail@pccc.com

--- Comment #5 from Kevin A. McGrail <km...@pccc.com> ---
I'm fine with #2 or #3.  In the grand scheme, it's just a warning.

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

[Bug 6837] spamd does not require IO::Socket::IP

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

--- Comment #2 from Mark Martinec <Ma...@ijs.si> ---
> I have 3.3.1. I didn't check to see if this is fixed in trunk but I'm
> guessing someone can easily confirm this?

SpamAssassin doesn't require a module IO::Socket::IP presently (3.4.0/trunk),
nor in previous versions. For the time being we chose between IO::Socket::INET
and IO::Socket::INET6. Some time after the 3.4.0 we may prefer the module
IO::Socket::IP where available, but that time hasn't come yet.

In the reported case it seems the IO::Socket::SSL tries to load the
IO::Socket::IP, and in its absence it is supposed to fall back to
IO::Socket::INET6 or IO::Socket::INET. Despite the eval {} around
the 'require' it seems this attempt fails fatally in your case, although
I don't see any obvious problem near line 85 in IO/Socket/SSL.pm
version 1.76. Needs to be investigated.

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

[Bug 6837] spamd does not require IO::Socket::IP

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

Todd Rinaldo <to...@cpanel.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |toddr@cpanel.net

--- Comment #1 from Todd Rinaldo <to...@cpanel.net> ---
I have 3.3.1. I didn't check to see if this is fixed in trunk but I'm guessing
someone can easily confirm this?

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

[Bug 6837] spamd does not require IO::Socket::IP

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

--- Comment #3 from Mark Martinec <Ma...@ijs.si> ---
Actually ... I can see now how this failed attempt can propagate and be
reported as error. Will see what can be done. For now, just ignore it,
it's just a warning.

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

[Bug 6837] spamd does not require IO::Socket::IP

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

Mark Martinec <Ma...@ijs.si> changed:

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

--- Comment #7 from Mark Martinec <Ma...@ijs.si> ---
Fixed, closing.

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