Page 1 of 1

"Failed to override read-only file" errors

Posted: Tue Nov 21, 2017 4:46 pm
by ColinTaylor
Windows 10 (64-bit) / Codelite 11.0.5

Starting with Codelite 11.0.5, I'm seeing a lot of "Failed to override read-only file" when trying to save an edited file in Codelite. I can't reproduce this issue at will, but it seems most likely to occur if ctrl+S is used immediately after making an edit.

To make matters worse, the situation seems not recover ie typing ctrl+s again a few seconds later still shows the same error message.

The only course of action I've found so far is
[1] Copy the contents of the edited file into (eg) Notepad
[2] Exit codelite and do not try and save the edited file
[3] Start codelite and paste in the edited file from Notepad
[4] Hopefully the file can now be saved *but even this doesn't always succeed*

Does anyone know why this is happening and any ways to prevent it? As things stand I'm having to rollback to codelite 11.0.4.
Thanks, Colin

Re: "Failed to override read-only file" errors

Posted: Tue Nov 21, 2017 4:58 pm
by eranif
Do you get anything in CodeLite log file?
%appdata%\CodeLite\codelite.log

Increase the log verbosity: settings->preferences->misc->Log->Debug

There was a problem when attmpting to write an unsaved file, but issue was fixed...
I don't think I change alot in that area... in the last versions. But I can check

Re: "Failed to override read-only file" errors

Posted: Tue Nov 21, 2017 5:08 pm
by eranif
One thing that comes to mind:
Do you have clang code completion enabled?
If you do, then it's possible that this is the cause of the problem. On Windows, libclang locks the file and you can't write to it until clang complete its parsing

To check if you have clang CC enabled: settings->code completion->clang->enable clang code completion

Turning this OFF should fix your problem

Re: "Failed to override read-only file" errors

Posted: Tue Nov 21, 2017 5:32 pm
by ColinTaylor
Eran, thanks for the speedy response.

I've set the codelite log verbosity to debug and re-created the problem; log file is attached.

I haven't changed anything else yet, but I can confirm that clang code completion is (currently) enabled.

Thanks, Colin

Re: "Failed to override read-only file" errors

Posted: Tue Nov 21, 2017 5:47 pm
by eranif
Disable clang code completion ... and you should be OK

Re: "Failed to override read-only file" errors

Posted: Tue Nov 21, 2017 5:54 pm
by ColinTaylor
Eran, before disabling clang, I looked at the clang search paths and saw that the list contained a huge list of old (and mostly deleted) directories.
I've removed those directories from clang's search paths and with clang code completion still *enabled*, I haven't been able to recreate the "failed to override read-only file" issue.
Early days to say for certain, but perhaps tidying up clang's search paths is maybe a fix for this?

Thanks for your help, Colin

Re: "Failed to override read-only file" errors

Posted: Tue Nov 21, 2017 8:29 pm
by ColinTaylor
As Eran suggests, better to disable clang code completion if you see this error.

Re: "Failed to override read-only file" errors

Posted: Tue Nov 21, 2017 9:00 pm
by eranif
The proper solution will be to pass to libclang a temporary file to parse. this way, the real file is never locked
I will look into this

Re: "Failed to override read-only file" errors

Posted: Tue Nov 21, 2017 11:02 pm
by eranif
I have committed this change: CodeLite will now create a temporary file to pass to libClang instead of passing the real file

Re: "Failed to override read-only file" errors

Posted: Wed Nov 22, 2017 12:56 am
by ColinTaylor
That sounds like a fine solution.
Thanks, Colin