summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/tqtc/lts-5.15.5' into ↵v5.15.5-lts-lgplTarja Sundqvist2022-05-162-3/+21
|\ | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I0cdb390124e783dc9cd832a9954baa76a0e9eb6b
| * Fix QUrl::fromLocalFile with long path prefixKarsten Heimrich2021-05-251-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | After commit 3966b571 the function was kinda broken already, though this got unnoticed since it was not covered by an the auto-test. This commit adds another test case with Windows native separators and removes the use of QDir::fromNativeSeparators. Instead use the original code from QDir::fromNativeSeparators to replace the backslashes. Change-Id: I190560d0e75cb8c177d63b142aa4be5b01498da2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 06689a2d7a18882535819ed13ac7248c81330529) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
| * QFile::copy: call syncToDisk on destinationThiago Macieira2021-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | Syncing the source makes no sense. Fixes: QTBUG-86806 Change-Id: I0d3ff441bec041728945fffd1637205d9cf6ab72 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit ad9108e2e96ebf67147a72a7dab00398ff637695) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Merge remote-tracking branch 'origin/tqtc/lts-5.15.4' into ↵Tarja Sundqvist2022-04-071-1/+1
|\| | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I3d223d54a832c8365fec4b399550da79f4c1abbb
| * Call statx() with AT_NO_AUTOMOUNTAlexander Volkov2021-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | Otherwise it can be very slow in some cases (e.g. 0.5 sec). Besides, AT_NO_AUTOMOUNT is used by {l,f}stat() internally. Change-Id: Iae9c8b46dcdc96d21ac6b114a51c382b4949d3dd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 9667ac1c2d3b3d48cbd154bece36ec1d41d93a59) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* | Revert "Update commercial license headers to src/concurrent and src/corelib"Tarja Sundqvist2021-03-23127-2588/+2588
|/ | | | | | | | | | | This reverts commit b98b16de25dd5463342a2165a20b5fdc1cf9c32a. Revert of commercial license headers is required for Qt 5.15.3 opensource release. Task-number: QTBUG-91108 Change-Id: I51f2e169ec144ab9b902df2cff87eae60df53c57 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* QDir/QFileInfo: add doc notes about paths starting with ':'Ahmad Samir2021-02-032-7/+27
| | | | | | | | | | | | | | This is an addendum to commit 0da5726a43b; making the note about paths starting with ':' being treated as absolute paths by the underlying QFileSystemEngine, more visible, so that users of the class don't hit that pitfall. Add similar docs to QFileInfo. Change-Id: Ib34d066d31bb673d340ec41422ed4daf911765b8 Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 138fa9f2f4445832769a126a8ea72686b3687933) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Update public suffix list to today's latestEdward Welbourne2021-02-032-13923/+14360
| | | | | | | | | | | | | | | | Fetched from the authoritative source, verified the content matches that of the current master revision in the github repository. The former *.platform.sh entry has been replaced by more specific entries, replacing the wildcard with only selected second levels; amended a test to match that. Task-number: QTBUG-90214 Change-Id: I6da365a6ca558124f8275e392735071dc77e04bb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit ad16f79e5fac13f8a9dab8604de6adb6c46fe7bd)
* Update commercial license headers to src/concurrent and src/corelibTarja Sundqvist2021-01-28127-2588/+2588
| | | | | | | | | | | | | | | | | | | Updated the header.COMM to the files under tqtc-qtbase/src/concurrent and tqtc-qtbase/src/corelib. Note! The following files are not updated: - the .qdoc files with the FDL license headers - the .cpp files with BSD license headers The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and changing the line count would cause test failures. Task-number: QTQAINFRA-4154 Change-Id: I37a4dc8c89b0a84d78ca890a61e212966d8b20b5 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* QUrl: fix parsing of empty IPv6 addressesThiago Macieira2020-12-101-0/+6
| | | | | | | | | There's an assertion. Found by Google fuzz scan of CBOR data. Change-Id: I55083c2909f64a1f8868fffd164f1ff3af71605b Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 4a1091f489ac3fee9efd81b0f1ffca4275725610) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Android: Kill calls to deprecated func in API 29Piotr Mikolajczyk2020-12-041-55/+7
| | | | | | | | | | | | | | | | | Since API 29 functions: - getExternalStoragePublicDirectory - getExternalStorageDirectory are deprecated and no longer return directly accessible path. This patch replaces calls to those with suggested call to Context.getExternalFilesDir(String) Task-number: QTBUG-87803 Change-Id: I36bc5d5b72a80017996445af0d577aacf5e112d3 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io> (cherry picked from commit e1440dd7bc1a5da9a536f88b9733d04ec8fa6e61) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QStandardPaths: Don't change permissions of XDG_RUNTIME_DIRAlexander Volkov2020-11-301-29/+30
| | | | | | | | | | | | | | | | | | | Conform to the XDG Base Directory Specification: "If, when attempting to write a file, the destination directory is non-existent an attempt should be made to create it with permission 0700. If the destination directory exists already the permissions should not be changed." At the same time the spec states about XDG_RUNTIME_DIR that "its Unix access mode MUST be 0700", so don't consider the directory with wrong permissions correct and use a fallback. Task-number: QTBUG-68338 Change-Id: I03c6b35b3f7d5ceb8e6326695bfc8207da92ea67 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 68de00e0d4f2c574162a6e033d41786e3757d25d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix regular expression initialize with incorrect filtersZhang Yu2020-11-101-3/+3
| | | | | | | | | | | | | | | | | | | | The filters used to construct regular expression is the parameter of QDirIteratorPrivate constructor,and not the member variable 'filters' of QDirIteratorPrivate. When using filters as QDir::NoFilter to construct QDirIteratorPrivate, then the regular expression will incorrectly initialize with QDir::CaseSensitive(result of QDir::NoFilter),and not Qt::CaseInsensitive(result of QDir::AllEntries). Therefore, using the '_filters' to replace the parameter 'filters' Fixes: QTBUG-88227 Change-Id: I8a21fe1075fd95981e328a161a978e4fe546c9ca Reviewed-by: Simon Hausmann <hausmann@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit f353519e78380c04cffecfa4ceef222f37e8d83a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Remove mentioning of old macos versions from QSettingsKai Koehne2020-10-281-1/+1
| | | | | | | | | | | The specific mentioning of macOS 10.2, 10.3 goes back to Qt 4 times. Anyhow, both versions aren't supported anymore, and the logic in qsettings_mac.cpp is the same for all versions. Change-Id: Ibac503cb7c8563dec8560cc41c471c1db0f20566 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 9b35f22b58bfdf0e88dfc5baa4387968a81c169a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix allocated memory of QByteArray returned by QIODevice::readLineKai Koehne2020-10-271-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | If the maxSize argument is 0 (the default), QIODevice::readLine will allocate a QByteArray with the size of the next chunk of data, which may be quite large. Before returning, it then resizes the byte array to the actual size that was read. But since change 6b884d2aa129, QByteArray::resize() does no longer shrink the capacity. This means that the returned QByteArray keeps it's maximum size as allocated memory. This can lead to excessive memory consumption, especially if the returned QByteArray's are stored for further processing in the client code. Fix this by explicitly calling QByteArray::squeeze() before returning. [ChangeLog][QtCore][QIODevice] Fixes a regression in Qt 5.15 causing QByteArray's that are returned by QIODevice::readLine() to consume large amounts of memory. Fixes: QTBUG-87010 Change-Id: I1f95fc4098849e900680fc945238bfeda881022c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 263b29eedb223dec1ecaee193302070af87a1852, limited squeeze() call if bytes are actually read to preserve retVal.isNull() behavior in 5.15)
* QUrl::fromLocalFile: accept invalid hostnamesThiago Macieira2020-10-081-3/+11
| | | | | | | | | | | | | | | | | | | | QUrl hostnames must be compliant with STD3, but we must somehow accept file paths that begin with double slash but aren't valid hostnames. Because the file URI spec requires us to start with "file://" anyway, we can represent those with four slashes. Note that on Unix "//X/y" is a valid but local file path. If given to QUrl::fromLocalFile(), if the path at the root does parse as a hostname, we will still try to normalize (the above becomes "file://x/y"). [ChangeLog][QtCore][QUrl] Changed QUrl::fromLocalFile() to accept Windows UNC paths whose hostname component is not a valid Internet hostname. This makes QUrl able to accept extended-length paths (\\?\), device namespace (\\.\), WSL (\\wsl$), etc. Fixes: QTBUG-86277 Change-Id: I3eb349b832c14610895efffd1635759348214a3b Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 97de53ee8cce3dc6347b08668f0de45e1000f01c)
* Properly deprecate QProcess::pidVolker Hilsheimer2020-10-012-2/+5
| | | | | | | | | | | | Address an old ### Qt 5 comment. The method has been documented as deprecated and replaced by QProcess::processId since at least Qt 5.9, so we can first properly flag it as such for 5.15.2, and remove it from Qt 6 in a follow-up commit. Change-Id: Ic4e3351740617083b16723db8eef7a341bccfbf6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 3fb8f9e44e8cbf5937257505d0bc2d1457a26da1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Compile on QNX after QFlags constructor deprecationThiago Macieira2020-09-211-2/+2
| | | | | | | | | | | The QFlags constructor taking a plain zero literal was deprecated in commit af2daafde72db02454d24b7d691aa6861525ab99. Fixes: QTBUG-86585 Change-Id: I2fc68c725ba649218bd9fffd1633d6251649d2bd Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit d8d7dbb65a386162285fe56dd5dc337793dab9e8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QDir: add note to docs about isAbsolutePath(":foo") returning trueAhmad Samir2020-09-191-1/+5
| | | | | | | | | | | | As can be seen in the _q_resolveEntryAndCreateLegacyEngine_recursive method in QFileSystemEngine, paths starting with ':' are treated as QResources, which means that from QFileInfo's POV they're "not relative", which is why QDir::isAbsolutePath would return true. Change-Id: I701d08ce43ea707bc34c928e39bea0b83597a4b6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 0da5726a43b21d1532720c8cd3c687cc2373cd2b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Doc: Remove outdated informationPaul Wicking2020-09-141-5/+0
| | | | | | | | | | Seems this information is obsolete, get rid of it. Fixes: QTBUG-86607 Change-Id: I0250e32b3c312c7da0363dd1b0d7f676bbfa0115 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 165bc70bc39a5094a0f931d38066b1f5b585fee8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Revert "Do not wait in QWindowsPipe{Reader|Writer}::stop()"Alex Trotsenko2020-09-104-30/+14
| | | | | | | | | | | | | | | This reverts commit c7ec07d40115bef849574c81d619b629af9434a9. Reason for revert: This causes a memory leak on program termination. The initial commit was an attempt to fix a deadlock where the user destroys object from a thread that does not own the object. This is an unsupported case and should be treated as an invalid report. Change-Id: I4957784b86a0361adb65b9d023542f96480f00ba Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> (cherry picked from commit 92640829ad9f14ac83d870ed119e2738983f5284) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QStandardPaths/Unix: improve the XDG_RUNTIME_DIR creation/detectionThiago Macieira2020-08-271-47/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, use QT_MKDIR instead of QFileSystemEngine::createDirectory(), as the latter can't create a directory with the right permissions. That would allow an attacker to briefly obtain access to the runtime dir between the mkdir() and chmod() system calls. Second, make sure that if the target already exists that it is a directory and not a symlink (even to a directory). If it is a symlink that belongs to another user, it can be changed to point to another place, which we won't like. And as a bonus, we're printing more information to the user in case something went wrong. Sample outputs: QStandardPaths: runtime directory '/root' is not owned by UID 1000, but a directory permissions 0700 owned by UID 0 GID 0 QStandardPaths: runtime directory '/dev/null' is not a directory, but a character device, socket or FIFO permissions 0666 owned by UID 0 GID 0 QStandardPaths: runtime directory '/etc/passwd' is not a directory, but a regular file permissions 0644 owned by UID 0 GID 0 QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-tjmaciei' QStandardPaths: runtime directory '/tmp/runtime-tjmaciei' is not a directory, but a symbolic link to a directory permissions 0755 owned by UID 1000 GID 100 Change-Id: Iea47e0f8fc8b40378df7fffd16248b663794c613 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit ad5a65b6a2bfca1658634e380559d14ea1e904a4) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: provide a code example of QDirIterator's nameFilters parameterMitch Curtis2020-08-251-1/+6
| | | | | | | Change-Id: I56f9251f17bab0f835979a5feadec1fa896c9d69 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> (cherry picked from commit 0c52e600b3b5c83d128e6b4068d523829357fef0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* MSVC: Fix C4996 warnings in 5.15 when building QtKai Koehne2020-08-171-1/+1
| | | | | | Task-number: QTBUG-85227 Change-Id: I57d8cc2f6f9654a2851912a1b9f00b0bdac9aa06 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFileSystemModel: make sure files are stat'ed in the worker threadVolker Hilsheimer2020-07-312-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | QFileInfoGatherer creates QFileInfo objects in the worker thread to offload the work from the UI thread, but it never calls any methods on the QFileInfo objects that would trigger a stat'ing of the files. For large directories on remote file system, that easily results in the UI thread being blocked for a very long time. Add a private 'stat' method to QFileInfo which allows forcing it to stat all attributes from the worker thread, and make QFileInfoGatherer a friend so that it can call the function from the worker thread. This way, QFileSystemModel can access the cached data for each QFileInfo object, without having to touch the file system from the UI thread. Also reduce the amount of signal emissions for drive information, batch all drives (which can safely be assumed to be at most a two digit figure) into a single emission instead. Change-Id: Ifdcae150406187db9984d0fec9add93597b5f85b Fixes: QTBUG-41373 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 26c742c1e1c96740646bb1896df52bad2fbe105d) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFileInfo: Fail faster when stat'ing filepath on a disconnected driveVolker Hilsheimer2020-07-301-6/+8
| | | | | | | | | | | | | | The Windows implementation of QFileSystemEngine tries hard to fill the metadata for a file, even if GetFileAttributesEx returns with error. This is good in many situations, but when the error code indicates that the drive on which the file resides has been disconnected, then we should fail quickly. Task-number: QTBUG-6039 Change-Id: I7574c5a2e524e913306d0b470b4f227416442c13 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit d14cf6d3d980e9289d95b197ca46a55e9e263b22) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix race in QFseventsFileSystemWatcher destructorErik Verbruggen2020-07-241-6/+8
| | | | | | | | | | | | | | | | | | | | | | | The race goes like this: 1) We destruct QFseventsFileSystemWatcher, which calls FSEventStreamStop and FSEventStreamInvalidate/FSEventStreamRelease 2) The FSEvent* calls will happen on the same thread as the destructor is being called on, which will be different to the thread that the FSEvent* events are popping out on. 3) So, there could be a case where we are in the middle of processing an event, but the QFseventsFileSystemWatcher has already died. The fix is to dispatch the stop/invalidate/release on the queue associated with the stream. Patch by Matt Galloway! Fixes: QTBUG-85594 Change-Id: Ie168bbe91e55c5559632b37bc008e11597e4fdaf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 6533d1a47309956e8acda90eb4c41d245e817c93) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix QUrl::toDisplayString(PreferLocalFile) returning an encoded pathDavid Faure2020-07-022-5/+7
| | | | | | | | | | | | | | It's supposed to return the same as toLocalFile(), for local files, which means passing QUrl::FullyDecoded just like QUrl::toLocalFile() does. But a few code paths were testing component formatting options without masking other FormattingOptions like RemovePassword, so this had to be fixed. Fixes: QTBUG-84594 Change-Id: I82f15148b6d93516200f9ad6258d474e7f10924a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit eb546469849d2bf560f41b14366832e1f8b22456)
* forkfd: remove FFD_VFORK_SEMANTICSThiago Macieira2020-06-301-2/+0
| | | | | | | | | | | | | | | | This will never work, not unless libc implements it themselves, since the child process is not allowed to return from the function that does the vfork(), as subsequent use of the stack would trash the frozen parent's return address, and in our case that's syscall(). Instead, we may add a vforkfd() function that takes a callback function that will be called in that context, like the glibc clone(3) wrapper does. Change-Id: I1dba29bc0f454df09ca1fffd161800b453c00593 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 4e2f4670362d2ab8eed55be0cf699b24d658c3e6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QProcess/Win: Fix build in debug modeAlex Trotsenko2020-06-052-3/+4
| | | | | | | | | | | Suppress a compile warning: io\qprocess_win.cpp: 623:101: error: format '%d' expects argument of ... Change-Id: I9ea94ddfc21afea5d1a78e264507a36435cce063 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit ad117c54441a656009bf70669c3e087d3019fae9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Address Coverity defect about buffer overrunDimitrios Apostolou2020-05-291-3/+23
| | | | | | | | | | | | | | | | | Coverity warned that chunk could be >= tldChunkCount (2), and tldData[chunk] (array of length 2) would be accessed out of bounds. This can not happen, but it was unclear. Clarify logic with comments and asserts, that Coverity will hopefully understand now. Change-Id: I2a38c685cfcbc69ed123918e8cbed360b20b1035 Coverity-Id: 178254 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit bc58e0dc7a378d96472441757250586b71868e62) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QFile::moveToTrash: work with relative file paths on WindowsVolker Hilsheimer2020-05-191-2/+2
| | | | | | | | | | | | | | | | | | | | | The system APIs expect an absolute "display name" of the file path, so make it absolute. The test was overly tolerant in accepting failure, as a QStorageInfo initialized with a file path that doesn't exist is invalid, and thus always different from the QStorageInfo of the home directory. Fix the test to compare only valid QStorageInfo objects, and postpone the check until the file we want to move has been created. [ChangeLog][QtCore][QFile] moveToTrash supports relative file paths on Windows Change-Id: I94c8cd40c60fde469e38f76a98f867f20c6a0b15 Fixes: QTBUG-84015 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit a033c23ddffed6b9bff3e7be68d513a7962c3b5e) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFile::moveToTrash: use $XDG_DATA_HOME/Trash as the trash directoryVolker Hilsheimer2020-05-191-5/+13
| | | | | | | | | | | | | | | | | | | | | | The code assumed that files in $HOME should be moved into $HOME/.Trash, which is not what the spec says. The "home trash" is defined to be $XDG_DATA_HOME/Trash, and we can expect $XDG_DATA_HOME to exist. If it doesn't, then we can safely fail, as the environment is not compliant with the Desktop Base Directory Specification [1] anyway. [1] http://www.freedesktop.org/Standards/basedir-spec This will make the tests fail on such non-compliant environments, such as server versions of the distribution. That's acceptable. [ChangeLog][QtCore][QFile] moveToTrash now creates the trash folder on Linux as $XDG_DATA_HOME/Trash, as required by the freedesktop.org spec. Change-Id: I7ef73c0c268ef5ea4df141bb7831b93a65ad213a Fixes: QTBUG-83933 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 112c285fcc065d07734b30ba49a62ead3be3d2c4)
* QSettings: fix UB (signed integer overflow) on parsing long hex/oct escapesMarc Mutz2020-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | The code did not limit the length of hex and octal escape sequences, but used an int as the accumulator, which causes UB on overflow. Due to the use of the QChar(int) constructor when appending escapeVal, only the lowest 16 bit of the value were appended to the result string. An test case encoding this behavior explicitly suggests this is intended behavior. It therefore suffices to use an unsigned 16-bit value as the accumulator (unsigned, because that doesn't cause UB on overflow, 16 bits, because that's all we care for). For future-proofing, use char16_t as the accumulator. Change-Id: I07e7ebf1f312276b2bbcb08e4360c66a3b9522ca Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit c59665b0ec8cda1b00852f5f90fcad7fc88d1638)
* Fix compile error on iOSLars Knoll2020-05-161-0/+3
| | | | | | | Change-Id: I776967c5d69e8d2d318fb2670e401d4ee3dccb67 Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 8292e3c59027e28dd6be5d942ea337c92deb230e) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* qstandardpaths_win.cpp: Fix GetCurrentProcessToken() for Win7v5.15.0-rc2Fredrik Orderud2020-05-071-1/+6
| | | | | | | | | | | | | The GetCurrentProcessToken() was made an inline function for Windows 8. Expand it to ensure builds work independent of WINVER and disable low integrity support for Windows 7. Fixes: QTBUG-83941 Task-number: QTBUG-83453 Change-Id: Ic989f16621cd80cbc70c6b62779afab8a12714df Reviewed-by: Fredrik Orderud <forderud@gmail.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Introduce QSocketNotifier::activate(QSocketDescriptor, QSN::Type)Mårten Nordheim2020-04-163-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pre-existing overload passes an int, but this can mean the descriptor gets truncated in compilations where the descriptor is 64-bit. The old overload with int is visible when querying the metaobject system so string-based connects still work as before, and connecting to it will produce a deprecation warning in the output. At the same time the PMF-based connect will, on recompile, pick the QSocketDescriptor overload. As an added improvement it also comes with the notification type, removing the need for separate slots where the code would be mostly shared anyway. The QSocketDescriptor type can be implicitly converted to and from qintptr to ensure existing code still compiles. It can also be constructed from Qt::HANDLE on Windows. In this same patch I also update the existing string-based connects in this module, which then includes updating the parameters for some slots as well. [ChangeLog][QtCore][QSocketNotifier] Added QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type). This replaces the activated(int) signal which in 64-bit environments could truncate the socket descriptor. If you use "activated" with the string-based connect() then you need to update the parameter type of the signal and slot if it had one. If you use it with the pointer to member function based connect() then all you need to do is update your slot's parameter type if it has one. If you need to compile your source code with multiple versions of Qt then connect() to this function using pointer to member function and update the slot's parameter type if needed. Task-number: QTBUG-70441 Change-Id: Ic43d6bc4c5bcb4040867b2ffad8d36fb01eed8af Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Windows: Make QStandardPaths::writableLocation low-integrity awareFredrik Orderud2020-04-151-2/+55
| | | | | | | | | | | | | Return %USERPROFILE%\AppData\LocalLow instead of %USERPROFILE%\AppData\Local when running in a low-integrity process. [ChangeLog][QtCore][QStandardPaths] When used in a low-integrity process on Windows, QStandardPaths::writableLocation returns respective low-integrity paths. Fixes: QTBUG-83453 Change-Id: Ie5e4625a34d08e4ef54be4ba45b2dae9e60feb63 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QSettings: Read past UTF-8 BOM even without textcodec supportKai Koehne2020-04-141-2/+4
| | | | | | | | | | | | | | | Try to read past an UTF-8 BOM even if no textcodec support is available, but do set the status to FormatError then. This is in line with the general 'best effort' approach in QSettings. It also allows qmake (that is built without textcodec support) to gracefully load qt.conf files with a UTF-8 BOM, though non-Latin1 characters might still be misrepresented. Fixes: QTBUG-83456 Change-Id: I31b45dc5a8adf7950910897a2b33ae16990d3818 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QTemporaryFile/Linux: don't cut the root dir's slashThiago Macieira2020-04-081-2/+4
| | | | | | | | | | | | | Normally people shouldn't create temporary files on /, but if you're running as root, why not? Caught when running tst_qtemporaryfile as root: openat(AT_FDCWD, "", O_RDWR|O_CLOEXEC|O_TMPFILE, 0600) = -1 ENOENT (No such file or directory) Change-Id: Ibdc95e9af7bd456a94ecfffd1603ebfc17cea220 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* macOS: Remove all use of deprecated Q_OS_OSX defineTor Arne Vestbø2020-04-034-6/+6
| | | | | Change-Id: I49c285604694c93d37c9d1c7cd6d3b1509858319 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QProcess/Linux: use the FFD_VFORK_SEMANTICS flagThiago Macieira2020-03-251-3/+10
| | | | | | | | | | | | | | ... when we are not using the FFD_USE_FORK flag. We use the FFD_USE_FORK flag when we have user code to run in setupChildProcess(). This code is enabled for all Unix, but forkfd() honors this flag only on Linux >= 5.4. See the commit adding the flag for more information on what the flag does and see the comment in this commit on why it's safe to use it. Fixes: QTBUG-17331 Change-Id: I1bee3bc466a04f19bd6efffd15f448cb23ce1e91 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2020-03-241-1/+1
|\ | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbdrag.cpp Change-Id: I0b47324b70b0b4894e54b21aa3e7a5041f9bd5e3
| * Doc: replace QFileInfo::created with birthTimeMauro Persano2020-03-201-1/+1
| | | | | | | | | | Change-Id: Ia497febcbf28e4b3babe50fc6f05e12f3d686b91 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Update the latest public suffix listEdward Welbourne2020-03-162-13783/+13887
| | | | | | | | | | | | Task-number: QTBUG-72623 Change-Id: I8e0450c41882f00a49264a99342eb2dcf1959abe Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Fix UB in QProcess deprecation warning fixesJoerg Bornemann2020-03-061-1/+2
| | | | | | | | | | | | | | | | The commits e1e08629 and 66e905b1 introduced undefined behavior. Fix this by assigning the result of takeFirst to a temporary. Change-Id: I9e29412cf632d4836b95d47e12d8c07ab0645fbb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Doc: Fix \sa link for QResource::uncompressedData()Kai Koehne2020-03-061-1/+1
| | | | | | | | | | | | | | | | No point in linking to itself. Change-Id: Id0bf3fa6878417e541ec0997d34758b0c59e99b3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix deprecation warning in QProcess::execute(QString)Joerg Bornemann2020-03-051-5/+3
| | | | | | | | | | | | | | | | Implement this method in terms of splitCommand and QProcess::execute(QString, QStringList). Change-Id: I1fe78fb53d8b6b34a8796f9fbda380a98a840c99 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | QLoggingRegistry: use QStringView/QLatin1String moreMarc Mutz2020-03-052-26/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - QLoggingRule::parse() and the ctor take pattern as QStringView - parseNextLine takes lines as QStringView and produces the pattern as QStringView for QLoggingRule - (setContent has to wait for QStringTokenizer) - QLoggingRule::pass()'s first argument is always QLatin1String, so take it as one Use chopped() more, add a std::move(). Change-Id: Ic95ea77464a9922fef452846bc6d5053bd5de56e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* | Make QProcess::splitCommand accept QStringView, as per header reviewVolker Hilsheimer2020-02-282-2/+2
| | | | | | | | | | | | | | | | | | A static function that only parses the string to create the list, so no need for a QString overload. Change-Id: I1df297adb795095d6eec94ccfcad52498178a7b1 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>