Re: [notmuch] [PATCH] Setup the GMimeStream only when needed
authorCarl Worth <cworth@cworth.org>
Thu, 1 Apr 2010 21:31:04 +0000 (14:31 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:28 +0000 (09:36 -0800)
7b/9144a30e7ec8846b998d4d01bb74a91004de75 [new file with mode: 0644]

diff --git a/7b/9144a30e7ec8846b998d4d01bb74a91004de75 b/7b/9144a30e7ec8846b998d4d01bb74a91004de75
new file mode 100644 (file)
index 0000000..9ba4e2e
--- /dev/null
@@ -0,0 +1,86 @@
+Return-Path: <cworth@cworth.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 943E74196F0\r
+       for <notmuch@notmuchmail.org>; Thu,  1 Apr 2010 14:31:07 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.89\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.89 tagged_above=-999 required=5\r
+       tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, T_MIME_NO_TEXT=0.01]\r
+       autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id qGxOGVSL8EAJ; Thu,  1 Apr 2010 14:31:05 -0700 (PDT)\r
+Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 2948B431FC1;\r
+       Thu,  1 Apr 2010 14:31:05 -0700 (PDT)\r
+Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
+       id A14F1254390; Thu,  1 Apr 2010 14:31:04 -0700 (PDT)\r
+From: Carl Worth <cworth@cworth.org>\r
+To: nstraz@redhat.com, Michal Sojka <sojkam1@fel.cvut.cz>\r
+In-Reply-To: <20100401143113.GE25669@redhat.com>\r
+References: <20100401134721.GD25669@redhat.com>\r
+       <87wrwr45k5.fsf@steelpick.2x.cz> <20100401143113.GE25669@redhat.com>\r
+Date: Thu, 01 Apr 2010 14:31:04 -0700\r
+Message-ID: <87aatmj1wn.fsf@yoom.home.cworth.org>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha1; protocol="application/pgp-signature"\r
+Cc: notmuch@notmuchmail.org\r
+Subject: Re: [notmuch] [PATCH] Setup the GMimeStream only when needed\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 01 Apr 2010 21:31:07 -0000\r
+\r
+--=-=-=\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Thu, 1 Apr 2010 10:31:13 -0400, nstraz@redhat.com wrote:\r
+> On Apr  1 16:21, Michal Sojka wrote:\r
+> > On Thu, 01 Apr 2010, nstraz@redhat.com wrote:\r
+> > thanks for the patch. After some investigation, it seems that you are\r
+> > right. What I missed in your commit message is the reason for such\r
+> > behaviour i.e. GMimeStream fseek()s in its write method to the position\r
+> > recorded when the stream was created, so that in case there is somebody\r
+> > else writing to the stream, the writes may overlap.\r
+>=20\r
+> Right, and in the case of writing to a pipe, the seek fails and the\r
+> file position doesn't change.  I found it comparing strace output of\r
+> `notmuch show ... > file` and `notmuch show ... | cat > file.`\r
+\r
+Ah, so the trigger of the bug is that we are currently interleaving\r
+calls to printf with GMime writes to a stdout stream.\r
+\r
+I'm happy to apply this patch to workaround the problem, (and I just did\r
+push it with some of my own comments added to the commit message).\r
+\r
+But isn't this a bug in GMime really? What possible use can it have for\r
+doing an fseek on every stream write? That seems broken, and we should\r
+report that to the GMime folks.\r
+\r
+=2DCarl\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.10 (GNU/Linux)\r
+\r
+iD8DBQFLtRCY6JDdNq8qSWgRAjH4AJ9rN03sPZU3Cph2q/n2jaZ/tth1EQCgiOx0\r
+gT4opUw2BPTyk5tt6eL4V8I=\r
+=sEx1\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r