Commit Graph

203 Commits

Author SHA1 Message Date
Eike Ziller
e7ddd8a5b7 FilePath: Return optional bytearray from device hooks
For differentiating between "error" and "empty file".

Change-Id: I1806bb7386f5e7db28489f9f7e685648bfc20110
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-09-15 11:28:18 +00:00
Marcus Tillmanns
ed46f1f002 linuxdevice: Fix ::bytesAvailable
DeviceShell does not support piping commands at the moment.

To continue to support ::bytesAvailable the parsing of the
output from "df" is moved to FileUtils::bytesAvailableFromDFOutput.

Change-Id: Ia229208748aa6c572b99899e6ae042bdd5654f4a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-09-15 05:21:52 +00:00
Jarek Kobus
0b90c6c6f6 SftpFileTransfer: Don't use temporary file for batch file
Use a "-" for a batch file option "-b" what makes sftp
read batch from standard input.

Fixes: QTCREATORBUG-28167
Change-Id: I449c5ba97ea11fca090b748f0a5ee8099140a548
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-09-14 11:08:59 +00:00
Eike Ziller
9c708b79ce Merge remote-tracking branch 'origin/8.0'
Conflicts:
	src/plugins/remotelinux/killappstep.cpp

Change-Id: I4360e7d0f2c2ac258613933de81e8a9c40387379
2022-09-02 10:12:40 +02:00
Marcus Tillmanns
d4e385de06 Deviceshell: Base64 not found fallback
If no base64 is installed on the target, the shell script
cannot work. Previously this would lead to the shell functions
being unavailable.

This change adds a fallback path. In case no base64 is found,
the shell will create a process for each run request instead.

This is much slower than the shell script, but acceptable as
a fallback.

Change-Id: I70591d7e610c4e1c3c258a8e4bef354221d05cb9
Reviewed-by: hjk <hjk@qt.io>
2022-09-01 13:30:46 +00:00
hjk
7cfc3d26bc Utils: Replace FilePath part setters
... by a combined version. This will make it easier to store the parts
in one QString object.

Change-Id: Ie85a77e3957c78a30e49998fe2e617af35a8ad17
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-01 07:59:29 +00:00
Jarek Kobus
41cefa6a2b LinuxDevice: Fix kill command on remote host
Kill all the processes in the process group.
For more info see:
https://man7.org/linux/man-pages/man1/kill.1.html
https://www.baeldung.com/linux/kill-members-process-group

Fixes: QTCREATORBUG-28072
Change-Id: Id574774d16bc7d3386c6c5f80fb1d305065ec3dc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-31 09:20:40 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
hjk
11648298c8 Utils: Port some FilePath part accessors to QStringView
Change-Id: Ib5cc262e44c73880b6538eed714365e3d685870a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-22 13:27:56 +00:00
hjk
23d9ef1adb RemoteLinux: Convert to Tr::tr
Change-Id: I1c541d392992fb37acecbb98f331e01d7b73fbc7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-22 11:11:48 +00:00
Marcus Tillmanns
3462bc67be filesystem: Add QFSEngine for filepaths
Change-Id: Ibd0c88c69863c0877138d8cc45541530c359bd9c
Reviewed-by: hjk <hjk@qt.io>
2022-07-21 13:14:01 +00:00
hjk
034acdeeb2 RemoteLinux: Inline genericlinuxdeviceconfigurationwidget.ui
Change-Id: I1f93b7886bb8d0217a9e169990e20361e540aec4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-20 09:06:45 +00:00
Marco Bubke
7dc3ff425a RemoteLinux: Fix warning
Change-Id: I644d3f62d25cb89dc054aba3c97a84f5b9afcdff
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-09 12:40:03 +00:00
Marcus Tillmanns
2d82f2173d Ssh: Use DeviceShell in LinuxDevice
Change-Id: I165f888dbb1e7072c35ec88ce5fd8a7ae4562139
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-06-30 10:55:43 +00:00
Eike Ziller
92c74abbf1 Fix lupdate issues
Change-Id: I7256c8aff5eb77b264b76ba24e79c26ab2924e84
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-27 07:05:22 +00:00
Adam Treat
5c0ad89d91 RemoteLinux: Change the displayed names to 'Remote' instead of 'Generic'
Change-Id: I0e6edd24f10c69caf376379e1cec05bf90da9579
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-06-24 15:24:43 +00:00
David Schulz
153ff77a6b Utils: use cleaned stdout all over the place again
Amends 5ee880ce5e

Change-Id: Ie0202db7d8455372c3697087d9571db6706b45a1
Reviewed-by: hjk <hjk@qt.io>
2022-06-17 13:04:42 +00:00
Eike Ziller
fd90cf0a82 Fix debugging on iOS
The RunControl nowadays asks
DeviceManager::deviceForPath(runnable.command.executable) to get the
device, instead of passing that through the runnable.

Since the runnable's command executable is set via
IDevice::filePath(pathOnDevice), where "pathOnDevice" by default is from
the executableAspect, IDevice::filePath should actually return a
"global" path in the form of "device://<device-id>/<path-on-device>".

Since we do not want "device:...." paths for the desktop, return the
simple path in that case only instead.

Fixes: QTCREATORBUG-27709
Change-Id: I75f9406cf3254980e1fee203275b0e72202b7b6d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-06-14 12:59:37 +00:00
Jarek Kobus
0b2899215f Introduce ProcessBlockingInterface
This replaces the ProcessInterface::waitFor...() methods.
It's not obligatory to provide this interface when
implementing ProcessInterface subclass. In this case
generic blocking implementation will be used.

The generic implementation usually isn't as efficient as
the custom one, however, for some sophisticated implementations
of process interface, like e.g. SshProcessInterface, providing
custom implementation is really difficult and error prone.

That's why we try to keep a balance: we provide two custom
implementations for QProcessImpl and for ProcessLauncherImpl,
as they are relatively easy to implement, and rely on
generic implementation for others.

Change-Id: Ifc8bd354479ec67b2e8f74f1510f8de8883e9b94
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-06-14 09:45:28 +00:00
hjk
e3bb14d0d2 Docker/RemoteLinux Fix file size and permission retrieval
When a file path is a link, give the result of the dereferenced
link. This is what QFileInfo does locally.

Change-Id: I26ca1fb70d3391da77f2a5845e5f0a2c0fb73d53
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2022-06-10 08:18:06 +00:00
Jarek Kobus
493573b879 QtcProcess: Make reaper timeout customizable
Add a setter and getter for reaper timeout. This makes it
possible to customize the timeout for the reaper after which it
should call kill() when previous terminate() was unsuccessful.

This setting is also used for QtcProcess::stop().

Change-Id: I653a3ad107ae4173bb8254c85cfc07886bf6a9c6
Reviewed-by: hjk <hjk@qt.io>
2022-06-08 11:21:42 +00:00
Jarek Kobus
a7fa8c46ee LinuxProcessInterface: Fix error reporting on failed to start
Change-Id: I2af4a13289458e6270452a254cf90f7bd9cc3684
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-31 08:12:48 +00:00
Jarek Kobus
8a1f091bf0 SftpFileTransfer: Fix error reporting
Use "-b" option of sftp command for providing batch file
instead of setting a standard input file for sftp process.

In order to fix showing the authentication dialog
we explicitly pass -o BatchMode=no before the "-b" option,
which should re-enable the interactive mode before
processing batch file.

Change-Id: Iaf3c93929c08fd61373003e394a08439d05fe27e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-31 08:12:33 +00:00
Jarek Kobus
7d848364ff Move FileTransfer into ProjectExplorer plugin
Make it ready for providing implementations for other devices.

Change-Id: I14eaf167a7b2c1189f4d23f2e9f556204295b9b3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-30 10:10:33 +00:00
Jarek Kobus
576f49df24 FileTransfer: Don't crash when used for non-linux device
Don't crash when start() was called for non-linux device.

Change-Id: I1722ea420ed0fe74418c1c9a6f8702ae079b7bd7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-30 09:08:14 +00:00
Jarek Kobus
c0333b2b68 FileToTransfer: Hide transferDirection from public API
Change-Id: I3df5a7f7d156385b8a6ba1cf0c9b4a216508dc20
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-30 09:05:18 +00:00
Jarek Kobus
08350cb8ae SshSharedConnection: Get rid of connectionOptions()
Change-Id: Ieb7da550183aa57db3dd6d0b714c1e66e46d38e6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-30 09:03:17 +00:00
Jarek Kobus
6b07b84bcd FileTransfer: Handle shared ssh connection
Change-Id: I251bdc4e8c9e8dd47fca24ecdb80239315d9e854
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-30 09:00:54 +00:00
Jarek Kobus
78d8dd8997 LinuxDevice: Fix starting a shell with SSH_ASKPASS
Change-Id: I11a8a477a1f9796ceb021037b781da2ca8d87f43
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-30 08:53:01 +00:00
Jarek Kobus
9db911ae12 Get rid of Ssh lib
Move the rest to ProjectExplorer plugin.

Change-Id: Id2f022359e7e01728779228ea1f7f0b05a81c8e4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-23 18:21:28 +00:00
Jarek Kobus
87f3e7563c Ssh: Rename SshConnectionParameters into SshParameters
Move it to its own header.
Get rid of SshConnection and SshConnectionManager,
as they are not used anymore.

Change-Id: I52fe20d7816ea57e7a7158ab2ae9565d50a76e21
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-23 12:03:39 +00:00
Jarek Kobus
79cacd354d FileTransfer: Make it possible to call stop() from done() handler
Don't delete the TransferInterface directly from stop().
Disconnect from it and delete it later.

Fix emitting done() signal when error occurred.

Fix passing the proper enum to RsyncTransferImpl.

Set proper parent for TransferInterface.

Change-Id: I430f0bf2507de8a9b7fb610641ca86e37ccd80d9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-20 09:19:42 +00:00
Jarek Kobus
dcc93253c8 FileTransfer: Add some static helpers
Change-Id: Ie22e7ecce52b308df32316ff85d4744bd26060b0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-17 12:55:20 +00:00
Jarek Kobus
80ae9c357d FileTransfer: Add test() method
The test() method doesn't try to transfer anything,
it just tests if the transfer itself work.
In contrast to start() method, the FilesToTransfer
list may be empty and test() method will not issue
an assert.

Change-Id: I719cfbaddc5e33d6a7cc660ef6aa0bbcb61c5bce
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-17 10:19:10 +00:00
Jarek Kobus
819d6ad753 Implement RsyncTransfer
Change-Id: I07a9139bc5280a4f4b16181121ce7ab907493e72
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-16 17:27:42 +00:00
Jarek Kobus
7cca6cd718 FileTransfer: Make the usage more convenient
Prepare the API for rsync implementation.

Change-Id: I13b7def31c2e2b1460d18340f6bd7cbd8e0e9434
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-16 17:27:29 +00:00
hjk
6ea8a76e44 Utils: Consolidate port parsing methods
Change-Id: I137e9faa2c5f18e9ade0e2c59d73811d682abf13
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-16 08:43:16 +00:00
Jarek Kobus
f8d637dc71 LinuxDevice: Add createFileTransfer() method
The method returns FileTransfer object. This should substitue
SftpTransfer. It is going to handle rsync transfer, too.

Change-Id: I082cf21581ac387e42bb3594604facafe32d7492
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-16 08:40:52 +00:00
hjk
7f2288d9cc ProjectExplorer: Avoid need to fix up portsgatherer command lines
... by creating them with the right device to start with.

Change-Id: Ib2f0f10b67322fe66a609287a629d3d720d83c93
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-05-12 06:23:45 +00:00
Jarek Kobus
49ddf8434f LinuxProcessInterface: Fix kill command
Amends f62a4d6315

Change-Id: Ib4efa3e0b9e0f4f945e338a85463b3e26fd056a1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-11 11:06:27 +00:00
hjk
dfe0776002 RemoteLinux: Avoid two explicit uses of IDevice::mapToGlobalPath()
Change-Id: I5e1e3f3de1118234dcaf1faa5690662876e85b4c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-05-11 10:21:23 +00:00
hjk
e657bc8781 Utils: Introduce QtcProcess::controlEnvironment()
... and drop QtcProcess::removeEnvironment()

This shifts the meaning of the unqualified QtcProcess::environment()
to always refer to (possibly remote) "main" process this QtcProcess
wraps. The controlEnvironment is now referring to secondary helper
processes (if any...) typically(?) running on the host system.

This helps to avoid local/remote distinctions in some places.

Change-Id: Ib7cd15dd226617484b5358acd7deaed29e751883
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-05-10 09:53:53 +00:00
Jarek Kobus
d8ee25ec3d Move setupSshEnvironment() into SshConnectionParameters
As we are going to remove SshRemoteProcess.

Change-Id: I07cf246791f1adb6cfc454935d7e330c2f1d4dc7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-05-09 07:42:02 +00:00
Jarek Kobus
c056c5c4b4 LinuxDevice: Don't include sshremoteprocessrunner.h
The SshRemoteProcessRunner is going to be removed soon.
Replace this include with what we are using currently.

Change-Id: I0d13586390b60ca9545f124a4db24eb90f4369d7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-05-05 08:59:15 +00:00
Jarek Kobus
70e8e1b530 LinuxDevice: Fix error reporting from shared connection
If the master ssh connection can't start, e.g. because
no public key was uploaded to the remote device, report the
standard error of master process as error string.

Fix the "if" condition in handleDisconnected().

Change-Id: I9ba821136a1755d3460e47ce6f25d3684445890f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-05 07:46:17 +00:00
Jarek Kobus
e9fb604812 LinuxProcessImpl: Buffer standard error until started() is emitted
Change-Id: I1ee469a918ff95eeeb5038a4c2021469c429a269
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-04 11:37:44 +00:00
Jarek Kobus
da0f950821 RemoteLinuxSignalOperation: Don't use SshRemoteProcessRunner
Use QtcProcess with a path on device instead.

Change-Id: I14a557f61414a12dabc19e3b2f8c9c277ecfb52d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-04 10:05:00 +00:00
Jarek Kobus
85cb7d2b71 Get rid of IDevice::createProcess()
And most of QtcProcess subclasses.

Change-Id: Ic891defbf49736442243f9ee0f9d28d140e0ba9d
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-04 08:28:15 +00:00
Jarek Kobus
340b61889d SshProcessInterface: Remove pidArgumentForKill()
This interface method wasn't really sensible.

Change-Id: Ia47c893886ec06a2263b96d161578d46d2df5ffa
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-04 08:27:26 +00:00
Jarek Kobus
8e931838ef Get rid of SshConnectionInfo
It's not used anymore.

Change-Id: Ie77c9d9bc8eb82c1f74cfdac2304bc6c2f92ee93
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-03 14:38:23 +00:00