[notmuch] [PATCH] Setup the GMimeStream only when needed

Carl Worth cworth at cworth.org
Thu Apr 1 14:31:04 PDT 2010


On Thu, 1 Apr 2010 10:31:13 -0400, nstraz at redhat.com wrote:
> On Apr  1 16:21, Michal Sojka wrote:
> > On Thu, 01 Apr 2010, nstraz at 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.
> 
> 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.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100401/480574fe/attachment.pgp>


More information about the notmuch mailing list