Maintenance tool error: "Cannot open file "" for writing: No error"
-
Have you people looked at the currently on-going https://forum.qt.io/topic/111738/installation-fails-no-file-name-specified ? Perhaps @aha_1980 's https://forum.qt.io/topic/111738/installation-fails-no-file-name-specified/4 ?
-
@JonB Thanks for linking those posts. It seems it is not just a Windows problem after all.
I am using a physical machine yes, the video I posted was on a virtual machine though. However, a laptop I have is running the installer just fine.
I just switched my PC to use wifi and disabled the ethernet adapter but the result is the same, the installer keeps generating the same extension for the temporary file: sZLsZL. On the laptop each time I click to test a repository connection I get a different file.
I will start looking into the QTemporaryFile implementation but another small program I wrote seems to generate temporary files just file.
-
So a little explanation of what the h.. was happening
After my last post, I realised that the Qt Installer wasn't generating a new temporary file resulting in name conflicts as I reported in one earlier post.
This leads me to take a look into
QTemporaryFile
implementation since I was pretty sure that the installer was using this class to generate new temporary files.Looking into the source code for
QTemporaryFile
I found the loop where the random string was being generated.QTemporaryFile
can generate unique file names based on a name template defined with X's in a string.I adapted that piece of code to print the generated name:
int main(int argc, char *argv[]) { // qsrand(uint(std::time(0))); QString s(6); s.resize(6); for(int i = 0; i < 6; ++i) { char ch = char((rand() & 0xffff) % (26 + 26)); if (ch < 26) s[i] = Latin1Char(ch + 'A'); else s[i] = Latin1Char(ch - 26 + 'a'); } qDebug() << s; return 0; }
Note that the call to
srand()
is commented out. Running this program will produce the exact same result each time since the seed wasn't initialised properly. But that is expected. What is not expected was the following message being printed when running my simple program:WARNING: CPU random generator seem to be failing, disable hardware random number generation
WARNING: RDRND generated: 0xffffffff 0xffffffff 0xffffffff 0xffffffffIt turns out that I have an AMD Ryzen CPU, and this warning was being emitted because of a faulty BIOS, as reported in this forum.
So I updated my BIOS to the latest version and voila, the warning is gone and the installer works again.
The reason I couldn't get it working on my second machine was because I was using a virtual machine in the same CPU. The laptop is an Intel Core CPU.
I never thought I would see a BIOS update fix some apparently unrelated program. It was a fun investigation. I would like to say thanks to @hskoglund for the patience and all the tips.
Solution:
If you have an AMD Ryzen CPU, update the BIOS.
-
Thanks for your effort and sharing of source.
Just for completeness
#include <QString> #include <QDebug> typedef ushort Char; static inline Char Latin1Char(char ch) { return ushort(uchar(ch)); } int main(int argc, char *argv[]) { // qsrand(uint(std::time(0))); QString s(6); s.resize(6); for(int i = 0; i < 6; ++i) { char ch = char((rand() & 0xffff) % (26 + 26)); if (ch < 26) s[i] = Latin1Char(ch + 'A'); else s[i] = Latin1Char(ch - 26 + 'a'); } qDebug() << s; return 0; }
Basically one can use this as main.cpp with a QtCoreApplication template.
Tested with Qt5.14.1 for MinGW 64 bit. -
Looks like the problem (or a similar one) has been around for a while now? https://www.phoronix.com/scan.php?page=news_item&px=AMD-CPUs-RdRand-Suspend
-
@JKSH It seems to be a combination of the hardware not returning random numbers and the fact that it looks like the Qt installer doesn't initialise a random seed like
qsrand(uint(std::time(0)))
. I might be wrong since I don't have access to the actual source code.If you take my snippet and run it on AMD with the
qsrand()
callrand
seems to work fine. -
I'm using ryzen too, the ryzen 5 3600, and encounter this issue...
I update the latest bios that my computer manufacturer (Lenovo) provided, still the problem exists.
However, your post remind me that I can kill the process directly while the error come about, and other parts of Qt seems working properly...amazing!
Anyway, much thanks . I will update the bios again when the new version come out.