Bug 296590

Summary: Kate can not edit a file for which I have the write access
Product: [Applications] kate Reporter: maxime.haselbauer
Component: applicationAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: adaptee, aditsu, alex.wauck+kdebugs, cabup2m, christoph, dweeble01103, germano.massullo, holy, jeason133, mte90net, oss, thing1138, yasuna, zanetu
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: This is the File where my error occurs

Description maxime.haselbauer 2012-03-22 22:09:31 UTC
Kubuntu 11.10 32 bit KDE 4.8.1
Following the discussion in
http://forum.kde.org/viewtopic.php?f=22&t=100816

I tried to edit a file with kate for which I did had the write access.
Kate wasn't able to edit it 
Not that it did not save, but hitting a key  or deleting characters did not work at all. File was untouchable

Sadly I do not have the file anymore because the day after muon destroyed my whole system

The discussion on the forum shows that it might be a rare bug but it happened to someone else to
Comment 1 bill p. (aka google01103) 2012-03-22 22:24:59 UTC
per the forum and my own experience this is caused by a very large line(s) and also per the forum  (a poster believes that) Kate refuses to allow editing of the file because it might (will?) corrupt the file, again, because of the large line(s)
Comment 2 jeason133 2012-04-22 17:14:39 UTC
I have the same problem but my file is small and i can edit it with an other editor like gedit or if i rename the file
Comment 3 maxime.haselbauer 2012-04-23 22:00:56 UTC
@bill.p I think this is another problem my file was the ressource configuration file of Kdevelop (the rc files that contains configuration for the ui) also, no gigantic lines in there

Apparently jeason has issue with small files too. Also, I guess if a devlopper comes here, he can tick the bug as confirmed

@jeason if you still have this file, maybe you can attach it there, so that developers might be able to see it?
Comment 4 jeason133 2012-04-28 10:10:50 UTC
Created attachment 70720 [details]
This is the File where my error occurs
Comment 5 Alexander Wauck 2012-05-07 23:30:14 UTC
The happened to me, too.  Oddly enough, the file in question was a copy of a file created with Kate!  It should be noted, though, that the file was created with Kate 4.7, and I attempted to edit it with Kate 4.8.  I can edit the RenderWindow.cpp just fine with Kate 4.8.
Comment 7 Tim Holy 2012-05-28 15:11:13 UTC
I saw the forum post before noticing this bug report. Here's a copy of the reply I posted there:

The same issue bit me. I tried copying the file to a new name, and kate could edit it fine, so I knew it wasn't a problem with the file.

So I poked around in .kde and found this file: ~/.kde/share/apps/kate/metainfos. It seems to contain a listing of metadata for each file in kate's (recent?) history. I found the troublesome file, and saw that the "ReadWrite" tag had been set to "false". I changed it (using a different text editor for safety!), and presto, I can edit my file again.

I have no idea what triggered the ReadWrite setting to change, but now that I know about this, I'll be alert for it. If anyone else discovers the pattern and can reproduce it, clearly that would be helpful to the developers.

Extra note: the original file had been created by kate, I was able to edit it for several months using kate, and suddenly one day kate stopped being able to make changes. That was long enough ago that I can't remember what conditions might have triggered the problem.
Comment 8 Joel 2012-06-01 14:06:39 UTC
Adding some data.
I have the same problem
I use to work with ubuntu 11.10 with kate. And i edit files with no problem with kate.
When i upgrade to 12.04 (clean install) and try to edit the SAME files i cant.
It happend with some files, not for all.
I have permisions and i can edit with Gedit or another similar programs.

Kate V. 3.8.3
KDE 4.8.3
Comment 9 Joel 2012-06-01 14:10:28 UTC
Another thing. I solved the problem as it said the previus post about length. 
1)settings > configure editor > open/save
2) line length limit = 0
The value 0 means that there is no maximum.
Comment 10 Joel 2012-06-01 14:12:40 UTC
My bad. It's not solved. Just appear as normal file (without the grey background in the name when you open) but still can't edit.
Comment 11 Tim Holy 2012-06-01 14:39:21 UTC
Did you look at ~/.kde/share/apps/kate/metainfos? (See above.) It solved the problem for me.
Comment 12 Dominik Haumann 2012-06-02 08:16:38 UTC
Did you try to disable Tools > [ ] Read Only Mode ?
Comment 13 Daniele Scasciafratte 2012-06-10 13:59:56 UTC
i can confirm sometimes i have this problem.
the only solution it's editing with an editor that not use kate part :-/
Comment 14 maxime.haselbauer 2012-07-07 09:12:56 UTC
max@netbook:~/.kde/share/config$ ll kmail2rc 
-rw------- 1 max max 44314 Jul  7 10:03 kmail2rc

sudo kate kmail2rc  	-> can't edit it
kate kmail2rc		-> can't edit it...
Comment 15 Tim Holy 2012-07-08 13:46:17 UTC
Does the solution in comment #7 fix it?
Comment 16 Gerald Senarclens de Grancy 2012-07-18 10:06:13 UTC
I've had the same issue trying to edit a file in KDevelop 4.3.1 using KDE Development Platform 4.8.4. All out of a sudden I could not edit a file anymore. Other files in the same project still worked fine. Renaming the file from within KDevelop also worked. Editing it even with Kate also worked - just not from within KDevelop.
Comment #12 solved the problem for me (in KDevelop Editor->Tools->Read only mode) -> thanks Dominik. I have no idea how this flag got set b/c there is no shortcut to enable/ disable read only mode in my configuration.
Comment 17 Gerald Senarclens de Grancy 2012-07-18 10:09:27 UTC
Note: hitting [Ctrl]+[s] on the (in my case) protected file opened the Save File dialog (which is natural when the file is in read only mode, but maybe a little feedback why this happens could save others time).
Comment 18 thing1138 2012-07-30 14:08:50 UTC
It took both comment #7, and comment #9 to fix the "read only" problem on my setup. Since those two solutions fixed the problem I didn't get a chance to see if comment #12 would have implemented the same result as comments #9.

Relevant specs:
OS: Kubuntu 12.04 Precise (64bit)
OD: KDE 4.8.4
Qt: 4.8.1
KDE Development Platform: 4.8.4 (4.8.4)
Kate: 3.8.4

Question:
--------------
Can someone please change the status of this bug to confirmed? It seems as if enough installations are having this problem that the status should be changed, or does it depend on finding out whats causing the problem first before it can be confirmed?
Comment 19 aditsu 2012-08-15 20:04:42 UTC
kwrite refused to let me modify a file that had a line longer than 1024 characters, and it gave me
*** ABSOLUTELY NO WARNING *** and
*** ABSOLUTELY NO VISUAL INDICATION ***
that it was in read-only mode (that information is hidden in the tools menu)
This is unacceptable.
If it does that, then it MUST show a big warning dialog with the information from comments 1, 9 and 12, and read-only mode MUST be accompanied by an indication in the status bar or title bar.
However, I can't imagine why any sane person would ever want to set the default line length limit to anything other than 0 (unlimited).
Comment 20 aditsu 2012-08-15 20:05:55 UTC
*** This bug has been confirmed by popular vote. ***
Comment 21 Germano Massullo 2012-09-11 16:03:33 UTC
Confirming the bug also on KWrite



(In reply to comment #15)
> Does the solution in comment #7 fix it?

Yes but only on Kate, not on KWrite
Comment 22 Christoph Cullmann 2012-11-01 01:02:51 UTC
kate.git master has a fix, you will get a warning. Beside will remove this ReadOnly mode again from session config.
Comment 23 Christoph Cullmann 2012-11-01 01:04:21 UTC
Git commit 0f4414795b986bcd7e4e4c5d63183c202efb61c1 by Christoph Cullmann.
Committed on 01/11/2012 at 02:03.
Pushed by cullmann into branch 'master'.

don't store read-only in session config
this is too confusing for users, once per accident you once click a warning away about "this is now read-only" you will never edit that file again if you don'T see the read-only flag

M  +0    -10   part/document/katedocument.cpp

http://commits.kde.org/kate/0f4414795b986bcd7e4e4c5d63183c202efb61c1
Comment 24 Joel 2013-04-26 14:23:54 UTC
Comment #12 works too. I just test it in another file with the same problem. Save it and when i re-open works fine. 
"Did you try to disable Tools > [ ] Read Only Mode ?"

Thanks