git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Patch 1/3] connect.c: add nonstopssh variant to the sshVariant set.

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 4, 2021, 19:51 UTC
Message-ID
<xmqqo8cl1k8s.fsf@gitster.g>
In-Reply-To
<00f101d75978$0074c840$015e58c0$@nexbridge.com>
"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..
Previous: Randall S. BeckerNext: Randall S. Becker
Message 8 of 10 in “connect.c: add nonstopssh variant to the sshVariant set.”
  1. 1/3 connect.c: add nonstopssh variant to the sshVariant set.Randall S. Becker, Apr 30, 2021
  2. Elijah NewrenApr 30, 2021
  3. Randall S. BeckerApr 30, 2021
  4. Elijah NewrenApr 30, 2021
  5. Randall S. BeckerApr 30, 2021
  6. Randall S. BeckerMay 10, 2021
  7. Randall S. BeckerJun 4, 2021
  8. Junio C HamanoJun 4, 2021
  9. Randall S. BeckerJun 4, 2021
  10. Randall S. BeckerJun 5, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.