[Interest] QSettings problem.

Bill Crocker william.crocker at analog.com
Tue Apr 17 16:08:30 CEST 2018


I have several users which are experiencing a problem
using my app, which uses QSettings.

It appears that sometimes the underlying settings configuration
file is does not appear to exist and the QSettings system resets
back to the beginning of time, loosing all settings.

All of my users run on virtual machines and have home directories
across NFS on Netapp based file servers.

We experienced this problem many years ago with non-Qt apps.

     You call the 'C' library open function
     and it behaves as if the file does not exists.
     Investigation showed that in many cases, the file really did exist
     and was completely readable.

The solution (as stupid as it sounds) was to stat() (sys/stat.h) a file
which did not appear to exist and then try to open it again.
In all cases, if the file really does exist, it will then open.

     FILE *fd = fopen(file_name);
     if( ! fd ) {
         /* int sz = */ file_size(file_name);  // file_size uses stat()
         fd = fopen(file_name);

     Problem solved in my other apps.

Rhetorical: Is this a Netapp issue, Is this an NFS issue. Is this an
issue with how we are using Netapp, NFS, Virtual machines...
There are too many people to blame and too many opportunities for finger pointing.
It was not practical to pursue any of that.

Dear Qt: It is not a perfect world.

So, how do I fix my QSettings problem.



More information about the Interest mailing list