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


Mark Martinec <[EMAIL PROTECTED]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|blocker                     |normal
             Status|RESOLVED                    |REOPENED
         OS/Version|Windows XP                  |All
         Resolution|FIXED                       |
            Summary|[review] mass-check hangs   |mass-check hangs
   Target Milestone|3.0.0                       |3.3.0




--- Comment #16 from Mark Martinec <[EMAIL PROTECTED]>  2008-09-18 06:16:48 PST 
---
Apparently one codepath leading to the problem was fixed, but not the
underlying problem itself (e.g. when M::S::parse is called with an
empty string (or a '0') as a message it still hangs, waiting on STDIN).

The code in Message.pm still conflicts with documentation:

Docs on Mail::SpamAssassin::parse says:
  Parse will return a Mail::SpamAssassin::Message object with just the
  headers parsed.  When calling this function, there are two optional
  parameters that can be passed in: $message is either undef (which will
  use STDIN), ...

Docs in Mail::SpamAssassin::Message::new says:
  C<message> is either undef (which will use STDIN), a scalar ...

while the actual code in Message::new treats the supplied value
as a boolean instead of testing for defined as claimed by the docs:
  my $message = $opts->{'message'} || \*STDIN;

As we have seen in other occasions (Bug 5965), treating user-supplied
data as a Perl boolean is generally bad practice.

The above statement should have been:
  my $message = defined $opts->{'message'} || \*STDIN;
to match the documentation and to avoid potential further
problems with hanging calls (Bug 3764).

Likewise, the code in Mail::SpamAssassin::Message::parse_body
treats a user-supplied string as a boolean in an attempt to
prevent the underlying error:
  # bug 5051: sometimes message/* parts have no content, and we get
  # stuck waiting for STDIN, which is bad. :(
  if ($toparse->[0]->{'decoded'}) {

I think it should be testing $toparse->[0]->{'decoded'} for being
equal to an empty string, or perhaps for being defined (I should
check what result the decode() can return).

Reopening...


-- 
Configure bugmail: 
https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Reply via email to