summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/remoteserverconnection.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix IFW build with Qt version 6.7.xKatja Marttila2024-05-081-1/+5
| | | | | Change-Id: Ida10f40ee58db9ea8282c46a940d1ef12e81ba93 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Enable building with Qt6.2Katja Marttila2023-09-251-2/+2
| | | | | | Task-number: QTIFW-3083 Change-Id: I66f3d1feb89c683f8763c5dee587ed73a2115e04 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Fix tests built with Qt6Katja Marttila2023-06-081-1/+2
| | | | | | | | | Due to api changes in Qt6 versus Qt5 we need minor changes to both tests and to IFW itself. Task-number: QTIFW-3064 Change-Id: I7e08161db074c96a6d639a2ff8b4c3d73f59e3cf Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Adapt to changes in QAbstractFileEngineKatja Marttila2023-04-171-1/+10
| | | | | | Task-number: QTIFW-1829 Change-Id: I72e814cfcf852e8de47f0e772abdcb0ad9eba38f Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Adapt to differences in QProcessChristian Stenger2022-12-191-1/+1
| | | | | | | | Use the start() function available in Qt5 and Qt6. Task-number: QTIFW-1829 Change-Id: Idab1b18d24ca7fb615a99b297a53495dbf3547c8 Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Adapt to removal of qMakePair and qVariantFromValueChristian Stenger2022-12-191-4/+4
| | | | | | Task-number: QTIFW-1829 Change-Id: I2291dee3c5bf0f10627f07e71624d7e669737f9a Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
* Doc: fix "Cannot tie this documentation to anything" warningArttu Tarkiainen2022-10-141-0/+2
| | | | | Change-Id: I4cbdf230b6c3883a0ca9e11d8dc6504a49cf0afb Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Replace .vbs hack to update maintenance tool binary on WindowsArttu Tarkiainen2022-09-071-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | Do the replacing of the executable instead by: - The original MT renames itself to a temporary name - The new MT is renamed to the destination file name - The new MT is started as a detached process, it polls to delete the temporary MT (requires that the parent process exited) Introduce hidden options, cleanup-update and cleanup-update-only to start the maintenance tool in a mode for deleting the old binary. Also fix missing verbose messages on hard restart of maintenance tool after update. Due to QProcessWrapper::startDetached using a modified implementation of the wrapped class (QProcess) method, the detached process was started with a new console instead of inheriting the console of the parent process. Fix by adding a second variant of the QProcessWrapper::startDetached functions using the QProcess implementation. Task-number: QTIFW-2625 Change-Id: Iebc5b04befa1e79765217f93723f977556e03d90 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* RemoteObject: require server reply for all client commandsArttu Tarkiainen2022-05-301-97/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For classes supporting the remote-client-server protocol through inheritance of the QInstaller::RemoteObject class: when calling functions of return type void, the client process did not block and wait for the server process to finish execution of the corresponding function, only checking that the packet containing the function command and arguments was written to the socket. The server-side connection thread operates in a loop that tries to read a packet from the socket in each iteration, and process the contained command, with the condition that the socket is still in connected state. If the function calls requested by the commands take long time to execute and we destruct the client-side object, disconnecting the socket, the server thread could break out of the loop before handling all pending packets. This hasn't been a problem for non-void functions because the server will send a return value reply and the client would block until the sent packet was available. Fix by refactoring the server connection code to send a default reply for commands not requiring a real return value, and blocking the client until the reply can be read. Task-number: QTIFW-999 Change-Id: Ie1d0e118e6830a1049a2ad50cc80b54c967fcde6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* Add support for parallel extraction of component archivesArttu Tarkiainen2022-04-211-38/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce ConcurrentOperationRunner class used for running installer operations concurrently in the global thread pool. Add execution groups for operations; Unpack operations are run concurrently for all components requesting installation, operations belonging to Install group are run sequentially for sorted components one at a time as before. From the default registered operations the Extract op is moved to Unpack group. Move the previously on-the-fly backup steps of Extract operation to the ExtractArchiveOperation::backup(), so that backups are done before any archives are extracted, and that we know if any of the archives requires administrator privileges to unpack. Reparent QInstaller::Error to QException to support throwing and catching exceptions across thread boundaries. Use RAII for the server-side objects of the classes supporting the remote client-server protocol of installer framework. The concurrent extraction revealed that it was still possible that the local socket was disconnected and thus the RemoteServer- Connection thread finished before receiving and processing the final "Destroy" command packet, leaking the dynamically allocated objects. Task-number: QTIFW-2566 Change-Id: Ib8c2928b9405b7b3465c731018df73acb51e949f Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* Add support for seeking files handled with libarchiveArttu Tarkiainen2021-10-261-0/+4
| | | | | | | | | | | | | | | | | | | This fixes losing executable bits of files in Zip archives when extracted. Zip archives store file metadata in two ways, partial metadata per-entry and full metadata at the end of archive. IFW's read implementation previously did only streaming without support for seeking archives, which is required to obtain full metadata - meaning the partial metadata was used instead by libarchive's Zip reader. The extracted entries between the two metadata types are not consistent. This change also enables usage of archive formats that cannot be accurately handled with a streaming model, like 7zip which needs to read key data from the end of the file before reading file data from the beginning. Task-number: QTIFW-2372 Change-Id: Ie4ed33040fc52de073546e46d9da726816f47a81 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* Add support for handling archive files with libarchiveArttu Tarkiainen2021-09-141-7/+96
| | | | | | | | | | | | | | | | | | | | | | libarchive is a multi-format archive and compression library written in C and licensed under the new BSD license. Usage of libarchive brings in support for additional archive formats (in addition to 7z) with the installer framework, like zip and tar, with several available compression methods like gzip, bzip2 and xz. libarchive will coexist as a supported archive format handler with the LZMA SDK currently used in the framework, which will continue to be used for handling the 7-Zip file format. This change introduces classes for handling archive operations using both libraries, removes most calls to the old Lib7z facade and migrates the code base to use the new handling methods. Task-number: QTIFW-2255 Change-Id: I8d77110ded503060495a3d6fdfdbc26281df9453 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* Doc: Remove internal classes and structs from generated documentationArttu Tarkiainen2020-09-211-0/+12
| | | | | | | | | | After migration to using 5.12.7 based qdoc, the generated documentation contains also empty declarations for members of undocumented internal classes. Mark them internal as needed. Task-number: QTIFW-1483 Change-Id: Iad40e4efdd098f09a825ce1c8d0aafcc76bd83bf Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* Use of QLoggingCategoryKatja Marttila2020-02-131-5/+6
| | | | | | | | The change enables easier filtering of log messages Change-Id: I769f7c163e20f34c37fa0fe2b0729867ffca5bcb Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io> Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Enable support for Qt 5.12 in installer frameworkArttu Tarkiainen2019-08-221-0/+7
| | | | | | | | | | | | | | | | | Workaround issues of IFW not being able to work on elevated mode caused by changes in qtbase, namely when initializing socket connection between remote installer client and server, and writing maintenance tool binary. Switch to using unbuffered mode for QFSFileEngine instances as buffered mode support has been dropped. Fix calls to QFile::copy() when running elevated installer process. Make minor modifications for unit tests to pass. Explicitly fail and return when performing CreateLocalRepositoryOperation on non-owned directory. Task-number: QTIFW-1312 Change-Id: I3db72547ee95c87d8c02d27e5b31c7b30e793431 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
* Replace 0 with nullptrKatja Marttila2019-01-091-5/+5
| | | | | | | Prevents a lot of warnings seen in QtCreator Change-Id: I63bf95aca68a04fc9fd0eecbe29c63e9b9c47efd Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
* Merge remote-tracking branch 'origin/2.0'Katja Marttila2017-01-301-17/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Changelog dist/config/config.xml dist/packages/org.qtproject.ifw.binaries/meta/package.xml dist/packages/org.qtproject.ifw/meta/package.xml installerfw.pri src/libs/installer/lib7z_create.h src/libs/kdtools/kdgenericfactory.cpp src/libs/kdtools/kdgenericfactory.h src/libs/kdtools/kdupdaterapplication.cpp src/libs/kdtools/kdupdaterapplication.h src/libs/kdtools/kdupdaterupdatesourcesinfo.cpp src/libs/kdtools/kdupdaterupdatesourcesinfo.h src/libs/kdtools/localpackagehub.cpp src/libs/kdtools/localpackagehub.h src/libs/kdtools/updatefinder.cpp src/libs/kdtools/updatefinder.h tools/binarycreator/resources/mkdmg.sh Change-Id: Iab2513f549832d2e750e77131c673457ab265af4
| * License header update to GPL-EXCEPTKatja Marttila2017-01-261-17/+12
| | | | | | | | | | Change-Id: I6426c4e8f932cf26c6c638dec18d0c12e22972d1 Reviewed-by: Janne Anttila <janne.anttila@theqtcompany.com>
* | Revert "Windows: Fix crashes in elevated installation"Katja Marttila2016-05-201-2/+1
| | | | | | | | | | | | | | | | This reverts commit 95ae661cba931a982d12cd68d8b4da392d74bdd0. As we now require at least Qt5.5.0 we don't need this workaround Change-Id: I6ab930886bc9af0716a61a8e21b12db83018b0c2 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* | Fixed handling of Destroy command in server processFrerich Raabe2016-04-071-2/+2
|/ | | | | | | | | Destroying QProcess or QAbstractFileEngine objects never worked, since the code for deciding what type of object is to be destroyed confused the 'type' with the 'command'. Change-Id: I8d6c6bf2f11ff82cfbd744c43fcc91d234967b69 Reviewed-by: Katja Marttila <katja.marttila@theqtcompany.com>
* Update license headersIikka Eklund2015-12-291-4/+3
| | | | | | | | | Update existing license headers. LGPL -> LGPLv21. Update copyright year as well. Change-Id: Ie1d71f8c68186b8f625f409ddf94691f178093c9 Reviewed-by: Katja Marttila <katja.marttila@theqtcompany.com> Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com>
* Replace waitForBytesWritten with flushKai Koehne2015-05-111-0/+2
| | | | | | | | | | | Unfortunately waitForByesWritten is known to fail from time to time: QTBUG-24451 . We introduced it for making sure large data is actually send, but flush() seems to serve the same purporse. The only drawback is that flush() operates on the concrete socket, and therefore needs to be called on the caller's side. Change-Id: Ic92db298b3dad2c3f9eaa47d160aec517e33e284 Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
* Windows: Fix crashes in elevated installationKai Koehne2015-04-161-5/+2
| | | | | | | | | | | | | | | | | | | | | | Until Qt 5.5.0, QLocalSocket::waitForReadyRead() immediately returns when there are still bytesAvailable(). This means our busy loop for polling new data gets stuck. To work around this we've been explicitly calling processEvents(), which however can have undesired side effects: Namely that non-network events get delivered too, and that 'intermediate' requests are sent to the server, resulting in the protocol getting out of sync - requests get replies from intermediate commands, ultimately leading to crashes. The patch therefore removes the processEvents() call, and instead works around the QLocalSocket::waitForReadyRead() deficiency by subclassing. Task-number: QTIFW-663 Task-number: QTIFW-656 Task-number: QTIFW-659 Change-Id: I4099fa1702cd8dceda954d672c9c3dac0ca7fd66 Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
* Compile with Qt 5.5kh2015-04-131-0/+1
| | | | | Change-Id: Iaab5bd3821bc4f1d4a826c9fee0c2a8c75d06bba Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Fix handling of incomplete messages in client/server communicationKai Koehne2015-02-201-125/+102
| | | | | | | | | | | | | Do not assume that the socket always contains enough data. Instead, prefix every 'packet' with its size, and back off until the full packet is available. The actual encoding/decoding is done in Protocol::sendPacket, Protocol::receivePacket. To be able to use the methods everywhere, replies are now prefixed by a Protocol::Reply command. Change-Id: I75a89605b2cc3fe2f2f841d8e3159fc8aea65d77 Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
* Use local sockets for client-server communicationKai Koehne2015-02-201-3/+3
| | | | | | Change-Id: I12bfef671ab31ae9fb8c4bb02776517e7f434d27 Task-number: QTIFW-228 Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
* Update CopyrightKai Koehne2015-02-181-7/+7
| | | | | Change-Id: I8dde6629cfd461104364d5cdc255cb54b58283fa Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Set objectName for QThreadKai Koehne2015-02-021-0/+1
| | | | | | | | The objectName of a QThread will be picked up and shown by debuggers. Change-Id: Iabd1006a228a73fff0a9a89bd3d8c1021bab6945 Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com> Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* RemoteServer: Exit early if authorization failedKai Koehne2015-02-021-1/+3
| | | | | | | | | | There's no point in listening to the socket after the authorization failed. It will then be closed by the client, anyway. Change-Id: I26eb2023e08ac3b16ecb894a89ffa0bfeddc62b0 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
* Make sure RemoteServerConnection is properly shut downKai Koehne2015-02-021-2/+4
| | | | | | | | | | | QThreadServerConnection is automatically deleted via deleteLater on exit. Anyhow, TcpServer::shutdown() also tries to quit() all child threads by going through the list of children. Making the QThread a child of TcpServer activates this behavior again. Change-Id: If1639ae2c9cd74a83b8ff1814aa2131d9016de14 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
* Set correct permissions for ini filesNiels Weber2015-01-261-34/+35
| | | | | | | | | | | This is necessary due to a behavior change in QSettings/Qt 5 that now creates ini files with more restrictive permissions than before. Task-number: QTIFW-589 Task-number: QTBUG-44086 Change-Id: I296ad4b312a933cbda7dd5c1f644294f83e1850d Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Fix running out of sockets in serverKai Koehne2015-01-211-1/+1
| | | | | | | | | | The client side (RemoteObject) sends a Destroy message to the socket when it's done. The server however did continue to listen to the socket even after the message, letting inactive socket descriptors pile up until we run out of them. Change-Id: I659ab8e24a81ab6163a05e2fb8db4dfd47ebd02f Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Fixed wrong placeholder in string.Niels Weber2015-01-061-3/+3
| | | | | Change-Id: Ifeca6563c9b1c82ab754fe87e8cacfae040cc070 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Refine server starting/stopping code.kh2014-12-021-2/+4
| | | | | | | | | If we can't connect, the server is most likely not running. Also send an acknowledgment that we are going to shutdown. Change-Id: I1a06b0ea5b5bdeb736042ca8b49508b6a4fd90b8 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* Remove pointer, superfluous members. Use signals and slots.kh2014-11-281-6/+5
| | | | | | | | | Use signals and slots to tell about the shutdown request. Instead of passing around the server pointer, give the port and key as parameter. Change-Id: I0ad1667aa1caee4ffdee8b6951336f2254974810 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Use qint32 throughout the whole communication.kh2014-11-211-21/+21
| | | | | | Change-Id: Id2d9ca3043b0d75a7ea93f9ac1f1467059cb1f0b Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
* Fix typo.kh2014-11-171-1/+1
| | | | | Change-Id: Id8301f8691340a41b9d314e8421fb4d245453a5a Reviewed-by: Niels Weber <niels.weber@digia.com>
* Add LGPLv3 as new licenseKai Koehne2014-10-161-14/+7
| | | | | | | Change-Id: I61158f956894e209dccf83744b4753774676099d Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com> Reviewed-by: Niels Weber <niels.weber@digia.com> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
* Add/remove/implement/reorder methods to match Qt5.kh12014-07-101-6/+13
| | | | | | | | | Unify if statements for better reading. Implement missing methods. Adjust {extension, supportsExtension} to tell that our remote does not support any extensions but our local file engine does probably. Change-Id: I6c1c392b531e4060cf12bde8b32eb6c6ec8f1037 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Fix endless loop.kh12014-06-061-1/+1
| | | | | | | | | | | | | | | Caused by the fact that the settings wrapper did not support anything different then native format, we had to trick the wrapper into using its default QSettings object which in turn uses a QFile (which roundtrips to the admin server) to write the settings out (behind the scenes). The blocking appeared only on Linux cause there we try a native call fcntl(handle, F_SETLKW, &fl) to lock the file during sync, which blocks endless caused of the missing rights. The fix is to use the settings wrapper also for ini format, as both are supported (Ini and Native). Change-Id: I73131c4adf85ba175ba6af1e18acccc29451b14f Reviewed-by: Kai Koehne <kai.koehne@digia.com>
* Introduce new classes for client-server communication.kh12014-06-031-0/+525
Still based on what we had already, though more separated. Change-Id: I4cce298003a4ffc2ebcec01fea1a07adfbfdf990 Reviewed-by: Tim Jenssen <tim.jenssen@digia.com> Reviewed-by: Niels Weber <niels.weber@digia.com>