Commit 90fb5534 authored by bonnell's avatar bonnell

Fix problem setting ssh command in a host profile when running on Windows.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@27808 18c085ea-50e0-402c-830e-de6fd14e8384
parent 4d25af16
......@@ -1900,6 +1900,9 @@ RemoteProcess::CreatePortNumbers(int *local, int *remote, int *gateway, int nPor
// on Windows since qtssh requires it on Windows and will prompt for it if
// it doesn't have it.
//
// Kathleen Biagas, Wed Dec 16 13:34:01 MST 2015
// Don't enclose the command in quotes if it already is quoted.
//
// ****************************************************************************
void
......@@ -1928,7 +1931,7 @@ RemoteProcess::CreateSSHCommandLine(stringVector &args, const MachineProfile &pr
// name in quotes. This is mostly so the ssh program runs correctly
// on Windows when VisIt is installed into a path containing spaces.
std::string &sshcmd = ssh[0];
if(sshcmd.find(" ") != std::string::npos)
if(sshcmd[0] != '\"' && sshcmd.find(" ") != std::string::npos)
{
std::string q("\"");
sshcmd = (q + sshcmd + q);
......
......@@ -696,6 +696,11 @@ QvisHostProfileWindow::downloadHosts(QNetworkReply *reply)
// Brad Whitlock, Wed Aug 15 13:58:14 PDT 2012
// I added ssh command.
//
// Kathleen Biagas, Wed Dec 16 11:07:43 MST 2015
// Replace slot 'sshCommandChanged' with 'sshCommandRetPressed', so that
// sshCommand is only processed once editing has finished. Will be
// triggered by 'returnPressed'/'editingFinished' signals from the widget.
//
// ****************************************************************************
QWidget *
......@@ -860,8 +865,10 @@ QvisHostProfileWindow::CreateMachineSettingsGroup()
sshCommand = new QLineEdit(connectionGroup);
sshCommandCheckBox = new QCheckBox(tr("SSH command"), connectionGroup);
connect(sshCommand, SIGNAL(textChanged(const QString &)),
this, SLOT(sshCommandChanged(const QString &)));
connect(sshCommand, SIGNAL(returnPressed()),
this, SLOT(sshCommandRetPressed()));
connect(sshCommand, SIGNAL(editingFinished()),
this, SLOT(sshCommandRetPressed()));
connect(sshCommandCheckBox, SIGNAL(toggled(bool)),
this, SLOT(toggleSSHCommand(bool)));
cLayout->addWidget(sshCommandCheckBox, cRow, 0, 1, 2);
......@@ -2362,6 +2369,10 @@ QvisHostProfileWindow::UpdateWindowSensitivity()
// David Camp, Mon Aug 4 10:46:09 PDT 2014
// Added the threads option.
//
// Kathleen Biagas, Wed Dec 16 11:07:43 MST 2015
// Ensure quoted sshCommand is preserved, split args on ' ' only after the
// end of the quoted command.
//
// ****************************************************************************
bool
......@@ -2724,11 +2735,32 @@ QvisHostProfileWindow::GetCurrentValues()
temp = sshCommand->text();
stringVector newCommand;
QStringList cmd(temp.split(' '));
for(int i = 0; i < cmd.size(); ++i)
newCommand.push_back(cmd[i].toStdString());
if (currentMachine->GetSshCommand() != newCommand)
needNotify = true;
if (temp.startsWith('\"'))
{
if (temp.endsWith('\"'))
{
newCommand.push_back(temp.toStdString());
}
else
{
// split into command and args.
int pos = temp.indexOf("\"", 1);
QString cmd(temp.left(pos+1));
newCommand.push_back(cmd.toStdString());
QString args(temp.right(temp.size()-pos-2));
QStringList arglist(args.split(' '));
for(int i = 0; i < arglist.size(); ++i)
newCommand.push_back(arglist[i].toStdString());
}
}
else
{
QStringList cmd(temp.split(' '));
for(int i = 0; i < cmd.size(); ++i)
newCommand.push_back(cmd[i].toStdString());
if (currentMachine->GetSshCommand() != newCommand)
needNotify = true;
}
currentMachine->SetSshCommand(newCommand);
}
......@@ -4043,32 +4075,56 @@ QvisHostProfileWindow::toggleSSHCommand(bool state)
}
// ****************************************************************************
// Method: QvisHostProfileWindow::sshCommandChanged
// Method: QvisHostProfileWindow::sshCommandRetPressed
//
// Purpose:
// Change the remote ssh command for all profiles with the
// same remote host name based on a changed widget value.
//
// Arguments:
// command : The string indicating the ssh command.
//
// Programmer: Brad Whitlock
// Creation: Wed Aug 15 14:16:42 PDT 2012
//
// Modifications:
// Kathleen Biagas, Wed Dec 16 11:07:43 MST 2015
// Changed name to sshCommandRetPressed, removed arg.
// Ensure quoted command is preserved, split args on ' ' only after the
// end of the quoted command.
//
// ****************************************************************************
void
QvisHostProfileWindow::sshCommandChanged(const QString &s)
QvisHostProfileWindow::sshCommandRetPressed()
{
if (currentMachine == NULL)
return;
QString s(sshCommand->text());
stringVector newCommand;
QStringList cmd(s.split(' '));
for(int i = 0; i < cmd.size(); ++i)
newCommand.push_back(cmd[i].toStdString());
// preserve surrounding quotes if present
if (s.startsWith('\"'))
{
if (s.endsWith('\"'))
newCommand.push_back(s.toStdString());
else
{
// split into command and args.
int pos = s.indexOf("\"", 1);
QString cmd(s.left(pos+1));
newCommand.push_back(cmd.toStdString());
QString args(s.right(s.size()-pos-2));
QStringList arglist(args.split(' '));
for(int i = 0; i < arglist.size(); ++i)
newCommand.push_back(arglist[i].toStdString());
}
}
else
{
QStringList cmd(s.split(' '));
for(int i = 0; i < cmd.size(); ++i)
newCommand.push_back(cmd[i].toStdString());
}
currentMachine->SetSshCommand(newCommand);
}
......
......@@ -173,6 +173,11 @@ class QNetworkAccessManager;
// David Camp, Mon Aug 4 10:46:09 PDT 2014
// Added controls to set the threads option.
//
// Kathleen Biagas, Wed Dec 16 11:07:43 MST 2015
// Replace slot 'sshCommandChanged' with 'sshCommandRetPressed', so that
// sshCommand is only processed once editing has finished. Will be
// triggered by 'returnPressed'/'editingFinished' signals from the widget.
//
// ****************************************************************************
class GUI_API QvisHostProfileWindow : public QvisPostableWindowObserver
......@@ -255,7 +260,7 @@ private slots:
void toggleSSHPort(bool);
void sshPortChanged(const QString &port);
void toggleSSHCommand(bool);
void sshCommandChanged(const QString &port);
void sshCommandRetPressed();
void toggleUseGateway(bool);
void gatewayHostChanged(const QString &port);
void clientHostNameMethodChanged(int);
......
......@@ -31,6 +31,7 @@ enhancements and bug-fixes that were added to this release.</p>
<li>Re-enable Adaptive csg capability for Windows, which was inadvertently disabled for previous release.</li>
<li>Fixed a bug with the PF3D reader where the time and cycle were reported as zero for all the time states accessed after the initial time state accessed.</li>
<li>Fixed a bug preventing the reading of DOS-formatted .visit files on Linux</li>
<li>Fixed bug whereby setting 'ssh command' would not work correctly on Windows. If path to ssh contains spaces, the full path and command need to be surrounded in double-quotes, eg <i>"C:\Program Files (x86)\Putty\plink.exe"</i>. If manually adding this to an .xml host profile, The quotes and path-separators should be escaped: <i>"\"C:\\Program Files (x86)\\Putty\\plink.exe\""</i></li>
</ul>
<a name="Enhancements"></a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment