RemoteLinux: Let sftp work on the last hop

... even if the final target is not directly accessible.

This does not affect existing use cases but allows one more:
DesktopDevice --ssh--> Source/Build --sft--> RunDevice, with
the RunDevice not directly accessible from the Desktop.
That setup exists in reality for our QNX CI machines.

Change-Id: I5cda28cc835af914f2438f99d6a3facf584c74c6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2023-04-06 13:20:55 +02:00
parent 20a4954cbd
commit 6b661ef1be

View File

@@ -1174,6 +1174,8 @@ protected:
connect(&m_process, &QtcProcess::done, this, &SshTransferInterface::doneImpl);
}
IDevice::ConstPtr device() const { return m_device; }
bool handleError()
{
ProcessResultData resultData = m_process.resultData();
@@ -1281,7 +1283,13 @@ public:
private:
void startImpl() final
{
const FilePath sftpBinary = SshSettings::sftpFilePath();
FilePath sftpBinary = SshSettings::sftpFilePath();
// This is a hack. We only test the last hop here.
const Id linkDeviceId = Id::fromSetting(device()->extraData(Constants::LinkDevice));
if (const auto linkDevice = DeviceManager::instance()->find(linkDeviceId))
sftpBinary = linkDevice->filePath(sftpBinary.fileName()).searchInPath();
if (!sftpBinary.exists()) {
startFailed(Tr::tr("\"sftp\" binary \"%1\" does not exist.")
.arg(sftpBinary.toUserOutput()));