From 6b661ef1bed853acaa5a4006f9ba32a53ac465df Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 6 Apr 2023 13:20:55 +0200 Subject: [PATCH] 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 --- src/plugins/remotelinux/linuxdevice.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index b17ed8fcf78..97b6412e6c2 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -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()));