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

nstraz at redhat.com nstraz at redhat.com
Thu Apr 1 07:31:13 PDT 2010


On Apr  1 16:21, Michal Sojka wrote:
> On Thu, 01 Apr 2010, nstraz at redhat.com wrote:
> > I ran into this while looking at the vim plugin.  Vim's system() call
> > redirects output to a file and it was missing many of the part{ lines.
> > 
> > If stream_stdout is setup too early, it will overwrite the part start
> > when notmuch is redirected to a file.
> 
> 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.`

Nate


More information about the notmuch mailing list