Commits aba336c2b4 (in Qt 5.2) and
aba336c2b4 (in 5.6) both tried to deal
with this problem, with different levels of success. This is the third
attempt (and hopefully the charm).
Instead of modifying the path that the user provides, go straight ahead
and declare it invalid. This is supported by RFC 3986, which declares
this expansion impossible:
relative-part = "//" authority path-abempty
/ path-absolute
/ path-noscheme
/ path-empty
path-abempty = *( "/" segment )
path-absolute = "/" [ segment-nz *( "/" segment ) ]
path-noscheme = segment-nz-nc *( "/" segment )
The "path-abempty" and "path-noscheme" cases are the two issues we
already handle. This commit adds the third one: path-absolute, which
requires that the first segment of the path be of non-zero length.
That is, it is now possible again to have http://example.com//path
constructed piece-wise, without it producing http://example.com/path.
Additionally, it catches the case of http://example.com//path parsed
from full URL then followed by setAuthority("").
Change-Id: I69f37f9304f24709a823fffd14e67a5e7212ddcd
Reviewed-by: David Faure <david.faure@kdab.com>
One example is VxWorks.
Change-Id: I253df715a9417c1f9cede79b1e1860924e0da8a9
Reviewed-by: Tuomas Heimonen <tuomas.heimonen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
[ChangeLog][QtCore][QFileInfo] Relative symbolic links on Windows are
now resolved to their absolute path by symLinkTarget().
Task-number: QTBUG-62802
Change-Id: I5826517130bd389aef994bf3f4b6d99b2a91b409
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Consider the following:
/root/target - a file
/root/path/link -> ../target
/root/path/other/exe - executable
Running from /root/path/other.
exe is:
#include <QDebug>
#include <QFileInfo>
int main()
{
qDebug() << QFileInfo("../link").symLinkTarget()
return 0;
}
The link references /root/target, but the current output is
/root/path/target.
The link doesn't depend on the PWD. It depends on its own directory.
Change-Id: I61e95018154a75e0e0d795ee801068e18870a5df
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
don't try to execute a binary from the install dir.
amends 8e776d39f.
Change-Id: I37990bc83b295379f0c93f4ca712e1bbf980fd44
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Split the test in two: one test that requires the symlinks
and test files and one that does not need them.
In the test with test files, verify each step and the deletion
of the files.
Task-number: QTBUG-58654
Task-number: QTBUG-50835
Change-Id: I14de57ce7a1df2d834d5a7565c804dead1d89088
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This reverts commit 346cd79192. The bug
report was incorrect, since the suggested file name is actually valid,
it just happens to name an Alternate Data Stream (ADS) "20:803Z.txt" in
file "testLog-03".
[ChangeLog][QtCore][QFile] Reverted an incorrect change from Qt 5.9.0
that forbade the creation and access to Alternate Data Streams on NTFS
on Windows. This means that file names containing a colon (':') are
allowed again, but note that they are not regular files.
Task-number: QTBUG-57023
Change-Id: I81480fdb578d4d43b3fcfffd14d4f2147e8a0ade
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
This is the result of running the (experimental) clang-tidy check
qt-modernize-qsharedpointer-create
Discarded changes:
- tst_qsharedpointer.cpp: not sure we want these replacements there
(→ separate change)
- tst_collations.cpp: hit in a template specialization that is
instantiated with both QSharedPointer and QSharedDataPointer.
Change-Id: I203c2646e91d026735d923473af3d151d19e3820
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QWindowsFileSystemWatcherEngine uses one change notification
per directory to watch directories or files within that
directory. Adding files and their directories in a sequence
caused the value in QWindowsFileSystemWatcherEngineThread::HandleForDirHash
to be overwritten.
Relax the check for the flags (watcher attributes) to use >= and recreate
the change notification of a directory should its flags be insufficient.
This triggers when a file is added after its directory since files
require more attributes.
Task-number: QTBUG-61792
Change-Id: I371a72f1934fa82c53aaf84beb907825031f1c81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
As the files are packaged into the binary, they have to be
extracted, before they can be ::open'ed.
Change-Id: Ie83086a2b9a73b6b0de462bdb52a71bb277ae06f
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
The motivation for this change is to make it simple to pass a
correctly sorted environment block to Win32 CreateProcess(). It is
also nice in other contexts that the environment variables are
sorted. The change is made for all platforms. This keeps it simple and
the only ill effect is slightly slower lookups.
Concerning the environment block passed to Win32 CreateProcess:
The environment block that is passed to CreateProcess() must be sorted
case-insensitively and without regard to locale. See
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682009(v=vs.85).aspx
The need for sorting the environment block is also mentioned in the
CreateProcess() documentation, but with less details:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
Task-number: QTBUG-61315
Change-Id: Ie1edd443301de79cf5f699d45beab01b7c0f9de3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It is possible that tmpdir already exists as a leftover from previous
tests. That is no reason for the test to fail.
Change-Id: I010633fb92defb064093af9872ae6fd2178f07dd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
load(resources) makes embedding the test data into the executable
fail for platforms that use builtin test data. As the load call
is only used to obtain QMAKE_RCC we can avoid that call by
assuming that rcc was not renamed and assembling the path ourself.
Change-Id: I25b982d10f5617d9a213803e7e4bcc85fc66b2e7
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
If QEMU is provided sysroot with QEMU_LD_PREFIX, it opens files from there. If their
owner is the current user, testing their access rights based on assumption that they
are root fails. Skip the tests in that case similarly as is already done when the
tests are run as root.
This fixes following tests:
- tst_QTemporaryDir::nonWritableCurrentDir
- tst_QNetworkReply::getErrors(file-permissions)
- tst_qstandardpaths::testCustomRuntimeDirectory
Task-number: QTBUG-59966
Change-Id: I972ce37b4b5a7747cdd732a8e4a737ef09cbc6a5
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We guarded against the Unicode form being invalid and did not produce an
encoded form. But we did not guard against proper Punycode sequences
that decode to forms that had not passed the proper Nameprep stage. So
check for that and, if it fails, just keep the label in the form we
found it in (it's valid STD3 anyway).
[ChangeLog][QtCore][QUrl] Fixed a bug that caused certain domain names
that look like Internationalized Domain Names to become corrupt in
decoded forms of QUrl, notably toString() and toDisplayString().
Task-number: QTBUG-60364
Change-Id: Iadfecb6f28984634979dfffd14b833142cca8d0d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The whitelist is kept in ACE form, so if the TLD came in Unicode, we
need to run ToASCII before we can check the whitelist. This is slightly
inefficient because we'll run the same operation later in this domain.
Change-Id: Iadfecb6f28984634979dfffd14b831f37b0f4818
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
It only contained a concatenation of the individual rule sets,
probably to fix their order in a central place, as well as
simplifying iteration in defaultCategoryFilter().
Fix these two issues differently, but introducing a RuleSet
enum that lists rule sets in the order in which they should
be applied by defaultCategoryFilter(), and turn individual
rule sets vectors into a C array of vectors.
This enables two nested loops in defaultCategoryFilter to
replace the one loop over 'rules'. Apart from building up
'rules' in updateRules(), this was the only access to that
member. That leaves updateRules() with just the task of
running defaultCategoryFilter() on the new rule sets.
Consequently, a call to updateRules() can now replace the
identical loop in installFilter().
Performance should not suffer. Iterating over a fixed-size
array of vectors is hardly any slower than iterating over
a single vector, and while the construction of 'rules'
was probably a one-off task in most programs, this way
of keeping the rules also saves memory because rules are
not kept in two different vectors.
It is also more maintainable, of course.
Change-Id: Ibc132d096c8137dd02b034752646212e51208637
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This reverts commit 47cc9e23a3.
We use QCoreApplication::applicationDirPath in the logging initialization to find
a possible qtlogging.ini file. Because QCoreApplication::applicationDirPath requires
a QCoreApplication instance this leads to a qWarning, which in turn leads to a
recursive call to the logging initialization, and in turn to a recursive mutex deadlock.
Task-number: QTCREATORBUG-18031
Change-Id: Ic75e1e8c062eb647991725378489bf87c9648cca
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Allows categorized logging before QCoreApplication has been created,
which otherwise would silently fail to output anything because the
category would never be enabled, despite QT_LOGGING_RULES being set.
Change-Id: Ia733105c5b6f28e22af511ced5271e45782da12b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QSysInfo::productType() returned "osx" for all versions of macOS, even
10.12. Change 3e2bde3578 was incorrect.
[ChangeLog][Important Behavior Changes] QSysInfo::productType() and
QFileSelector behavior on macOS was restored to match what Qt used to
return in version 5.7.0 and earlier. The behavior found in Qt 5.6.2,
5.7.1 and 5.8.0 is removed.
[ChangeLog][Future Compatibility Notice] The identifiers that
QSysInfo::productType() and QFileSelector will use to identify macOS
systems will change in Qt 6.0 to match the Apple naming guidelines which
will be current then.
Task-number: QTBUG-59849
Change-Id: Ib0e40a7a3ebc44329f23fffd14b2b39392210c4f
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
It is incorrect to collapse a "symlink/.." segment because the parent
directory of the symlink's target may not be the directory where the
symlink itself is located.
[ChangeLog][QtCore][QDir] Fixed a bug that caused QDir::mkpath() to
create the wrong directory if the requested path contained a symbolic
link and "../".
Change-Id: Iaddbecfbba5441c8b2e4fffd14a3e367730a1e24
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
std::nullptr_t is nullary: it accepts only one value, nullptr. So we
don't need to read or write anything. This commit simply adds the two
operators that allow generic code to operate on std::nullptr_t if
required.
This commit also adds the actual use to QMetaType::load/save, even
though there's no change in behavior.
[ChangeLog][QtCore][QDataStream] Added operator<< and operator>>
overloads that take std::nullptr_t, to facilitate generic code.
Change-Id: Iae839f6a131a4f0784bffffd14aa37e7f62d2740
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Qemu does not report /proc/self/maps size correctly. Added expected
failure for it
Change-Id: I4019884702b8f9a33717b02e79c9e0c042b2449f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Unix mmap(2) system calls do allow for mapping beyond the end of the
file, though what happens after you try to dereference the pointers it
gives is unspecified. POSIX[1] says that implementations shouldn't allow
it:
The system shall always zero-fill any partial page at the end of an
object. Further, the system shall never write out any modified portions
of the last page of an object which are beyond its end. References
within the address range starting at pa and continuing for len bytes to
whole pages following the end of an object shall result in delivery of
a SIGBUS signal.
However, Linux allows this in read-write mode and extends the file
(depending on the filesystem).
Windows MapViewOfFile never allows mapping beyond the end.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html
Change-Id: Ie67d35dff21147e99ad9fffd14acc8d9a1a0c38d
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Teemu Holappa <teemu.holappa@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- Test tst_LargeFile::mapFile fails on Qemu for files over 4Gb.
Fixed by limiting maxSizeBits to 28 (must be n*4 and < 32).
- Bug QTBUG-21175 is also effective on ARM targets. Fixed by
expecting failure also on ARM.
Change-Id: I9103727e618a17259b4785ec8c284f3bb60ebea7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If the respective modules aren't available we cannot build the tests
and examples. We drop the qtConfig(opengl) requirement for the opengl
examples as
a, we would need to make the QtGui configuration available for that to
work, and
b, we should not add too much detail to the tests and examples build
configurations. Checking each test and example for every feature it
uses would be too much.
Task-number: QTBUG-57255
Change-Id: Ifb043c81ec9e5c487765297bd65704812cd281fc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
mkdir(data2) depended on mkdir(data1) being run before, or it would
fail. In addition, the rmdir() test required the equivalent mkdir() test
being run before. So drop these annoying dependencies and make the tests
cleaner by having clear separation of the test data and merging the two
tests into one
The entryList() test still depends on the testdir being clean: it will
fail if mkdirRmdir() previously failed.
Change-Id: Iaddbecfbba5441c8b2e4fffd14a3e35972d2a3d8
Reviewed-by: David Faure <david.faure@kdab.com>
QUrl::isRelative(str) would be false for such files, so first check for
file existence before doing any URL parsing.
Change-Id: I51b6229251ad94877ac408b2f8018456d3e10a36
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Fixes the bug in QFile which allowed opening a file with reserved
characters in its name. If the name is a long file path, CreateFile
opens a file with a truncated name instead of failing, so we have
to catch reserved characters ourselves.
[ChangeLog][Windows] Fixed a bug that caused QFile to create
files with truncated names if the file name was invalid. Now,
QFile::open correctly fails to create such files.
Task-number: QTBUG-57023
Change-Id: I01d5a7132054cecdfa839d0b8de06460039248a3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
It's a Qt 3 compatibility vehicle, and as such inherits the now-alien
property to distinguish empty and null strings. Particularly worrisome
is the following asymmetry:
QString("") == QString::null // false
QString("") == QString(QString::null) // true
Instead of fixing this behavior, recognize that people might use it as
a weird way to call isNull(), albeit one that once was idiomatic, and
simply deprecate everything that deals with QString::null.
[ChangeLog][QtCore][QString] QString::null is now deprecated. When
used to construct a QString, use QString() instead. When used to
compare to a QString, replace with QString::isNull().
Change-Id: I9f7e84a92522c75666da15f49324c500ae93af42
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Stale Lock files in the future can happen in some situations. For exemple
two computers with different clocks access the same file system. It could
be that one of the timestamp is totaly off (several years into the future).
[ChangeLog][QtCore][QLockFile] Fixed a deadlock occurring if a corrupted
lock file's modification time is in the future.
Change-Id: I8dac98a0e898c76bcef67f8c195e126c996b6add
Reviewed-by: David Faure <david.faure@kdab.com>
For the windows file system engine, we add an extra macro to use
library loading if configured to do so, but avoid it on WinRT, as
none of the symbols would be found.
We also QT_REQUIRE_CONFIG(library) in the library headers and
exclude the sources from the build if library loading is disabled.
This, in turn, makes it necessary to clean up some header inclusions.
Change-Id: I2b152cb5b47a2658996b6f4702b038536a5704ec
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Commit eab7efd1 increased the timeout for this test, but apparently 10
seconds are still not enough. Set the timeout to a minute.
Task-number: QTBUG-59075
Change-Id: Iebab8e5c73c4858ca90063a82aedfbb2546a62cc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Replace all QT_NO_PROCESS with QT_CONFIG(process), define it in
qconfig-bootstrapped.h, add QT_REQUIRE_CONFIG(process) to the qprocess
headers, exclude the sources from compilation when switched off, guard
header inclusions in places where compilation without QProcess seems
supported, drop some unused includes, and fix some tests that were
apparently designed to work with QT_NO_PROCESS but failed to.
Change-Id: Ieceea2504dea6fdf43b81c7c6b65c547b01b9714
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>