From: Johannes Sixt <j6t@kdbg.org>
To: Chris Packham <judge.packham@gmail.com>
Cc: git@vger.kernel.org, Stephen Boyd <bebarino@gmail.com>
Subject: Re: [RFC PATCHv3 1/4] am: avoid re-directing stdin twice
Date: Fri, 05 Sep 2014 22:26:35 +0200 [thread overview]
Message-ID: <540A1C7B.80109@kdbg.org> (raw)
In-Reply-To: <1409911611-20370-2-git-send-email-judge.packham@gmail.com>
Am 05.09.2014 12:06, schrieb Chris Packham:
> In check_patch_format we feed $1 to a block that attempts to determine
> the patch format. Since we've already redirected $1 to stdin there is no
> need to redirect it again when we invoke tr. This prevents the following
> errors when invoking git am
>
> $ git am patch.patch
> tr: write error: Broken pipe
> tr: write error
> Patch format detection failed.
>
> Cc: Stephen Boyd <bebarino@gmail.com>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---
> Nothing new since http://article.gmane.org/gmane.comp.version-control.git/256425
>
> git-am.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-am.sh b/git-am.sh
> index ee61a77..fade7f8 100755
> --- a/git-am.sh
> +++ b/git-am.sh
> @@ -250,7 +250,7 @@ check_patch_format () {
> # discarding the indented remainder of folded lines,
> # and see if it looks like that they all begin with the
> # header field names...
> - tr -d '\015' <"$1" |
> + tr -d '\015' |
> sed -n -e '/^$/q' -e '/^[ ]/d' -e p |
> sane_egrep -v '^[!-9;-~]+:' >/dev/null ||
> patch_format=mbox
>
I think this change is wrong. This pipeline checks whether one of the
lines at the top of the file contains something that looks like an email
header. With your change, the first three lines would not be looked at
because they were already consumed earlier.
I wonder why tr (assuming it is *this* instance of tr) dies with a write
error instead of from a SIGPIPE. Is SIGPIPE ignored somewhere and then
the tr invocation inherits this "ignore SIGPIPE" setting?
The only thing your version changes is that tr writes a bit less text
into the pipe. Perhaps its just sufficient that the output fits into the
pipe buffer, and no error occurs anymore? Then the new version is not a
real fix: make the patch text a bit longer, and the error is back.
-- Hannes
next prev parent reply other threads:[~2014-09-05 20:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-05 10:06 [RFC PATCHv3 0/4] am: patch-format Chris Packham
2014-09-05 10:06 ` [RFC PATCHv3 1/4] am: avoid re-directing stdin twice Chris Packham
2014-09-05 20:26 ` Johannes Sixt [this message]
2014-09-05 21:31 ` Chris Packham
2014-09-05 22:00 ` Junio C Hamano
2014-09-05 22:16 ` Junio C Hamano
2014-09-05 22:25 ` Junio C Hamano
2014-09-05 23:18 ` Stephen Boyd
2014-09-06 7:34 ` Junio C Hamano
2014-09-06 12:46 ` Torsten Bögershausen
2014-09-05 10:06 ` [RFC PATCHv3 2/4] t/am: add test for stgit patch format Chris Packham
2014-09-05 10:06 ` [RFC PATCHv3 3/4] t/am: add tests for hg " Chris Packham
2014-09-05 10:06 ` [RFC PATCHv3 4/4] am: add gitk " Chris Packham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=540A1C7B.80109@kdbg.org \
--to=j6t@kdbg.org \
--cc=bebarino@gmail.com \
--cc=git@vger.kernel.org \
--cc=judge.packham@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).