"Failed to override read-only file" errors

General questions regarding the usage of CodeLite
ColinTaylor
CodeLite Expert
Posts: 152
Joined: Fri Jul 15, 2011 2:49 pm
Genuine User: Yes
IDE Question: C++
Contact:

"Failed to override read-only file" errors

Post by ColinTaylor » Tue Nov 21, 2017 4:46 pm

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

User avatar
eranif
CodeLite Plugin
Posts: 5934
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

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

Post by eranif » Tue Nov 21, 2017 4:58 pm

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
Make sure you have read the HOW TO POST thread

User avatar
eranif
CodeLite Plugin
Posts: 5934
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

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

Post by eranif » Tue Nov 21, 2017 5:08 pm

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
Make sure you have read the HOW TO POST thread

ColinTaylor
CodeLite Expert
Posts: 152
Joined: Fri Jul 15, 2011 2:49 pm
Genuine User: Yes
IDE Question: C++
Contact:

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

Post by ColinTaylor » Tue Nov 21, 2017 5:32 pm

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
You do not have the required permissions to view the files attached to this post.

User avatar
eranif
CodeLite Plugin
Posts: 5934
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

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

Post by eranif » Tue Nov 21, 2017 5:47 pm

Disable clang code completion ... and you should be OK
Make sure you have read the HOW TO POST thread

ColinTaylor
CodeLite Expert
Posts: 152
Joined: Fri Jul 15, 2011 2:49 pm
Genuine User: Yes
IDE Question: C++
Contact:

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

Post by ColinTaylor » Tue Nov 21, 2017 5:54 pm

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

ColinTaylor
CodeLite Expert
Posts: 152
Joined: Fri Jul 15, 2011 2:49 pm
Genuine User: Yes
IDE Question: C++
Contact:

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

Post by ColinTaylor » Tue Nov 21, 2017 8:29 pm

As Eran suggests, better to disable clang code completion if you see this error.

User avatar
eranif
CodeLite Plugin
Posts: 5934
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

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

Post by eranif » Tue Nov 21, 2017 9:00 pm

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
Make sure you have read the HOW TO POST thread

User avatar
eranif
CodeLite Plugin
Posts: 5934
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

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

Post by eranif » Tue Nov 21, 2017 11:02 pm

I have committed this change: CodeLite will now create a temporary file to pass to libClang instead of passing the real file
Make sure you have read the HOW TO POST thread

ColinTaylor
CodeLite Expert
Posts: 152
Joined: Fri Jul 15, 2011 2:49 pm
Genuine User: Yes
IDE Question: C++
Contact:

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

Post by ColinTaylor » Wed Nov 22, 2017 12:56 am

That sounds like a fine solution.
Thanks, Colin

Post Reply