{"thread":{"id":"2952","subject":"[PATCH] diff-tree: stop on broken output pipe","startedAt":"2006-01-02T00:17:48Z","lastAt":"2006-01-07T00:41:50Z","messageCount":5,"participants":["Johannes Schindelin","Andreas Ericsson","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"14123","messageId":"Pine.LNX.4.63.0601020116020.11331@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2952","inReplyTo":null,"subject":"[PATCH] diff-tree: stop on broken output pipe","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-01-02T00:17:48Z","receivedAt":"2006-01-02T00:17:48Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\n---\n\n\tWithout this, on my iBook git-whatchanged keeps running when I \n\tquit \"less\". I have to interrupt the process a second time. No\n\tidea why it works on Linux.\n\n diff-tree.c |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\na3ff3aa99f1cc7d1e59563fbf22fed8a4f3f2d24\ndiff --git a/diff-tree.c b/diff-tree.c\nindex efa2b94..c06ccd3 100644\n--- a/diff-tree.c\n+++ b/diff-tree.c\n@@ -25,8 +25,9 @@ static int call_diff_flush(void)\n \t\treturn 0;\n \t}\n \tif (header) {\n-\t\tif (!no_commit_id)\n-\t\t\tprintf(\"%s%c\", header, diff_options.line_termination);\n+\t\tif (!no_commit_id && printf(\"%s%c\", header,\n+\t\t\t\tdiff_options.line_termination) < 0)\n+\t\t\tdie(\"broken output pipe\");\n \t\theader = NULL;\n \t}\n \tdiff_flush(&diff_options);\n-- \n1.0.GIT\n"},{"id":"14124","messageId":"43B88013.3020904@op5.se","threadId":"2952","inReplyTo":"Pine.LNX.4.63.0601020116020.11331@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] diff-tree: stop on broken output pipe","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2006-01-02T01:21:23Z","receivedAt":"2006-01-02T01:21:23Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Johannes Schindelin wrote:\n> ---\n> \n> \tWithout this, on my iBook git-whatchanged keeps running when I \n> \tquit \"less\". I have to interrupt the process a second time. No\n> \tidea why it works on Linux.\n> \n\nOn Linux the sending end dies when it catches SIGPIPE. I would have \nthought that should happen on OSX too. What shell are you running?\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"14126","messageId":"Pine.LNX.4.63.0601021159170.24000@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2952","inReplyTo":"43B88013.3020904@op5.se","subject":"Re: [PATCH] diff-tree: stop on broken output pipe","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-01-02T11:01:38Z","receivedAt":"2006-01-02T11:01:38Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 2 Jan 2006, Andreas Ericsson wrote:\n\n> Johannes Schindelin wrote:\n> > ---\n> > \n> > \tWithout this, on my iBook git-whatchanged keeps running when I \tquit\n> > \"less\". I have to interrupt the process a second time. No\n> > \tidea why it works on Linux.\n> > \n> \n> On Linux the sending end dies when it catches SIGPIPE. I would have thought\n> that should happen on OSX too. What shell are you running?\n\nWhy, bash 2.05a0(1)-release (powerpc-app,e-darwin6.0). Is there a way to \nturn off SIGPIPEs? Could be turned off by mistake here...\n\nCiao,\nDscho\n"},{"id":"14201","messageId":"7vhd8ht24d.fsf@assigned-by-dhcp.cox.net","threadId":"2952","inReplyTo":"Pine.LNX.4.63.0601020116020.11331@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] diff-tree: stop on broken output pipe","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-06T22:36:50Z","receivedAt":"2006-01-06T22:36:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> \tWithout this, on my iBook git-whatchanged keeps running when I \n> \tquit \"less\". I have to interrupt the process a second time. No\n> \tidea why it works on Linux.\n>\n> -\t\tif (!no_commit_id)\n> -\t\t\tprintf(\"%s%c\", header, diff_options.line_termination);\n> +\t\tif (!no_commit_id && printf(\"%s%c\", header,\n> +\t\t\t\tdiff_options.line_termination) < 0)\n> +\t\t\tdie(\"broken output pipe\");\n>  \t\theader = NULL;\n\nThere are tons of output other than this printf() and catching\nan output error only on this one and assuming that is a broken\npipe somehow feels doubly wrong to me.\n"},{"id":"14219","messageId":"Pine.LNX.4.63.0601070134010.30029@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2952","inReplyTo":"7vhd8ht24d.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] diff-tree: stop on broken output pipe","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-01-07T00:41:50Z","receivedAt":"2006-01-07T00:41:50Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 6 Jan 2006, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > \tWithout this, on my iBook git-whatchanged keeps running when I \n> > \tquit \"less\". I have to interrupt the process a second time. No\n> > \tidea why it works on Linux.\n> >\n> > -\t\tif (!no_commit_id)\n> > -\t\t\tprintf(\"%s%c\", header, diff_options.line_termination);\n> > +\t\tif (!no_commit_id && printf(\"%s%c\", header,\n> > +\t\t\t\tdiff_options.line_termination) < 0)\n> > +\t\t\tdie(\"broken output pipe\");\n> >  \t\theader = NULL;\n> \n> There are tons of output other than this printf() and catching\n> an output error only on this one and assuming that is a broken\n> pipe somehow feels doubly wrong to me.\n\nWelcome back! Hope you had a good time, and the fish tasted fine.\n\nThere really are tons of printf(), but\n\n- I did not want to be invasive,\n- if one printf() fails, the next will, too (probably), and\n- the problem occurs only on macosx here.\n\nMaybe it is not correct to assume that the output pipe is broken, but it \nis an error to keep going when printf() fails. So I picked one printf() \nwhich is called regularly.\n\nAndreas said that a SIGPIPE should be thrown, and bash should kill the \nscript. I have not found out why my bash doesn't. Until I do, I will have \nthis patch in my local git (and a similar patch in git-rev-list). It just \nis plain annoying when git-whatchanged (the git script I use most often) \nhangs there, burning cycles.\n\nCiao,\nDscho\n"}]}