{"thread":{"id":"29939","subject":"[GUILT] [PATCH] get rid of \"cat: write error: Broken pipe\" error message","startedAt":"2012-03-13T13:39:44Z","lastAt":"2012-03-13T16:24:31Z","messageCount":3,"participants":["Per Cederqvist","Jeff Sipek"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"186860","messageId":"4F5F4E20.6000706@opera.com","threadId":"29939","inReplyTo":null,"subject":"[GUILT] [PATCH] get rid of \"cat: write error: Broken pipe\" error message","fromName":"Per Cederqvist","fromEmail":"cederp@opera.com","sentAt":"2012-03-13T13:39:44Z","receivedAt":"2012-03-13T13:39:44Z","isPatch":true,"sender":{"key":"cederp@opera.com","avatar":"https://gravatar.com/avatar/008fe28caedea0ba34042cd5157705267934f4ba7a9b29fb248ae18ec5b3055e?d=mp&s=160"},"body":"In some circumstances (like running guilt in a M-x shell buffer in\nEmacs) cat may give the above error message when the reader of the\noutput from cat exits without reading all input from cat.  (In other\ncircumstances cat is just silently terminated with SIGPIPE.)\n\nGet rid of the error by removing the useless use of cat in\ndo_get_header and do_get_full_header.\n\nSigned-off-by: Per Cederqvist <cederp@opera.com>\n---\n  guilt |    8 ++++----\n  1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/guilt b/guilt\nindex d1e17d4..7f6806e 100755\n--- a/guilt\n+++ b/guilt\n@@ -359,7 +359,7 @@ do_get_header()\n  \t# 4th line skips any empty lines thereafter.\n  \t# 5th line turns off empty line skip upon seeing a non-empty line.\n  \t# 6th line terminates execution when we encounter the diff\n-\tcat \"$1\" | awk '\n+\tawk '\n  BEGIN{body=0; subj=0}\n  /^Subject:/ && (body == 0 && subj == 0){subj=1; print substr($0, 10) \n\"\\n\"; next}\n  /^(Subject:|From:|Author:|Date:|commit)/ && (body == 0){next}\n@@ -369,7 +369,7 @@ BEGIN{body=0; subj=0}\n  /^(diff |---$|--- )/{exit}\n  {print $0}\n  END{}\n-'\n+' < \"$1\"\n  }\n\n  # usage: do_get_full_header patchfile\n@@ -377,12 +377,12 @@ do_get_full_header()\n  {\n  \t# 2nd line checks for the begining of a patch\n  \t# 3rd line outputs the line if it didn't get pruned by the above rules\n-\tcat \"$1\" | awk '\n+\tawk '\n  BEGIN{}\n  /^(diff |---$|--- )/{exit}\n  {print $0}\n  END{}\n-'\n+' < \"$1\"\n  }\n\n  # usage: assert_head_check\n-- \n1.7.9\n"},{"id":"186861","messageId":"20120313134146.GA1807@poseidon.cudanet.local","threadId":"29939","inReplyTo":"4F5F4E20.6000706@opera.com","subject":"Re: [GUILT] [PATCH] get rid of \"cat: write error: Broken pipe\" error message","fromName":"Jeff Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2012-03-13T13:41:46Z","receivedAt":"2012-03-13T13:41:46Z","isPatch":true,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"Looks good!\n\nThanks,\n\nJeff.\n\nOn Tue, Mar 13, 2012 at 02:39:44PM +0100, Per Cederqvist wrote:\n> In some circumstances (like running guilt in a M-x shell buffer in\n> Emacs) cat may give the above error message when the reader of the\n> output from cat exits without reading all input from cat.  (In other\n> circumstances cat is just silently terminated with SIGPIPE.)\n> \n> Get rid of the error by removing the useless use of cat in\n> do_get_header and do_get_full_header.\n> \n> Signed-off-by: Per Cederqvist <cederp@opera.com>\n> ---\n>  guilt |    8 ++++----\n>  1 files changed, 4 insertions(+), 4 deletions(-)\n> \n> diff --git a/guilt b/guilt\n> index d1e17d4..7f6806e 100755\n> --- a/guilt\n> +++ b/guilt\n> @@ -359,7 +359,7 @@ do_get_header()\n>  \t# 4th line skips any empty lines thereafter.\n>  \t# 5th line turns off empty line skip upon seeing a non-empty line.\n>  \t# 6th line terminates execution when we encounter the diff\n> -\tcat \"$1\" | awk '\n> +\tawk '\n>  BEGIN{body=0; subj=0}\n>  /^Subject:/ && (body == 0 && subj == 0){subj=1; print substr($0,\n> 10) \"\\n\"; next}\n>  /^(Subject:|From:|Author:|Date:|commit)/ && (body == 0){next}\n> @@ -369,7 +369,7 @@ BEGIN{body=0; subj=0}\n>  /^(diff |---$|--- )/{exit}\n>  {print $0}\n>  END{}\n> -'\n> +' < \"$1\"\n>  }\n> \n>  # usage: do_get_full_header patchfile\n> @@ -377,12 +377,12 @@ do_get_full_header()\n>  {\n>  \t# 2nd line checks for the begining of a patch\n>  \t# 3rd line outputs the line if it didn't get pruned by the above rules\n> -\tcat \"$1\" | awk '\n> +\tawk '\n>  BEGIN{}\n>  /^(diff |---$|--- )/{exit}\n>  {print $0}\n>  END{}\n> -'\n> +' < \"$1\"\n>  }\n> \n>  # usage: assert_head_check\n> -- \n> 1.7.9\n> \n\n-- \nSi hoc legere scis nimium eruditionis habes.\n"},{"id":"186868","messageId":"20120313162428.GA1914@meili.cudanet.local","threadId":"29939","inReplyTo":"4F5F4E20.6000706@opera.com","subject":"Re: [GUILT] [PATCH] get rid of \"cat: write error: Broken pipe\" error message","fromName":"Jeff Sipek","fromEmail":"jeffpc@josefsipek.net","sentAt":"2012-03-13T16:24:31Z","receivedAt":"2012-03-13T16:24:31Z","isPatch":true,"sender":{"key":"jeffpc@josefsipek.net","avatar":null},"body":"On Tue, Mar 13, 2012 at 02:39:44PM +0100, Per Cederqvist wrote:\n> In some circumstances (like running guilt in a M-x shell buffer in\n> Emacs) cat may give the above error message when the reader of the\n> output from cat exits without reading all input from cat.  (In other\n> circumstances cat is just silently terminated with SIGPIPE.)\n> \n> Get rid of the error by removing the useless use of cat in\n> do_get_header and do_get_full_header.\n\nFWIW, your patch got mangled pretty badly.  I fixed it up and applied it.\n\nThanks,\n\nJeff.\n\n> Signed-off-by: Per Cederqvist <cederp@opera.com>\n> ---\n>  guilt |    8 ++++----\n>  1 files changed, 4 insertions(+), 4 deletions(-)\n> \n> diff --git a/guilt b/guilt\n> index d1e17d4..7f6806e 100755\n> --- a/guilt\n> +++ b/guilt\n> @@ -359,7 +359,7 @@ do_get_header()\n>  \t# 4th line skips any empty lines thereafter.\n>  \t# 5th line turns off empty line skip upon seeing a non-empty line.\n>  \t# 6th line terminates execution when we encounter the diff\n> -\tcat \"$1\" | awk '\n> +\tawk '\n>  BEGIN{body=0; subj=0}\n>  /^Subject:/ && (body == 0 && subj == 0){subj=1; print substr($0,\n> 10) \"\\n\"; next}\n>  /^(Subject:|From:|Author:|Date:|commit)/ && (body == 0){next}\n> @@ -369,7 +369,7 @@ BEGIN{body=0; subj=0}\n>  /^(diff |---$|--- )/{exit}\n>  {print $0}\n>  END{}\n> -'\n> +' < \"$1\"\n>  }\n> \n>  # usage: do_get_full_header patchfile\n> @@ -377,12 +377,12 @@ do_get_full_header()\n>  {\n>  \t# 2nd line checks for the begining of a patch\n>  \t# 3rd line outputs the line if it didn't get pruned by the above rules\n> -\tcat \"$1\" | awk '\n> +\tawk '\n>  BEGIN{}\n>  /^(diff |---$|--- )/{exit}\n>  {print $0}\n>  END{}\n> -'\n> +' < \"$1\"\n>  }\n> \n>  # usage: assert_head_check\n> -- \n> 1.7.9\n> \n\n-- \nThe obvious mathematical breakthrough would be development of an easy way to\nfactor large prime numbers.\n\t\t- Bill Gates, The Road Ahead, pg. 265\n"}]}