git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Randall S. Becker" <rsbecker@nexbridge.com>
Cc: "'Git Mailing List'" <git@vger.kernel.org>
Subject: Re: [Patch 1/3] connect.c: add nonstopssh variant to the sshVariant set.
Date: Sat, 05 Jun 2021 04:51:31 +0900	[thread overview]
Message-ID: <xmqqo8cl1k8s.fsf@gitster.g> (raw)
In-Reply-To: <00f101d75978$0074c840$015e58c0$@nexbridge.com> (Randall S. Becker's message of "Fri, 4 Jun 2021 15:29:51 -0400")

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

> The primary
> problem is supplying -S $ZSSH0 on the command line causes $ZSSH0
> to be resolved as a shell variable. It is not.

I think we've heard that one before, and the whole thing sounds like
you are saying that a command line

    $ cmd $ZSSH0

expects ZSSH0 to be a variable and tries to interpolate its value
before passing it to "cmd" while you want "cmd" to see a literal
string that begins with a dollar sign.

And the standard solution to that problem obviously is to tell the
shell that the dollar-sign is not a reference to a variable by
quoting, by using any variant of e.g.

    $ cmd \$ZSSH0
    $ cmd '$ZSSH0'
    $ cmd "\$ZSSH0"

As far as I can tell, the code in connect.c that spawns ssh via
GIT_SSH_COMMAND uses the pretty vanilla run_command() interface,
and that ought to be capable of producing such a command line, so I
am lost as to where the need to have special case comes from.

"cmd" here may be "ssh" but run_command() should not care what exact
command is being invoked.  I am puzzled why a simple quoting like
the following cannot be adjusted for this particular case, for
example:

    $ cat >>.git/config <<\EOF
    [alias]
	cmdtest0 = "!echo ..\\$ZSSH0.."
	cmdtest1 = "!echo ..$ZSSH0.."
    EOF
    $ ZSSH0=foo git cmdtest0
    ..$ZSSH0..
    $ ZSSH0=foo git cmdtest1
    ..foo..


  reply	other threads:[~2021-06-04 19:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30 14:55 [Patch 1/3] connect.c: add nonstopssh variant to the sshVariant set Randall S. Becker
2021-04-30 16:25 ` Elijah Newren
2021-04-30 16:38   ` Randall S. Becker
2021-04-30 17:17     ` Elijah Newren
2021-04-30 17:32       ` Randall S. Becker
2021-05-10 15:24         ` Randall S. Becker
2021-06-04 19:29           ` Randall S. Becker
2021-06-04 19:51             ` Junio C Hamano [this message]
2021-06-04 20:35               ` Randall S. Becker
2021-06-05 21:56               ` Randall S. Becker

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=xmqqo8cl1k8s.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rsbecker@nexbridge.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).