All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: "Martin Ågren" <martin.agren@gmail.com>
Cc: apyhalov@gmail.com, "Git List" <git@vger.kernel.org>,
	"SZEDER Gábor" <szeder.dev@gmail.com>
Subject: Re: t7005-editor.sh failure
Date: Wed, 26 Sep 2018 07:59:00 -0400	[thread overview]
Message-ID: <CAPig+cR8KyeihQbUbSP7Awz+NTbf8c3r-ZE9w2wjnvvEpU0gDg@mail.gmail.com> (raw)
In-Reply-To: <CAN0heSpUhzbTjceVhBxk_jjE=vOAVTzXGFQ=UL9Y+muJHe0S6w@mail.gmail.com>

On Wed, Sep 26, 2018 at 5:53 AM Martin Ågren <martin.agren@gmail.com> wrote:
> I came up with the following commit message. What do you think about it?
>
>     t7005-editor: quote filename to fix whitespace-issue
>
>     Commit 4362da078e (t7005-editor: get rid of the SPACES_IN_FILENAMES
>     prereq, 2018-05-14) removed code for detecting whether spaces in
>     filenames work. Since we rely on spaces throughout the test suite
>     ("trash directory.t1234-foo"), testing whether we can use the filename
>     "e space.sh" was redundant and unnecessary.
>
>     In simplifying the code, though, the commit introduced a regression around
>     how spaces are handled, not in the /name/ of the script, but /in/ the
>     script itself. The editor-script created looks like this:
>
>       echo space >$1
>
>     We will try to execute something like
>
>       echo space >/foo/t/trash directory.t7005-editor/.git/COMMIT_EDITMSG
>
>     Most shells seem to be able to figure out that the filename doesn't end
>     with "trash" but continues all the way to "COMMIT_EDITMSG", but at least
>     one shell chokes on this.
>
>     Make sure that the editor-script quotes "$1".

This description of the behavior is misleading (actually, actively
wrong). Shells are not somehow inferring that the space is part of the
redirect filename. The missing piece is that the following all behave
the same:

    echo foo bar >cow
    echo >cow foo bar
    echo foo >cow bar

That is, they all create a file named "cow" with content "foo bar".
So, in your example:

    echo space >/foo/t/trash directory.t7005-editor/.git/COMMIT_EDITMSG

what is actually happening is that it is creating a file named
"/foo/t/trash" with content "space
directory.t7005-editor/.git/COMMIT_EDITMSG".

As for the "ambiguous redirect" diagnostic, that seems to be Bash
trying to be helpful in reporting what is likely a programming error
(that is, forgetting to double-quote the expansion).

  parent reply	other threads:[~2018-09-26 11:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26  6:52 t7005-editor.sh failure Alexander Pyhalov
2018-09-26  7:59 ` Martin Ågren
2018-09-26  9:00   ` Alexander Pyhalov
2018-09-26  9:52     ` Martin Ågren
2018-09-26 10:02       ` Alexander Pyhalov
2018-09-26 11:59       ` Eric Sunshine [this message]
2018-09-26 13:23         ` Martin Ågren
2018-09-26 12:11       ` SZEDER Gábor
2018-09-26 16:14         ` [PATCH] t7005-editor: quote filename to fix whitespace-issue Martin Ågren
2018-09-26 18:14           ` Taylor Blau
2018-09-26 19:21           ` Jeff King
2018-09-26 18:16         ` t7005-editor.sh failure Junio C Hamano
2018-09-26 19:16           ` Junio C Hamano
2018-09-26 19:29             ` Andrei Rybak
2018-09-27 20:53             ` SZEDER Gábor

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=CAPig+cR8KyeihQbUbSP7Awz+NTbf8c3r-ZE9w2wjnvvEpU0gDg@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=apyhalov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=martin.agren@gmail.com \
    --cc=szeder.dev@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.