git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Randall S. Becker" <rsbecker@nexbridge.com>
Cc: "'Andreas Schwab'" <schwab@linux-m68k.org>,
	"'SZEDER Gábor'" <szeder.dev@gmail.com>,
	"'Ævar Arnfjörð Bjarmason'" <avarab@gmail.com>,
	git@vger.kernel.org, "Bill Honaker" <bhonaker@xid.com>
Subject: Re: [BUG] GIT_SSH_COMMAND is not being decomposed
Date: Tue, 16 Apr 2019 13:24:49 +0900	[thread overview]
Message-ID: <xmqqsguipofi.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <008101d4f3db$56c20410$04460c30$@nexbridge.com> (Randall S. Becker's message of "Mon, 15 Apr 2019 18:34:02 -0400")

"Randall S. Becker" <rsbecker@nexbridge.com> writes:

> As a suggestion, with people who know how to escape stuff properly
> (or not), perhaps we can select the alternate behaviour explicitly
> using a core.sshIgnoreEscape=true/false option. Thoughts on that?

The semantics of prepare_shell_cmd() is, regardless of any "funny
characters" on the command line, the spawned command MUST behave AS
IF it was run via the shell.  The strcspn() trick is there merely as
a low-level optimization so that we do not have to say

	sh -c a-single-token

which would be exactly the same as running

	a-single-token

The most typical use of that strcspn() trick is to ensure that

	GIT_SSH_COMMAND="the-command and its arguments"

would not attempt to run a command with a long and funny name
"the-command and its arguments" somewhere on the $PATH without any
parameter, and instead run

	sh -c "the-command and its arguments"

i.e. run the "the-command" with three parameters (and perhaps more
built-in parameters prepared by the caller in the ssh connection
codepath).

  reply	other threads:[~2019-04-16  4:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-13 20:27 [BUG] GIT_SSH_COMMAND is not being decomposed Randall S. Becker
2019-04-13 20:39 ` Ævar Arnfjörð Bjarmason
2019-04-13 20:57   ` Randall S. Becker
2019-04-13 21:47   ` SZEDER Gábor
2019-04-14 14:34     ` Randall S. Becker
2019-04-15 19:20     ` Randall S. Becker
2019-04-15 21:14       ` Andreas Schwab
2019-04-15 22:34         ` Randall S. Becker
2019-04-16  4:24           ` Junio C Hamano [this message]
2019-04-15 21:30       ` Johannes Sixt

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqsguipofi.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=bhonaker@xid.com \
    --cc=git@vger.kernel.org \
    --cc=rsbecker@nexbridge.com \
    --cc=schwab@linux-m68k.org \
    --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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).