git: 9front

Download patch

ref: eebd38b4d92e82aafd4513e4085303b403c1c50a
parent: fc9e5023d136e77384d19a27716ad98e51375b74
author: mischief <mischief@offblast.org>
date: Wed Jun 25 18:06:29 EDT 2014

upas/fs: disable imap mail fetch pipeline due to race

pipeline = 1 with a dovecot imap server causes FETCH and OK responses
get interleaved so some message bodies accidentally get merged together.
disabling it will make fetching mail over imap slower, but it works.

--- a/sys/src/cmd/upas/fs/imap4.c
+++ b/sys/src/cmd/upas/fs/imap4.c
@@ -9,7 +9,18 @@
 #pragma varargck	type	"Z"	char*
 
 int	doublequote(Fmt*);
-int	pipeline = 1;
+
+// if pipeline == 1 and upas/fs is used with dovecot,
+// 9Xn OK responses sometimes come much later after FETCH responses, i.e.
+// <- * 1 FETCH ...
+// <- * 2 FETCH ...
+// <- * 3 FETCH ...
+// <- 9X5 OK Fetch completed.
+// <- 9X6 OK Fetch completed.
+// download 40: did not get message body
+// <- 9X7 OK Fetch completed.
+// causing multiple messages to turn into one in imap4.c:/^imap4resp.
+int	pipeline = 0;
 
 static char Eio[] = "i/o error";
 
--