QTemporaryFile: file not being created in Qt 5.11/5.12
-
I have read both sides of this: the bug report + Qt documentation, and the Linux
open
docs forO_TMPFILE
. I can see both sides of the argument, and of course understand that Qt wants to use the OS facility.I admit I have not tried it, but how does, say, Qt docs stating stuff like
The file name of the temporary file can be found by calling fileName().
A temporary file will have some static part of the name and some part that is calculated to be unique.
and will be placed into the temporary path as returned by QDir::tempPath().marry with the
O_TMPFILE
docs ofCreate an unnamed temporary regular file
(2) can never be reached via any pathname
(4) do not require the caller to devise unique namesI am also intrigued that apparently the implementation has changed from Qt 5.9 to 5.11, I wonder why now.
It's easy for me to say, but some hints in the Qt docs about this possible behaviour might be welcome. I fully understand that it is not Qt's job to document everything which might be going on under each platform, but there are other precedents in the docs which do give the user a clue about platform-specific behaviour, or what to expect/not expect....
-
The support for O_TMPFILE was added in 5.10 and there was even a big changelog entry for this: https://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.10.0/?h=v5.10.0
-
@Christian-Ehrlicher said in QTemporaryFile: file not being created in Qt 5.11/5.12:
The support for O_TMPFILE was added in 5.10 and there was even a big changelog entry for this: https://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.10.0/?h=v5.10.0
Great, thanks for the link.
I'd still say there should be a note about this in Qt docs for Qt >5.10. Many other such OS "curiosities" are mentioned in the docs.
-
@sierdzio said in QTemporaryFile: file not being created in Qt 5.11/5.12:
I'd still say there should be a note about this in Qt docs
Feel free to provide a patch ;)
-
@Christian-Ehrlicher said in QTemporaryFile: file not being created in Qt 5.11/5.12:
@sierdzio said in QTemporaryFile: file not being created in Qt 5.11/5.12:
I'd still say there should be a note about this in Qt docs
Feel free to provide a patch ;)
Oh I wish, but no time right now.
I'll bookmark this, though and hopefully come back with a patch some day.
-
I'll bookmark this, though and hopefully come back with a patch some day.
Too late :) But you can review the patch: https://codereview.qt-project.org/c/qt/qtbase/+/282081
-
Great, thanks! Looks good. I may be lacking some powers as I don't see any +1 button I can click.
-
It's in the dialog you get when you hit the Reply button.
-
Ah OK found it under
REPLY
. That gerrit UI... -
Thanks to all being involved in the discussion.
When answering with 1st and 2nd post I did not expect to create so much fuzz around this issue. With the mass of comments and different references. Therefore, I miss a crucial point here.I am happy with the functionality, since there are good reasons as I expect with the summarized expertize being involved in the discussion. After a couple of trials I was also able to review @aha_1980 's addition to the documentation, which clarifies things generally.
I guess there is still a different behaviour of exist() after the 2 versions of open to be callable. Since the second says that the file is definitely created, it has to be the first open() as used by @Aritz
Personally I would add a short reference to the detailed information section on linux for the first open() version. Something like:
See note on Linux aboveIf my assumption is wrong and the issue with exists() is for both open versions the same, we have a different ambiguity in the documentation respectively a bug in the description for bool QTemporaryFile::open(QIODevice::OpenMode flags) . In this case a reference or modification in documentation is required for second open version.