All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Sebrecht <nicolas.s.dev@gmx.fr>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: Junio C Hamano <gitster@pobox.com>,
	Nicolas Sebrecht <nicolas.s.dev@gmx.fr>,
	giuseppe.bilotta@gmail.com, git@vger.kernel.org,
	Brandon Casey <drafnel@gmail.com>
Subject: [PATCH v2] Re: mailinfo: allow individual e-mail files as input
Date: Fri, 7 Aug 2009 06:39:29 +0200	[thread overview]
Message-ID: <20090807043929.GJ12924@vidovic> (raw)
In-Reply-To: <7GvFnE4br-8WnXmtoea9V1LPY-qshCw6arPr6H40SRG59-b7YcpTsw@cipher.nrlssc.navy.mil>

The 06/08/09, Brandon Casey wrote:

> The "former", or Junio's original patch, effectively has this form:
> 
>    {
>       sed "$1"
>    } < "$1"
> 
> Without reading closely enough, I thought it looked like this:
> 
>    {
>       sed
>    } < "$1"
> 
> Since I didn't study the sed statement closely enough, I assumed that it was
> operating on the remaining portion of the patch email that was redirected to
> the block on stdin.  I missed the fact that the file name was supplied to
> it.  My comment was that I found it strange (and maybe unintuitive, or maybe
> it's just me) that "$1" was piped on stdin and it was supplied as an
> argument to sed.

Thinking to this a bit more, I tend to think that your intention to get
rid of the "$1" argument of sed is the right thing to do.

It really seems like the argument has precedence to the redirection

  _but_

I couldn't find any reference to this case in POSIX and I guess that the
behaviour may differ between implementations of sed. I don't know.
Perhaps somebody could tell us if our hesitation is justified (or not)?

Finally and to prevent strange behaviours, I would write

  {
    real l1
    real l2
    real l3
    {
      echo "$l1"
      echo "$l2"
      echo "$l3"
      cat
    } | sed
  } < "$1"

instead of

  {
    real l1
    real l2
    real l3
    sed "$1"
  } < "$1"

because the latter may contain either the content of the whole file
(coming from the argument) or the content of the file _whithout_ the
first three lines (coming from the redirection '<' amputated by the
'read' statements).

Junio?

-- 
Nicolas Sebrecht

  reply	other threads:[~2009-08-07  4:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-05 22:04 What's in git.git (Aug 2009, #01; Wed, 05) Junio C Hamano
2009-08-06 22:24 ` Brandon Casey
2009-08-06 23:17   ` Nicolas Sebrecht
2009-08-06 23:28     ` Nicolas Sebrecht
2009-08-07  1:08   ` [PATCH 1/3] t4150-am: demonstrate git-am's failure to handle some patch emails Brandon Casey
2009-08-07  1:08     ` [PATCH 2/3] mailinfo: allow individual e-mail files as input Brandon Casey
2009-08-07  1:08       ` [PATCH 3/3] git-am: print fair error message when format detection fails Brandon Casey
2009-08-07  1:18       ` [PATCH 2/3] mailinfo: allow individual e-mail files as input Jeff King
2009-08-07  1:21         ` Brandon Casey
2009-08-07  1:27       ` [PATCH v2] " Brandon Casey
2009-08-07  1:52         ` [PATCH v2] " Nicolas Sebrecht
2009-08-07  1:56           ` Nicolas Sebrecht
2009-08-07  2:05             ` Brandon Casey
2009-08-07  2:31               ` Nicolas Sebrecht
2009-08-07  2:49                 ` Brandon Casey
2009-08-07  4:39                   ` Nicolas Sebrecht [this message]
2009-08-07  5:25                     ` Junio C Hamano
2009-08-07  2:30           ` Brandon Casey
2009-08-07  1:36       ` [PATCH 2/3] " Nicolas Sebrecht
2009-08-07  1:59         ` Brandon Casey
2009-08-07  3:37       ` [PATCH 2/3] " Junio C Hamano
2009-08-07  3:33   ` What's in git.git (Aug 2009, #01; Wed, 05) Nanako Shiraishi
2009-08-07  3:55     ` Junio C Hamano
2009-08-07 14:01     ` Brandon Casey

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=20090807043929.GJ12924@vidovic \
    --to=nicolas.s.dev@gmx.fr \
    --cc=casey@nrlssc.navy.mil \
    --cc=drafnel@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=giuseppe.bilotta@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.