diff mbox

[OSSTEST,05/24] tcmd: Work around ssh bug with `ssh host ""'

Message ID 1495105294-25989-5-git-send-email-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Jackson May 18, 2017, 11:01 a.m. UTC
This runs an interactive shell session on the host, rathern than
running `sh -c ""' on it.

Evidently ssh checks for the presence of a command line specification
after (foolishly, but now historically unavoidably) concatenating all
the command line arguments with spaces in between.

Turn  ssh host ""  into  ssh host " "  which is the expected no-op.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
---
 Osstest/TestSupport.pm | 1 +
 1 file changed, 1 insertion(+)

Comments

Roger Pau Monné May 23, 2017, 1:16 p.m. UTC | #1
On Thu, May 18, 2017 at 12:01:15PM +0100, Ian Jackson wrote:
> This runs an interactive shell session on the host, rathern than
> running `sh -c ""' on it.
> 
> Evidently ssh checks for the presence of a command line specification
> after (foolishly, but now historically unavoidably) concatenating all
> the command line arguments with spaces in between.
> 
> Turn  ssh host ""  into  ssh host " "  which is the expected no-op.
>
> Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>

SoB doesn't match "From:", apart from that:

Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Ian Jackson May 23, 2017, 1:53 p.m. UTC | #2
Roger Pau Monné writes ("Re: [Xen-devel] [OSSTEST PATCH 05/24] tcmd: Work around ssh bug with `ssh host ""'"):
> On Thu, May 18, 2017 at 12:01:15PM +0100, Ian Jackson wrote:
> > This runs an interactive shell session on the host, rathern than
> > running `sh -c ""' on it.
> > 
> > Evidently ssh checks for the presence of a command line specification
> > after (foolishly, but now historically unavoidably) concatenating all
> > the command line arguments with spaces in between.
> > 
> > Turn  ssh host ""  into  ssh host " "  which is the expected no-op.
> >
> > Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
> 
> SoB doesn't match "From:", apart from that:
> 
> Acked-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks for the reviews.  Sadly I already pushed this with the wrong
From:.  I'm not sure exactly how that snuck in.  I probably committed
that on my laptop but the tree has a user.email config...

Ian.
diff mbox

Patch

diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 19bdd23..b947a0c 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -676,6 +676,7 @@  sub tcmd { # $tcmd will be put between '' but not escaped
     my ($stdin,$stdout,$user,$ho,$tcmd,$timeout,$extrasshopts) = @_;
     $timeout=30 if !defined $timeout;
     target_adjust_timeout($ho,\$timeout);
+    $tcmd = ' ' if $tcmd eq ''; # ssh host '' logs in !
     tcmdex($timeout,$stdin,$stdout,
            'ssh', sshopts(), @{ $extrasshopts || [] },
            sshuho($user,$ho), $tcmd);