[PATCH 25/25] Fix stdout stream grabbing in format_part_content_text
Jameson Graef Rollins
jrollins at finestructure.net
Fri Jun 3 15:57:42 PDT 2011
On Fri, 03 Jun 2011 15:38:29 -0700, Carl Worth <cworth at cworth.org> wrote:
> commit d5b4d950245605b84c56ce991fa3c59a073a70e5
> Author: Jameson Graef Rollins <jrollins at finestructure.net>
> Date: Sat May 28 14:52:00 2011 -0700
>
> show: Avoid inadvertently closing stdout
>
> GMime has a nasty habit of taking ownership by default of any FILE*
> handed to it va g_mime_stream_file_new. Specifically it will close the
> FILE* when the stream is destroyed---even though GMime didn't open the
> file itself.
>
> To avoid this bad behavior, we have to carefully set_owner(FALSE)
> after calling g_mime_stream_file_new. In the format_part_content_text
> function, since commit d92146d3a6809f8ad940302af49cd99a0820665e we've
> been calling g_mime_stream_file_new unconditionally, but only calling
> g_mime_stream_file_set_owner(FALSE) conditionally.
>
> This led to the FILE* being closed early when notmuch show output was
> redirected to a file.
>
> Fixing this fixes the test-suite cases that broke with the previous
> commit, (which added redirected "notmuch show" calls to the test suite
> to expose this bug).
>
> Edited-by: Carl Worth <cworth at cworth.org> with a new commit message to
> explain the bug and fix.
Now I sound like I know what I'm talking about! Thanks, Carl.
jamie.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110603/ee1f143f/attachment-0001.pgp>
More information about the notmuch
mailing list