Subject: Re: [PATCH v2] Ensure that SSH runs in non-interactive mode

From: Fredrik Tolf <[email-masked]>
Date: Mon, 21 Jul 2008 15:04:09 +0200

On Mon, 2008-07-21 at 12:22 +0100, Johannes Schindelin wrote:
> Hi,
> 
> On Mon, 21 Jul 2008, Jeff King wrote:
> 
> > On Mon, Jul 21, 2008 at 12:56:14PM +0200, Johannes Schindelin wrote:
> > 
> > > > or syntax used in RPM spec macros
> > > > 
> > > >   %{?p:-P %p}
> > > > 
> > > > (and there is complementing %{!?<var>:<expansion>} in RPM spec macro
> > > > language).
> > > 
> > > Yes, this is overkill.  I would even have passed the port argument 
> > > _always_, since the port 22 for ssh is as likely to change as hell will 
> > > not freeze over.  Actually, I am not so sure about the latter.
> > 
> > But keep in mind that "-p 22" on the command line _overrides_ what the
> > user has in their ssh config, so it is not a good idea to pass it all
> > the time.
> 
> Oh, good point.  So we might need something distasteful as what Jakub 
> proposed... Hrmpf.

Two suggestions:

 * Use %P as I suggested. I know it is kind of ugly, but I might still
   consider it less ugly than adding full shell-style substitution to
   the code. Especially considering that it would almost only have to be
   used inside of Git. Users outside of the Git source would only very
   seldomly have to touch it. (It would essentially only be those users
   who both use alternative SSH ports *and* has an non-standard default
   in their ssh_config *and* use a custom SSH command...)
 * Put the SSH port number and host name in the environment and call
   "/bin/sh -c" with the textual concatenation of the SSH command and
   the command that Git wants to call. While a bit more ugly than
   handling word splitting internally, I don't really think that it has
   any real ill effects, seeing how the Git command is word-split on the
   remote side anyhow (I think that has to be SSH's most stupid
   "feature").

Fredrik Tolf