[spambayes-bugs] [ spambayes-Bugs-870799 ] imap trying to fetch invalid message UID

SourceForge.net noreply at sourceforge.net
Tue Jan 27 18:40:20 EST 2004


Bugs item #870799, was opened at 2004-01-05 22:58
Message generated for change (Comment added) made by anadelonbrin
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=870799&group_id=61702

Category: imapfilter
Group: Source code 1.0a7
Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: David Mann (feint)
Assigned to: Tony Meyer (anadelonbrin)
Summary: imap trying to fetch invalid message UID

Initial Comment:
It looks like it is going off the end of the list of
the UIDs it brings back from the IMAP server:

c:\tmp> c:\Python23\python.exe sb_imapfilter.py -c -v  -i4
SpamBayes IMAP Filter Beta1, version 0.1 (September 2003),
using SpamBayes IMAP Filter Web Interface Alpha2,
version 0.02
and engine SpamBayes Beta2, version 0.2 (July 2003).

Loading database hammie.db...Loading state from
hammie.db database
hammie.db is an existing database, with 41 spam and 16 ham
 Done.
  46:52.00 > GPAB1 LOGIN xxxx "xxxxxx"
  46:52.18 < GPAB1 OK [CAPABILITY IMAP4REV1 IDLE
NAMESPACE MAILBOX-REFERRALS SCAN SORT THREAD=REFERENCES
THREAD=ORDEREDSUBJECT MULTIAPPEND] User xxxx authenticated
Classifying
  46:52.18 > GPAB2 SELECT Spam
  46:52.31 < * 56 EXISTS
  46:52.31 < * 0 RECENT
  46:52.31 < * OK [UIDVALIDITY 1073247595] UID validity
status
  46:52.31 < * OK [UIDNEXT 83] Predicted next UID
  46:52.31 < * FLAGS (\Answered \Flagged \Deleted
\Draft \Seen)
  46:52.32 < * OK [PERMANENTFLAGS (\* \Answered
\Flagged \Deleted \Draft \Seen)] Permanent flags
  46:52.32 < GPAB2 OK [READ-WRITE] SELECT completed
  46:52.32 > GPAB3 SELECT Junk
  46:52.44 < * 1 EXISTS
  46:52.44 < * 0 RECENT
  46:52.44 < * OK [UIDVALIDITY 1067418428] UID validity
status
  46:52.45 < * OK [UIDNEXT 2] Predicted next UID
  46:52.45 < * FLAGS (Junk NonJunk \Answered \Flagged
\Deleted \Draft \Seen)
  46:52.45 < * OK [PERMANENTFLAGS (Junk NonJunk \*
\Answered \Flagged \Deleted \Draft \Seen)] Permanent flags
  46:52.45 < * OK [UNSEEN 1] first unseen message in
/home/xxxx/Junk
  46:52.45 < GPAB3 OK [READ-WRITE] SELECT completed
  46:52.45 > GPAB4 SELECT INBOX
  46:53.60 < * 127 EXISTS
  46:53.60 < * NO Trying to get mailbox lock from
process 14487
  46:53.60 NO response: Trying to get mailbox lock from
process 14487
  46:53.60 < * 0 RECENT
  46:53.60 < * OK [UIDVALIDITY 1066476660] UID validity
status
  46:53.61 < * OK [UIDNEXT 558] Predicted next UID
  46:53.61 < * FLAGS (Junk NonJunk $Label2 $Label1
$Label3 $Label4 $Label5 \Answered \Flagged \Deleted
\Draft \Seen)
  46:53.61 < * OK [PERMANENTFLAGS (Junk NonJunk $Label2
$Label1 $Label3 $Label4 $Label5 \* \Answered \Flagged
\Deleted \Draft \Seen)] Permanent flags
  46:53.61 < * OK [UNSEEN 125] first unseen message in
/var/spool/mail/xxxx
  46:53.61 < GPAB4 OK [READ-WRITE] SELECT completed
  46:53.61 > GPAB5 UID SEARCH UNDELETED
  46:53.74 < * SEARCH 180 190 233 245 251 260 264 270
283 288 299 316 322 332 355 363 397 399 402 403 404 405
406 409 410 412 414 416 421 422 424 425 432 434 439 440
441 442 445 446 447 448 451 452 454 455 456 457 458 460
462 463 464 465 466 467 469 470 471 472 473 474 475 476
477 478 479 480 481 483 484 485 486 487 489 492 494 495
497 498 499 501 502 503 505 506 507 510 511 512 513 514
515 516 519 520 521 522 523 524 525 526 527 528 529 530
531 533 534 535 536 537 538 539 540 541 542 543 544 547
549 551 553 554 555 556 557
  46:53.74 < GPAB5 OK UID SEARCH completed
  46:53.74 > GPAB6 UID FETCH 180 RFC822.HEADER
  46:53.91 < * 1 FETCH (UID 180 RFC822.HEADER {1110}
  46:53.91 read literal size 1110
  46:53.91 < )
  46:53.91 < GPAB6 OK UID FETCH completed
  46:53.91 > GPAB7 UID FETCH 180 RFC822.PEEK
  46:54.02 < GPAB7 BAD Bogus attribute list in UID FETCH
  46:54.02 BAD response: Bogus attribute list in UID FETCH
  46:54.02 > GPAB8 UID FETCH 180 RFC822
  46:54.52 < * 1 FETCH (UID 180 RFC822 {4644}
  46:54.52 read literal size 4644
  46:54.52 < )
  46:54.52 < GPAB8 OK UID FETCH completed
*  46:54.52 > GPAB9 UID FETCH 180 (FLAGS INTERNALDATE)
  46:54.63 < * 1 FETCH (UID 180 FLAGS (\Seen NonJunk)
INTERNALDATE " 2-Dec-2003 12:20:04 +0100")
  46:54.63 < GPAB9 OK UID FETCH completed
  46:54.64 > GPAB10 APPEND INBOX (\Seen NonJunk) "
2-Dec-2003 12:36:21 +0100" {4679}
  46:54.74 < + Ready for argument
  46:54.74 write literal size 4679
  46:55.06 < * 128 EXISTS
  46:55.06 < * 1 RECENT
  46:55.06 < GPAB10 NO APPEND failed: Unknown flag: NonJunk
  46:55.06 NO response: APPEND failed: Unknown flag:
NonJunk
  46:55.07 > GPAB11 APPEND INBOX " 2-Dec-2003 12:36:21
+0100" {4679}
  46:55.23 < + Ready for argument
  46:55.23 write literal size 4679
  46:55.42 < * 129 EXISTS
  46:55.42 < * 2 RECENT
  46:55.42 < GPAB11 OK APPEND completed
  46:55.42 > GPAB12 UID STORE 180 +FLAGS.SILENT (\Deleted)
  46:55.52 < GPAB12 OK UID STORE completed
  46:55.52 > GPAB13 UID SEARCH (UNDELETED HEADER
X-Spambayes-MailId 1073296013)
  46:55.63 < * SEARCH 558 559
  46:55.63 < GPAB13 OK UID SEARCH completed
.  46:55.65 > GPAB14 UID FETCH "558 559" (FLAGS
INTERNALDATE)
  46:55.75 < GPAB14 BAD Bogus sequence in UID FETCH
  46:55.75 BAD response: Bogus sequence in UID FETCH
Traceback (most recent call last):
  File "sb_imapfilter.py", line 825, in ?
    run()
  File "sb_imapfilter.py", line 815, in run
    imap_filter.Filter()
  File "sb_imapfilter.py", line 675, in Filter
    self.unsure_folder)
  File "sb_imapfilter.py", line 608, in Filter
    msg.Save()
  File "sb_imapfilter.py", line 395, in Save
    response = imap.uid("FETCH", self.uid, "(FLAGS
INTERNALDATE)")
  File "c:\Python23\lib\imaplib.py", line 697, in uid
    typ, dat = self._simple_command(name, command, *args)
  File "c:\Python23\lib\imaplib.py", line 1000, in
_simple_command
    return self._command_complete(name,
self._command(name, *args))
  File "c:\Python23\lib\imaplib.py", line 837, in
_command_complete
    raise self.error('%s command error: %s %s' % (name,
typ, data))
imaplib.error: UID command error: BAD ['Bogus sequence
in UID FETCH']


----------------------------------------------------------------------

>Comment By: Tony Meyer (anadelonbrin)
Date: 2004-01-28 12:40

Message:
Logged In: YES 
user_id=552329

Yes, I considered that, as it was the simple fix, but then 
you're left with two undeleted messages in the inbox which 
are duplicates of each other, both having the same 
spambayes id.  (Or at least, I assume so, if I had deduced the 
problem correctly).

Good to hear that things are working for you, though.

----------------------------------------------------------------------

Comment By: David Mann (feint)
Date: 2004-01-28 03:33

Message:
Logged In: YES 
user_id=64372

FYI I fixed the problem (on my local machine) with the
following 1 liner (diff - ignore the part about the change
of location of python executable):

1c1
< #!/usr/bin/env python
---
> #!c:\Python23\python.exe
358a359,361
>
>
>
436a440,441
>         new_id=new_id.split(' ')[0]
>

----------------------------------------------------------------------

Comment By: Tony Meyer (anadelonbrin)
Date: 2004-01-27 21:38

Message:
Logged In: YES 
user_id=552329

What's going wrong is that imapfilter is finding two
'undeleted' messages with the same spambayes id, which is
very bad.  What's more, messages 558 and 559 didn't exist
when it did the first listing of undeleted messages, which
means that they were both written then.

I *think* that what is happening is that although the first
append fails (because of the "nonjunk" flag, which is some
weird thing that imap server is doing), it still creates the
message, which is very bad.

The only fix I can think of is to check if more than one
message is returned, and if it is, try and delete all but
the last one.  I've checked this in, so it should be there
in the next release.  You could either try that, or get
sb_imapfilter.py from CVS and try that.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=870799&group_id=61702



More information about the Spambayes-bugs mailing list