User forums > Help
don't edit source
Jenna:
@olipfei:
I will have a look.
I use ext3 as linux fs, but I don't have problems with vfat partitions either, if I remeber right (I have aproject on a vfat, but mount a subdir of it with bind option).
Jenna:
@olipfei:
It's not really a C::B problem.
We use the wxCopyFile-function to make a copy of the file, because it respects the file permissions.
wxWidgets does that by a call to the chmod-function.
And that's the problem.
On a vfat-partition you can not have really file-permissions or ownership, so they are set statically at mount-time.
They cannot be changed, even root can't do that.
If you are not the owner of the file and try to change it's permissions you get an error, but on the vfat in your case the owner is always root.
For all other users the wxCopyFile will therefore return an error, and lead our Save()-function to return an error, too.
There is no easy (cross-platform) way to work around this.
A possible solution would be to tell the user that a backup-file might not exist and ask, if he wants to try to write the file anyway.
But that is a dangerous thing, because there could be a real cause that leads to this error (either a hdd-error or the disk might be full) and so the user might lose data.
So I think the best and cleanest solution would be to set the ownership correctly.
By the way:
Even the owner of a file can not really change the permission on a vfat-partition, but he does not get an error if he tries it.
So in this case the wxCopyFile-function works.
olipfei:
Hmmmmmm...
After I posted the above message it came to my mind that so far I completely ignored the second player in the whole match: wxWidgets. So I did some further tests with the programs I wrote using the wx library, and with the same setting as for CB they also produced an error (which I don't recall at the moment, working on Windows right now) when saving data to the vfat partition. However, I do not use wxCopyFile anywhere in my code, the function concerned is wxTextFile::Write(). Any idea if there could be a common ground? Should I submit a bug report to the wx tracker?
Btw thanks for the explanation and sorry for erroneously suspecting CB!-)
Regards,
Oliver
Jenna:
--- Quote from: olipfei on March 24, 2009, 02:22:59 am ---Btw thanks for the explanation and sorry for erroneously suspecting CB!-)
--- End quote ---
No problems.
If I interprete the message sent by wxTextFile::Write (in debug-mode) correctly, it tries to create a temporaryfile.
The wxTempFile constructor calls it's own Open()-function and there it tries to set file permissions via systems chmod-call.
This call fails for the same reasons as in wxCopyFile.
So it's a problem of wxWidgets, that should ignore that it's impossible to set the file permissions if we are on a mounted vfat (or similar).
Navigation
[0] Message Index
[*] Previous page
Go to full version