Commit Graph

131 Commits

Author SHA1 Message Date
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
Marcus Tillmanns
c8024046f9 Docker: implement process interface
Change-Id: I57dd9e060ee35280b663611ebb5ddef20b7d0eb7
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-05-03 08:26:13 +00:00
Jarek Kobus
1a3cb067b8 SshProcessInterface: Give a parent to subobject
This is needed when moving ProcessInterface beweeen threads.

Change-Id: I26158c68bdc8e77ecb3e3d4535ba767ef3d0b63c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-03 06:59:36 +00:00
Jarek Kobus
709492ef11 LinuxDevice: Use LinuxProcessImpl for opening terminal
Don't use SshDeviceProcess anymore for opening linux terminal.
Fix running the empty command so that it opens ssh shell.
Don't leak terminal processes on shutdown.

One issue is that terminals are closed when closing settings,
as settings dialog operate on a copy of device, and in case
of no modifications applied the copy is being deleted.
The current workaround is to press the "Apply" button
before closing the settings dialog. This issue is to be
addressed separately.

Change-Id: I3c48b035daf1d099a1e8fa0762a6d6d0eca9592c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-04-29 15:57:20 +00:00
Jarek Kobus
cdae5bdebd LinuxDevice: Don't use SshRemoteProcess for shell
Use simple QtcProcess for it.

Change-Id: Ie73a287cc4bf37a0fba273f3fe355626ff1c27f6
Reviewed-by: hjk <hjk@qt.io>
2022-04-28 15:13:41 +00:00
Jarek Kobus
d1d2477605 LinuxDevice: Restart shell when ssh parameters changed
Change-Id: I96fa7de4f8314ccd3c78bee165b722fdbba6e8d0
Reviewed-by: hjk <hjk@qt.io>
2022-04-28 13:57:08 +00:00
hjk
aa3bdcb427 Utils: Add a QString-based write to QtcProcess
Centralize some boiler plate and warn about best-guessed cases.

Keep the QByteArray based access as writeRaw()

Fixes: QTCREATORBUG-27445
Change-Id: I948d80fba78b36cf85cc73664175ab05eb7707d4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-04-28 08:20:11 +00:00
Jarek Kobus
8d2c9aa8d4 LinuxDevice: Implement shared ssh connection
Change-Id: I1897f0a468e477e0be61767d4bad0086d59fb075
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-04-26 17:36:01 +00:00
Jarek Kobus
ec4fb84f8d LinuxDevice: Connect to QtcProcess::done() signal
Instead of connecting to errorOccurred() and finished() signals.

Change-Id: I939927b68e84b32455a914cef26200b4edcbcbb6
Reviewed-by: hjk <hjk@qt.io>
2022-04-14 13:12:52 +00:00
Jarek Kobus
6e666b3bfd Introduce DeviceFileSystemModel
This is going to replace SftpFileSystemModel.

That's needed before planed removal of SshConnection in order
to not to use SftpSession class.

Change-Id: I97f0ffd3418f7e71819ac95048a75e4a17901c71
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-04-08 06:39:28 +00:00
Jarek Kobus
13013acf3a Finish the shell process on shutdown, before deleting it
Change-Id: I62f3754325da9141e5ab870ff4750109a836b092
Reviewed-by: hjk <hjk@qt.io>
2022-03-31 10:26:14 +00:00
Jarek Kobus
c94564d910 LinuxDevice: Get rid of a marker for outputForRunInShell()
Don't rely on a synthetic marker when running a shell
command and expecting any output. The marker might always
be a part of the output data from the running command.
That's unreliable.

A solution is to do a similar thing that we are doing
inside runInShell(). We ignore the error channel there,
so it means that when calling outputForRunInShell() we
have two channels for our purposes. So, the output from
the command we pass through, and its error channel we
redirect to /dev/null. Later, we run "echo $?", which
prints the return code from the last command and we
redirect it to standard error channel. Inside
outputForRunInShell() we read the error channel as long
as we detect something there. We assert if it's being
convertible to int and we also assert that the command
itself succeeded. Afterwards we break the endless loop
and read the output channel for the first time - it
should contain all the output gathered from the running
command.

Change-Id: Ia0ad73623f813ef593c11dff9bdba4df9e524315
Reviewed-by: hjk <hjk@qt.io>
2022-03-21 11:32:31 +00:00
Eike Ziller
b6f679d777 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/plugins/webassembly/webassemblytoolchain.cpp

Change-Id: Ia75c783e3ecab1f97de2b5c73a0979c49da82009
2022-03-18 16:07:51 +01:00
Christian Stenger
7012aa621c RemoteLinux: Allow open remote shell from Windows as well
Was originally restricted to UNIX hosts, but works for Windows
as well.

Change-Id: I233ec73760134256723a927de5e9e6cc9aefa8ac
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-03-18 14:39:30 +00:00
Jarek Kobus
481df466e2 Fix FileSystemAccessTest::testFileActions() flakiness
Always add " > /dev/null 2>&1" infix so that the
output of e.g. "rm" command, when failed, is redirected
to dev/null.

Enclose the input data in runInShell() with quotation
marks and escape all the characters in passed data
accordingly. Pass the "-e" option to echo in order to
turn on the escaping mode.

Add a new test for testCreateRemoteFile().

Change-Id: I7db07b57035242279cac7dd77a80ac6dd05bfb1f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-03-18 08:36:59 +00:00
Jarek Kobus
4bb4bc2a99 Use ProcessInfo instead of DeviceProcessItem
Remove DeviceProcessItem class.

Change-Id: I2fcac473dc12b47f50c329645f27d60619304e77
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-02 09:53:29 +00:00
Jarek Kobus
8af62eb256 DeviceProcess: Minimize the usage of DeviceProcess
DeviceProcess doesn't provide any public API, so
replace all usages of it with QtcProcess.
Keep using DeviceProcess only for reimplementations.

Change-Id: I35a14251a81dd0dde426f56ca2e809b527cc863c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-28 13:10:42 +00:00
Jarek Kobus
098e3794db Get rid of SshProcess (one process class less)
Introduce static SshRemoteProcess::setupSshEnvironment()
method instead.

Change-Id: I9a49bc68bd96ddf0f58234d28b92a721f7d4bb56
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-21 16:17:31 +00:00
Jarek Kobus
48960b5cfc QtcProcess: Extract QtcProcess specific enums into separate header
Change-Id: Ib3498f189000fd8f5501130c0d280b0f5ae83849
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-02-18 10:51:55 +00:00
Jarek Kobus
97264e0591 Ssh: Drop ProcessMode from c'tors and creator methods
Change-Id: I2db51f26d9a841f60d5ab3722fa82b3a89d57146
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-02-18 10:49:29 +00:00
hjk
f7a585fad9 FileUtils: Add some helper to handle ls-style output
Unix-ish device implementations would otherwise repeat that code.

Change-Id: I1265fe1a69e55409ab2875d0b6f6113ec92edd79
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-02-15 08:57:19 +00:00
hjk
95c9579c58 ProjectExplorer: Normalize DeviceProcess::start() signature
Change-Id: I2915be34d4a1eed64567874dcf0263b7583cc142
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-02-14 15:10:12 +00:00
hjk
e2cb64471a Utils: Move QtcProcess constructor setup data to shared setup data
This includes replacing DeviceProcess terminal handling with base
member.

Change-Id: Id1541bfce33c71dddc71b4816ad0b174dce3879c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-02-11 17:33:48 +00:00