Bug 269518 - [Patch] Swap file should have other extention or be placed elsewhere
Summary: [Patch] Swap file should have other extention or be placed elsewhere
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 269568 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-27 07:49 UTC by Öyvind Saether
Modified: 2022-07-16 14:18 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
This little trival patch must solve the problem. (429 bytes, patch)
2011-03-27 22:53 UTC, yar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Öyvind Saether 2011-03-27 07:49:57 UTC
Version:           unspecified (using KDE 4.6.1) 
OS:                Linux

I have a local webserver where I edit .php files for WP and other CMS systems. Some CMS systems include *.php in given folders. 

The way kate handles swap files means I frequently get this when loading web pages:

"Kate Swap File - Version 1.0SRURURUR UR4URUEtrue"

great. this is because kate saves files like .swp.test.php when you're editing test.php. it is possible to work around this annoying bug with

 while true;do if [ -f .swp* ];then rm .swp*;fi;done

but the better solution would be to name those swap files something else, place them somewhere else or give them some other extention. I also don't see why kate would need to go about saving swap files to disk when editing 100 line long files, but that's another matter.

Reproducible: Always

Steps to Reproduce:
1. run wp or whatever which loads *.php in some file
2. edit some php file
3. kate saves broken php files

Actual Results:  
broken websites

Expected Results:  
working sites
Comment 1 yar 2011-03-27 22:53:36 UTC
Created attachment 58379 [details]
This little trival patch must solve the problem.
Comment 2 Öyvind Saether 2011-03-28 05:20:12 UTC
Patch looks excellent. THANK YOU VERY MUCH!!!!!!

I'm changing bug status to resolved as fixed (please unchange if this doesn't make it in to head, I assume it will).
Comment 3 Erlend Hamberg 2011-03-28 07:42:20 UTC
whoa, whoa. chill. it's not fixed until it's fixed. :-)
Comment 4 Milian Wolff 2011-03-28 10:13:15 UTC
*** Bug 269568 has been marked as a duplicate of this bug. ***
Comment 5 Milian Wolff 2011-03-28 10:13:46 UTC
how is vim naming it's files?
Comment 6 Erlend Hamberg 2011-03-28 11:08:42 UTC
vim uses “.filename.cpp.swp”.
Comment 7 Dominik Haumann 2011-03-28 21:30:45 UTC
fine with me, should be backported to KDE 4.6.2 as well. Anyone?
Comment 8 Dominik Haumann 2011-03-30 00:46:15 UTC
Git commit 42b9c2a192469d8a8926a17c6586f38c4367afb3 by Dominik Haumann.
Committed on 30/03/2011 at 00:48.
Pushed by dhaumann into branch 'master'.

change swap file name to .<filename>.kate-swp

BUG: 269518

M  +2    -1    part/swapfile/kateswapfile.cpp     

http://commits.kde.org/kate/42b9c2a192469d8a8926a17c6586f38c4367afb3
Comment 9 tagwerk19 2022-07-16 14:18:52 UTC
(In reply to Dominik Haumann from comment #8)
> ... change swap file name to .<filename>.kate-swp
Cross referencing:
    https://bugs.kde.org/show_bug.cgi?id=394750#c15

Baloo has had an exclusion added for *.swp files (as created by vim, see Bug 433095), this exclusion doesn't work for *.kate-swp. The 'repeated reindexing' impact on system performance is likely similar.

The impact *may* differ as a mimetype lookup of the kate-swp file comes up with:
    $ kmimetypefinder .testfile.txt.kate-swp
    application/x-font-tex-tfm
Parallel issue perhaps...