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 2007/03/26 02:36:44 UTC

[Bug 5389] New: sa-learn: debug option causes reading from STDIN

http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5389

           Summary: sa-learn: debug option causes reading from STDIN
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Learner
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: Mark.Martinec@ijs.si


SA 3.2.0-rc1, while trying to sa-learn a ham:

This command works fine:
  sa-learn --ham 2.lis

Adding a -D option causes a hang:
  sa-learn --ham -D 2.lis

Actually as it turns out, it is not a hang,
but it stops at sa-learn line 398:
  print {$handle} <STDIN>;
and waits for input from the terminal!?


(btw, the reason why I needed a -D was that sa-learn
was refusing to recognize a ham message, without giving
a reason:
  Learned tokens from 0 message(s) (0 message(s) examined)
It turned out the message size was just over 256kB.
It would be nice to give the user some indication of
why a message was just ignored)

  Mark



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

[Bug 5389] sa-learn: debug option causes reading from STDIN

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





------- Additional Comments From felicity@apache.org  2007-03-25 18:05 -------
(In reply to comment #1)
> The 2.lis was taken as an argument to -D, or so it seems.

Yes.

> So it appears to be a documentation bug or a misleading documentation:
>   -D, --debug [area=n,...]  Print debugging messages

I don't really agree, the documentation tells me that -D takes an optional
argument.  If you can suggest a different wording which reads better, we'd be
happy to put it in. :)



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

[Bug 5389] sa-learn: debug option causes reading from STDIN

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





------- Additional Comments From Mark.Martinec@ijs.si  2007-03-25 18:22 -------
Sorry for nitpicking below, this comment is unrelated to the topic,
I was just curious and made a trivial benchmark (time, VSZ),
feel free to ignore this comment below:


> print {$handle} <STDIN>;

The above is a terrible way to copy a file:
- in unnecessarily loads the whole file into memory;
- it reads line-by line, which is slower than reading by blocks.

The following is more efficient and less wasteful:

  my($nbytes,$buff);
  while (($nbytes=read(STDIN,$buff,32768)) > 0)
    { print {$handle} ($buff) or die "Error writing: $!" }
  defined $nbytes or die "Error reading: $!";



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

[Bug 5389] sa-learn: debug option causes reading from STDIN

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


felicity@apache.org changed:

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




------- Additional Comments From felicity@apache.org  2007-03-25 18:33 -------
(In reply to comment #4)
> With 3.1.8 the -D didn't take an argument, which probably caused my
> confusion. Sorry for 'driving without watching the traffic signs'.

Actually, 3.1's -D does take an optional argument.  The synopsis part of the POD
didn't mention it, but the options section did.  I think for 3.2 we copied the
"spamassassin-run" POD version which is what you quoted before.  :)

Anyway, since we both think it's ok I'm closing as worksforme.



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

[Bug 5389] sa-learn: debug option causes reading from STDIN

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





------- Additional Comments From Mark.Martinec@ijs.si  2007-03-25 18:26 -------
> I don't really agree, the documentation tells me that -D takes an optional
> argument.  If you can suggest a different wording which reads better, we'd be
> happy to put it in. :)

Now that I know what happened, I think you may close this as a non-issue.

With 3.1.8 the -D didn't take an argument, which probably caused my
confusion. Sorry for 'driving without watching the traffic signs'.



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

[Bug 5389] sa-learn: debug option causes reading from STDIN

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





------- Additional Comments From Mark.Martinec@ijs.si  2007-03-25 17:41 -------
> sa-learn --ham -D 2.lis

Actually, silly me, the following does work:
  sa-learn -D --ham 2.lis

The 2.lis was taken as an argument to -D, or so it seems.

So it appears to be a documentation bug or a misleading documentation:

  -D, --debug [area=n,...]  Print debugging messages



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