ports/88850: [patch] mail/fetchmail misses some messages since patch-imap.c
Vasil Dimov
vd at datamax.bg
Fri Nov 11 17:20:16 UTC 2005
>Number: 88850
>Category: ports
>Synopsis: [patch] mail/fetchmail misses some messages since patch-imap.c
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Nov 11 17:20:15 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Vasil Dimov
>Release: FreeBSD 6.0-STABLE amd64
>Organization:
DataMax
>Environment:
>Description:
Since files/patch-imap.c appeared fetchmail (sometimes) leaves one
message on the server.
Here is dump of one erroneous session with packets from server dumped
to stdout. There is one message on the server, but fetchmail says
"No mail".
IN >>> buf=* OK READY.
IN >>> buf=* CAPABILITY IMAP4REV1 SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS AUTH=PLAIN
IN >>> buf=A0001 OK CAPABILITY COMPLETED.
IN >>> buf=A0002 OK LOGGED IN.
IN >>> buf=* FLAGS (\ANSWERED \FLAGGED \DELETED \SEEN \DRAFT)
IN >>> buf=* OK [PERMANENTFLAGS (\ANSWERED \FLAGGED \DELETED \SEEN \DRAFT \*)] FLAGS PERMITTED.
IN >>> buf=* 1 EXISTS
IN >>> buf=* 0 RECENT
IN >>> buf=* OK [UIDVALIDITY 1130238900] UIDS VALID
IN >>> buf=* OK [UIDNEXT 166] PREDICTED NEXT UID
IN >>> buf=A0003 OK [READ-WRITE] SELECT COMPLETED.
IN >>> buf=A0004 OK EXPUNGE COMPLETED.
decreasing count, buf+2=004 OK EXPUNGE COMPLETED.
fetchmail: No mail for vd at localhost (folder freebsd-amd64)
IN >>> buf=* BYE LOGGING OUT
IN >>> buf=A0005 OK LOGOUT COMPLETED.
Obviously buf+2 is in the middle of the fetchmail's tag, echoed by the
server, so atoi(buf+2) gives 4 in this case.
Is this the intended operation?
Maybe untagged command is expected here, eg "* 1 EXPUNGE"?
If this is true we should better go for the string after the first
space, instead of cutting the first two chars.
>How-To-Repeat:
>Fix:
Be careful, I do not fully understand the meaning of the code I patched.
--- fetchmail_count.diff begins here ---
diff -urN fetchmail.orig/Makefile fetchmail/Makefile
--- fetchmail.orig/Makefile Fri Nov 11 02:21:03 2005
+++ fetchmail/Makefile Fri Nov 11 18:45:32 2005
@@ -11,7 +11,7 @@
PORTNAME= fetchmail
PORTVERSION= 6.2.5.2
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= mail ipv6
MASTER_SITES= http://download.berlios.de/%SUBDIR%/:fetchmail_site,fetchmailconf_site \
http://www.catb.org/~esr/%SUBDIR%/:fetchmail_site \
diff -urN fetchmail.orig/files/patch-imap.c fetchmail/files/patch-imap.c
--- fetchmail.orig/files/patch-imap.c Thu Nov 10 12:29:33 2005
+++ fetchmail/files/patch-imap.c Fri Nov 11 18:43:44 2005
@@ -1,5 +1,5 @@
---- ./imap.c.orig 2003-10-15 21:17:41.000000000 +0200
-+++ ./imap.c 2005-10-29 15:19:58.000000000 +0200
+--- imap.c.orig Wed Oct 15 22:17:41 2003
++++ imap.c Fri Nov 11 18:43:23 2005
@@ -105,6 +105,15 @@
{
recentcount = atoi(buf+2);
@@ -8,7 +8,7 @@
+ * so count down by ourselves */
+ else if (strstr(buf, " EXPUNGE"))
+ {
-+ if (atoi(buf+2) > 0) {
++ if (strstr(buf, " ") != NULL && atoi(strstr(buf, " ") + 1) > 0) {
+ if (count > 0)
+ count --;
+ }
--- fetchmail_count.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list