summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
Commit message (Collapse)AuthorAgeFilesLines
...
* | Fix QAbstractFileEngine::clone misuseThiago Macieira2017-08-096-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QFile::copy was assuming that the target file was native and therefore it could simply take the file descriptor to clone. While that was not currently a problem, in theory it could be as we do have one writeable file engine besides QFSFileEngine (QWinRTFileEngine). By refactoring to take the parameter as a QAbstractFileEngine, we can ensure that the target file is a native file. Change-Id: Ib7a1737987bf4c4a8c51fffd14d0c048fd509025 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QFileSystemEngine/Unix: support UF_HIDDEN on the other BSDsThiago Macieira2017-08-081-1/+3
| | | | | | | | | | | | | | | | | | | | The stat::st_flags and fchflags(2) syscall are marked: HISTORY The chflags() and fchflags functions first appeared in 4.4BSD. Change-Id: I81480fdb578d4d43b3fcfffd14d4fd23bd27e37e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tobias C. Berner <tcberner@FreeBSD.org>
* | QFileInfo: harmonize QFileInfo() and QFileInfo("")Thiago Macieira2017-08-083-124/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a QFileInfo was constructed with an empty path, which could happen with QFileInfo(QFile()) or via QDir, etc., then it would issue system calls to empty paths and could even produce warnings. This commit makes am empty path name be the same as a default-constructed QFileInfo and corrects the use if 0 for ownerId and groupId to match the documentation. [ChangeLog][Important Behavior Changes] QFileInfo on empty strings now behaves like the default-constructed QFileInfo. Notably, path() will now be the empty string too, instead of ".", which means absoluteFilePath() is no longer the current working directory. Change-Id: I8d96dea9955d4c749b99fffd14ce34968b1d9bbf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add support for statx(2) on LinuxThiago Macieira2017-08-082-17/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This system call, new in Linux 4.11, gives us the file birth time. It's also extensible, representing the fourth generation of stat(2) on Linux (the original sys_stat(), sys_newstat(), sys_stat64() and now sys_statx()), not to be confused with glibc's __xstat function, which wraps a call to stat64. Anyway, the new one is designed to be extensible. Now we get birth times on ext[34] on Linux too: Name: . Path: . (/home/tjmaciei/src/qt) Size: 4096 Type: Directory Attrs: readable writable executable hidden nativepath Mode: drwxr-xr-x Owner: tjmaciei (1000) Group: users (100) Access: 2017-07-02T14:47:49.608 Birth: 2016-05-02T13:20:33.097 Change: 2017-07-01T13:37:08.737 Modified: 2017-07-01T13:37:08.737 It's not supported in any other filesystems I have (Linux sources show xfs has the feature too). Even on ext4, it depends on whether the filesystem was created with 256-byte inodes, which my /boot fs wasn't. Change-Id: I8d96dea9955d4c749b99fffd14cda23ed60d5e72 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devThiago Macieira2017-08-084-24/+29
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/widgets/kernel/qwidget.cpp This merge also extends the expected output of the pairdiagnostics teamcity output (added in dev in commit c608ffc56ab37f9a9d5b9c34543126adb89e2b08) after the recent addition of the flowId attribute to the teamcity output (commit 8f036562119dd35ce51dc9230304d893b906bd37 in 5.9). Change-Id: I3868166e5efc45538544fffd14d8aba438f9173c
| * Improve documentation for {QFile, QFileDevice}::resize()Sérgio Martins2017-08-032-1/+5
| | | | | | | | | | | | | | | | - Warn that they can fail if used on non-existent files - Fixed random garbage Change-Id: Ie58aac4a9f4479332ef07d39aecc136b1cfa58e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * QFileSystemWatcher/Windows: Fix crash when no QCoreApplication is presentFriedemann Kleint2017-08-022-23/+24
| | | | | | | | | | | | | | | | | | Rewrite instantiation of QWindowsRemovableDriveListener to check for the presence of the event dispatcher. Task-number: QTBUG-62242 Change-Id: Ibb5726864058593e5341e0d411aaf5432e2f108a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QFileSystemEngine/Unix: rework the getting of nsec-precision file timesThiago Macieira2017-08-062-23/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was working on Linux because _GNU_SOURCE gets us POSIX.1-2008 compatibility, but not on macOS or the BSDs. There, we were still stuck to full second precision. This commit uses the template trick introduced by the futimes code (which itself was inspired by commit 2fb42eb4af3444b11e7b1210323637937ef in QtNetwork). Also note how it adds support for birth time, if the system's stat struct has that information. Tested to work on MacOS and FreeBSD. The manual filetest produces: Name: . Path: . (/usr/home/tjmaciei/src/qt/qt5) Size: 1536 Type: Directory Attrs: readable writable executable hidden nativepath Mode: drwxr-xr-x Owner: tjmaciei (1001) Group: tjmaciei (1001) Access: 2017-07-13T20:03:47.916 Birth: 2017-07-13T20:03:47.916 Change: 2017-07-13T20:04:41.648 Modified: 2017-07-13T20:04:41.648 Linux will require support for statx(2). Change-Id: I8d96dea9955d4c749b99fffd14cd97d7a8c6d45d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QFileSystemEngine::fillMetaData: simplify and comment the codeThiago Macieira2017-08-061-38/+65
| | | | | | | | | | | | | | | | | | | | | | Took me a long while to understand what it did. Now that I do, I can also answer the question left behind during the original implementation in Qt 4.8 (commit 4fd2aced96d9095254d89f9da9c911bd88f15245 in the old history): how to know if a file exists? Change-Id: I8d96dea9955d4c749b99fffd14cdae135499a0d3 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Move Unix code from qfilesystemengine.cpp to qfilesystemengine_unix.cppThiago Macieira2017-08-062-223/+218
| | | | | | | | | | | | | | The comment about Symbian no longer applies. Change-Id: I8d96dea9955d4c749b99fffd14cd966f07d95948 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Migrate QStandardPaths to use QRegularExpressionSamuel Gaist2017-08-051-3/+5
| | | | | | | | | | | | | | | | | | | | This patch updates the code from the unix implementation of QStandardPaths to use QRegularExpression in place of the deprecated QRegExp. Change-Id: I51fa231dcd70ca55d1bfffb31d8f28f964ac44fe Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
* | QFileSystemEngine/Windows: fix setFileTime when input date is UTCThiago Macieira2017-08-051-15/+30
| | | | | | | | | | | | | | | | | | | | | | I was getting a weird 7-hour offset when doing: QVERIFY(file.setFileTime(before.addSecs(-10), QFile::FileModificationTime)); mtime = file.fileTime(QFile::FileModificationTime).toUTC(); QCOMPARE(mtime, before.addSecs(-10)); Change-Id: I35c4da69d754686a43e675b3d215213e448df7cf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | QFileSystemEngine::setFileTime/Unix: remove the fallback to futimesatThiago Macieira2017-08-051-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The use as in the code: futimesat(fd, NULL, &tv) is not documented to work. The file descriptor should be a directory's one, not an open file (though the Linux source code seems to handle that case). This call was done as a fallback to futimes, so it's very unlikely a system would have futimesat and not futimes. Both the Linux and the FreeBSD man pages say it's deprecated anyway. Change-Id: I8d96dea9955d4c749b99fffd14cd94068dc7668a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Filesystem: Use "birth time" to avoid confusion with Unix ctimeThiago Macieira2017-08-0511-75/+111
| | | | | | | | | | | | | | | | | | | | | | The Unix stat fields "st_ctime" and "st_ctim" mean "change time", the last time that the file/inode status fields were changed. It does not mean "creation time". So this commit splits all of the internal API to "birth" and "metadata change" instead of "creation" to avoid the conflict. Change-Id: I149e0540c00745fe8119fffd1463fe78b619649e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Move platform-specific code from QFSFileEngine to QFileSystemEngineThiago Macieira2017-08-055-162/+178
| | | | | | | | | | Change-Id: I8d96dea9955d4c749b99fffd14cd9395174ba005 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Introduce QFileInfo::birthTime and metadataChangeTimeThiago Macieira2017-08-052-10/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QFileInfo] Deprecated created() because it could return one of three different file times depending on the OS and filesystem type, without the ability to determine which one is which. It is replaced by metadataChangeTime() and birthTime(). [ChangeLog][QtCore][QFileInfo] Added QFileInfo::metadataChangeTime(), which returns the time the file's metadata was last changed, if it is known, and falling back to the same value as lastModified() otherwise. On Unix systems, this corresponds to the file's ctime. [ChangeLog][QtCore][QFileInfo] Added QFileInfo::birthTime(), which returns the file's birth time if it is known, an invalid QDateTime otherwise. This function is supported on Windows and on some Unix systems. Change-Id: I0031aa609e714ae983c3fffd1467bd8b3e3a593d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QFileSystemEngine::renameFile: use calls that don't overwriteThiago Macieira2017-08-041-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The renameat2(2) Linux system call, new in 3.16, allows for the atomic renaming of a file if and only if it won't clobber an existing file. None of the Linux libcs have enabled this syscall as an API, so we use syscall(3) to place the call. If your libc has SYS_renameat2 but your kernel doesn't support it, we'll keep issuing the unknown syscall, every time. Users in that situation should upgrade (3.16 is from 2014). On Darwin, there's a similar renameatx_np (guessing "np" stands for "non-portable"). I haven't found anything similar on the other BSDs. Change-Id: I1eba2b016de74620bfc8fffd14ccb4e455a3ec9e Reviewed-by: David Faure <david.faure@kdab.com>
* | Allow QSettings to synchronize non-atomicallyThiago Macieira2017-08-043-14/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is required so that one can use QSettings in situations that temporary files or renaming may not work. [ChangeLog][QtCore][QSettings] Added setAtomicSyncRequired(), which allows one to use QSettings with config files in unwriteable directories or in Alternate Data Streams on NTFS on Windows. This used to work before Qt 5.4, but remains a non-default behavior due to the potential of data corruption. Task-number: QTBUG-47379 Change-Id: I81480fdb578d4d43b3fcfffd14d4f77112f0402f Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Support Alternate Data Streams in QSaveFileThiago Macieira2017-08-041-5/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't use MoveFile to do atomic commits on an ADS, so QSaveFile needs to detect when the target name is ADS and then use the direct fallback mode. [ChangeLog][QtCore][QSaveFile] Saving to Alternate Data Streams on NTFS on Windows is now possible, but requires setDirectWriteFallback(true). Task-number: QTBUG-47379 Change-Id: I81480fdb578d4d43b3fcfffd14d4bc062ae1750d Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | QTemporaryFileName: use the random data more wiselyThiago Macieira2017-08-041-46/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, instead of getting 32 bits of random for every character, we can get reasonable randomness with just 10 bits, so we can replace 3 characters per get32() call. A typical template with six X will only need 64 bits of random data. Second, using the PID is not random at all. The reason why mktemp used to use it is irrelevant (probably because applications failed to seed rand()). Either way, we don't need nor want the PID anymore. And because the code is completely rewritten, the UCB copyright no longer applies. Change-Id: I84e45059a888497fb55ffffd14d2d4cfe159abca Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QFile::rename: use QTemporaryFileName instead of QTemporaryFileThiago Macieira2017-08-041-24/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This means the workaround for Linux's behavior now works even if QTemporaryFile is disabled. We also avoid the creation of an otherwise unused temporary file just so we can take its name. Tested with tests/manual/filetest. Strace shows: renameat2(AT_FDCWD, "a", AT_FDCWD, "/var/run/media/tjmaciei/B852-6088/a.EBG705", RENAME_NOREPLACE) = 0 renameat2(AT_FDCWD, "/var/run/media/tjmaciei/B852-6088/a.EBG705", AT_FDCWD, "A", RENAME_NOREPLACE) = 0 Before it was: open("/var/run/media/tjmaciei/B852-6088/a.VuL412", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 4 fcntl(4, F_SETFD, FD_CLOEXEC) = 0 lseek(4, 0, SEEK_SET) = 0 rename("a", "/var/run/media/tjmaciei/B852-6088/a.VuL412") = 0 stat("A", 0x7fff13260f00) = -1 ENOENT (No such file or directory) close(4) = 0 renameat2(AT_FDCWD, "/var/run/media/tjmaciei/B852-6088/a.VuL412", AT_FDCWD, "A", RENAME_NOREPLACE) = 0 (the absolute path comes from fd61059d359f0bee1c37d6bf08bf4b83381658ca and it seems it was needed for Symbian) Change-Id: I1eba2b016de74620bfc8fffd14ccc7c4ded009c8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Long live QTemporaryFileName!Thiago Macieira2017-08-043-151/+95
| | | | | | | | | | | | | | | | | | | | | | So we can use it in QTemporaryFile, QTemporaryDir and QFile::rename() [ChangeLog][QtCore][QTemporaryDir] The class now supports the "XXXXXX" replacement token anywhere in the template, not just at the end. This behavior is similar to what QTemporaryFile supports. Change-Id: I1eba2b016de74620bfc8fffd14ccb645729de170 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QTemporaryFile: split the template parsing and generationThiago Macieira2017-08-041-62/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the code more reusable by the unnamed file feature. This commit removes the backwards compatibility in using sequential file names if the first one failed. Since 5483b30868e44bc0799d7a1998f1907775, there are at least three random characters, so the chance of collision is 1 in 52³ = 140608. That commit also did not take a system failure into account. If we ended up getting EEXIST for all attempts, we'd attempt on average 26³*53³ file creations. For that reason, I've added an upper limit in the number of attempts to create a file. Change-Id: I1eba2b016de74620bfc8fffd14cc7e31c6e50558 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QTemporaryFile: give the engine access to the template nameThiago Macieira2017-08-043-15/+13
| | | | | | | | | | | | | | | | | | | | | | Instead of storing it in d->fileEntry. The QFSFileEngine methods may try to use it before the file entry is filled with the actual file name and that's no good. This change is using a reference to avoid keeping an extra QString reference and to avoid going out of sync. Change-Id: I1eba2b016de74620bfc8fffd14cca9e340e4b1e2 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | QTemporaryFile: add a simpler rename() (non-virtual) overrideThiago Macieira2017-08-042-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling the parent version is still ok, but if you call the new one you get a bit of benefit. Since we control the file name, we don't have to worry about a case-changing renaming (by choice). We also know that the file is a regular one, because we created it. [ChangeLog][Important Behavior Changes][QTemporaryFile] rename() no longer attempts to do block copying, as that usually indicates a mistake in the user's code. Instead, either create the temporary file in the same directory as the new name to be, or use QSaveFile. Change-Id: I1eba2b016de74620bfc8fffd14ccaac0cdb9fe87 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | QFSFileEngine: make rename() on Unix not overwriteThiago Macieira2017-08-046-12/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rename(2) system call overwrites, so instead of using it, we try to use the link/unlink pair. This works for regular cases, but can fail if trying to change case in case-insensitive filesystems, if we're operating on a non-Unix filesystem (FAT) or, on Linux, if the file doesn't belong to the calling user (BSDs permit this). For those cases, we fall back to rename(2). That means there's a race condition if a new file is created there. But we at least reduce the likelihood of that happening for regular files. Change-Id: I1eba2b016de74620bfc8fffd14ccb38fd929e5aa Reviewed-by: David Faure <david.faure@kdab.com>
* | Long live qEnvironmentVariable()Thiago Macieira2017-08-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore] Added qEnvironmentVariable, which returns the value of an environment variable in a QString, while qgetenv continues to be used to return it in a QByteArray. For Unix, since most environment variables seem to contain path names, qEnvironmentVariable will do the same as QFile::decodeName, which means NFC/NFD conversion on Apple OSes. I opted not to #include <qfile.h> from qglobal.cpp to implement that QFile::decodeName functionality, so qglobal.cpp doesn't depend on corelib/io and to avoid possible recursions. Task-number: QTBUG-41006 Change-Id: I14839ba5678944c2864bffff141794b8aaa7aa28 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/devFrederik Gladhorn2017-08-026-24/+31
|\ \
| * | Merge remote-tracking branch 'origin/5.9' into devOswald Buddenhagen2017-08-026-24/+31
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp src/plugins/styles/mac/qmacstyle_mac.mm src/widgets/widgets/qdockarealayout.cpp src/widgets/widgets/qmainwindow.cpp src/widgets/widgets/qmainwindowlayout.cpp src/widgets/widgets/qmainwindowlayout_p.h tests/auto/corelib/tools/qlocale/tst_qlocale.cpp tests/auto/other/macnativeevents/BLACKLIST tests/auto/widgets/widgets/qmenu/BLACKLIST Change-Id: Ic8e724b80a65e7b1af25511b0e674d209265e567
| | * Windows/QFileSystemModel: Fix updating of removed drivesFriedemann Kleint2017-07-311-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the updating of drives in QFileSystemModel was connected to a signal triggering when a drive containing watched files was removed via QFileSystemWatcher notification. This did not trigger when a drive that was not expanded in the view was removed, since no files were watched. Since QFileSystemModel is not interested in the path of the drive being removed, add a generic signal triggered by DBT_DEVTYP_VOLUME/DBT_DEVICEREMOVECOMPLETE and use that to update the drives. Complements 8e79806d08ab77aa0f87b69a2ef65789216f41c0. Task-number: QTBUG-18729 Task-number: QTBUG-53436 Change-Id: Ibcde4665824c41151042237d4d620c48bc1e2e18 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
| | * Fix open/chmod race condition in QSaveFileAntonio Larrosa2017-07-281-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a problem introduced in a60571b3700e80f44705ebc4bab9628cf852891c The problem happens when an application like Kate (actually, ktexteditor) uses QSaveFile to save files. So if you open a secretfile.txt file (with permissions 0600), edit and save it, then QSaveFile currently generates a temporary file with 0666 that afterwards gets chmod'ed to 0600 again, but in between, some other user in the system can open the temporary file and get a file descriptor that would allow him/her to read the contents of a file with 0600 permissions. Change-Id: I824025f54d6faf853da88e4dfcb092b577b4df04 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
| | * Revert "Make QFile::open fail when using an invalid file name"Thiago Macieira2017-07-271-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 346cd79192ef71afa572812e17f1d422594651a0. 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>
| | * Let QWindowsPipeWriter::write only warn about unexpected errorsJoerg Bornemann2017-07-241-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Do not print a critical message when the pipe connection dropped as this can happen with regular QLocalSocket usage as demonstrated in qtremoteobjects. Change-Id: If79915ce5d83b8cae5e090c04e893dafcb5a88a7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| | * QFileSystemEngine::id/Windows: Fix use with directoriesThiago Macieira2017-07-221-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Microsoft documentation says that CreateFile cannot be used to create directories, so you can only use it on a directory with OPEN_EXISTING and FILE_FLAG_BACKUP_SEMANTICS. This commit implements that. Change-Id: I658f552684924f8aa2cafffd14cfc0e5660a4a62 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * QFileSystemWatcher/kqueue: make the fd duplication + FD_CLOEXEC atomicThiago Macieira2017-07-211-2/+1
| | | | | | | | | | | | | | | | | | | | | The original fd was already FD_CLOEXEC due to qt_safe_open. Change-Id: Ief61d358e2b54a0fac37fffd14d2394ee02da059 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | | Fix some qdoc warningsFriedemann Kleint2017-08-021-4/+0
|/ / | | | | | | | | | | | | | | | | | | qtbase/src/corelib/io/qfsfileengine.cpp:926: warning: Overrides a previous doc qtbase/src/corelib/io/qfsfileengine.cpp:527: warning: (The previous doc is here) qtbase/src/corelib/tools/qbytearray.cpp:689: warning: Cannot tie this documentation to anything Change-Id: Ie7009f565a11a01859ccd0488ddeebe1b953305d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix some qdoc warnings for 5.10Friedemann Kleint2017-07-252-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/corelib/io/qfiledevice.cpp:741: warning: Can't link to 'setFileName()' src/corelib/io/qfiledevice.cpp:772: warning: Can't link to 'setFileName()' src/corelib/io/qfiledevice.cpp:790: warning: No such parameter 'time' in QFileDevice::setFileTime() src/corelib/io/qfiledevice.cpp:790: warning: Undocumented parameter 'fileTime' in QFileDevice::setFileTime() src/corelib/io/qfileinfo.cpp:1344: warning: Can't link to 'FileTime' src/corelib/kernel/qcoreapplication.cpp:2007: warning: Can't link to 'isTranslatorInstalled()' src/gui/opengl/qopenglextrafunctions.h:468: warning: No documentation for 'QOpenGLExtraFunctions::glBlendBarrier(void )' src/gui/opengl/qopenglextrafunctions.h:494: warning: No documentation for 'QOpenGLExtraFunctions::glGetGraphicsResetStatus(void )' src/gui/opengl/qopenglextrafunctions.h:475: warning: No documentation for 'QOpenGLExtraFunctions::glPopDebugGroup(void )' src/sql/models/qsqlquerymodel.cpp:217: warning: Unknown command '\override' Change-Id: Ide0ce911f6faf964fda8f32fac433da7d2cb11de Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QFileSystemEngine: Remove the remainder of Windows XP functionsThiago Macieira2017-07-252-53/+22
| | | | | | | | | | | | | | | | | | The attempt at loading these functions at runtime with WinRT always failed, so stop trying. Change-Id: I658f552684924f8aa2cafffd14cfc5179ac08498 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QFileSystemEngine: remove dynamic finding of Windows XP functionsThiago Macieira2017-07-252-84/+54
| | | | | | | | | | | | | | | | | | (one of them is even from Windows 2000) We just need to link to userenv.dll now. WinRT is not affected. Change-Id: I658f552684924f8aa2cafffd14cfc4b785a1d55c Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* | Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/devSimon Hausmann2017-07-2016-46/+127
|\ \
| * | Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-07-1916-46/+127
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qwindowspipewriter.cpp src/widgets/styles/qcommonstyle.cpp Change-Id: I0d33efdc4dc256e234abc490a18ccda72cd1d9e6
| | * QFile::rename: use the open file's ID, instead of using the file nameThiago Macieira2017-07-189-3/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To do that, we needed to add virtual id() in QAbstractFileEngine and override it in QFSFileEngine. It might be useful to return other types of IDs for the other file engines, but this commit does not attempt that just yet. Change-Id: I1eba2b016de74620bfc8fffd14ccafe0762b3c38 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * Convert improper uses of qt_error_string() to QSystemError::stdString()Thiago Macieira2017-07-183-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | On Windows, qt_error_string() returns the string corresponding to the Win32 API, not an errno. Replace those uses for a function that works for errno values. Change-Id: I1eba2b016de74620bfc8fffd14ccce6162bafdca Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| | * QFileSystemEngine::id/Windows: Use the volume ID tooThiago Macieira2017-07-181-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MS documentation says that the high/low parts uniquely identify a file within a system, but they actually mean the filesystem. The details on how it's allocated make that clear. So we need the volume identifier. Change-Id: I658f552684924f8aa2cafffd14cfc03c5a09c0e9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
| | * Doc: QLoggingCategory::setEnabled() should only be called in filterKai Koehne2017-07-181-6/+5
| | | | | | | | | | | | | | | Change-Id: Ib159c45ca259af125e48e3dfe59d64abc5f81f81 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * Doc: Clarify limitations of category filterKai Koehne2017-07-181-2/+2
| | | | | | | | | | | | | | | | | | | | | As suggested by ogoffart. Change-Id: I15747869147819799b14dfe0670ff2225f76fc03 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | * Do not wait in QWindowsPipe{Reader|Writer}::stop()Joerg Bornemann2017-07-174-14/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A deadlock can occur if the user does QLocalSocket *ls = new QLocalSocket; ls->moveToThread(t); ... delete ls; Then QLocalSocket calls QWindowsPipeReader::stop() in a different thread than the I/O operation is running in. The waitForNotified(-1) call would then wait indefinitely until the I/O thread is in alertable wait state again. Especially on application shut down this might never be the case, and the application would deadlock. Solve this by detaching the Overlapped object from the QWindowsPipe{Reader|Writer} in stop() and delete it in the callback. Task-number: QTBUG-61643 Change-Id: Ie262d75c5fd92ac7cf7dfcdbf1519050be9fd3c4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
| | * Fix warning messages in QWindowsPipeReader/WriterJoerg Bornemann2017-07-172-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | We forgot to update the warnings when removing qt_cancelIo. Also, use %p instead of %x, because HANDLE is void*. This amends commit fade2958. Change-Id: Ia11d7d094aa6beb939e0be4bbe4ab3654eaa1c02 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | | Add "<APPDIR>/data/<APPNAME>" to the non Generic paths on WindowsHannah von Reth2017-07-202-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | <APPDIR> was initially thought to be app-specific but is in fact more used as a kind of vendor prefix, where one vendor (e.g. KDE) can install many applications into the same APPDIR. [ChangeLog][QtCore][QStandardPaths] On Windows, QStandardPaths now also looks into "<APPDIR>/data/<APPNAME>" for non-generic paths. Change-Id: I426d97d61cc229bad0f5a2a4eb061e349de6681e Reviewed-by: David Faure <david.faure@kdab.com>
* | | QFileSystemEngine: a file only exists if its link count is not 0Thiago Macieira2017-07-205-6/+21
|/ / | | | | | | | | | | | | | | | | | | QFileSystemMetaData::fillFromStatBuf is used when filling in the results from both stat() as well as fstat(). Obviously the file exists if it was stat()ed but not necessarily so by fstat(): we could be operating on a file descriptor referring to an unlinked file or an O_TMPFILE. Change-Id: I8d96dea9955d4c749b99fffd14cd52a8c8dd9ca1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>