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