Summary: | Kate forgets names and paths of unsaved files on session restore. | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | Arttu <arttuc> |
Component: | sessions | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | major | CC: | admin, danielroschka, flipflop, groszdanielpub, houz, KDE, navid.zamani+kde, ped, tbertels, tsuther, valdikss, vkrevs, waqar.17a |
Priority: | NOR | Keywords: | regression |
Version: | 24.12.0 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/utilities/kate/-/commit/48dbbdb3cd2628df73a2b9391ff767de4798f10d | Version Fixed In: | |
Sentry Crash Report: | https://crash-reports.kde.org/organizations/kde/issues/116767/events/304f856aedca44c297f0125dd8f4ea0d/ | ||
Attachments: | Video of the bug |
Description
Arttu
2024-12-14 23:39:37 UTC
I can confirm this, the "Automatically save and restore: Files with unsaved changes" makes the editor rename any edited file to "Document #" randomly when switching tabs or opening other files, etc (I guess whenever it does refresh saved session data). This makes this setting in my use case completely unusable, as I often have 30+ tabs open with different .asm files and editing 2-3 files at same time, so I would end up editing files in kate session folder instead of the file I started to edit. (updated KDE neon, Kate 24.12.0) Same here with 24.12.0, it worked well until recently (probably before the 24.12.0 update). This also occasionally happens without quitting and restoring. I've just found that a tab I'd edited a few minutes ago had mutated into Document 4 corresponding to some katesession file, while I didn't close Kate in the meantime. I think it's also happened a few other times. I haven't been able to figure out when it happens. The things I did before it included making a Git stash (from the terminal) involving edits to that tab, making some more edits to that tab and amending the last commit (from Kate's Git plugin), popping the stash (from the terminal) which needed merging (with git mergetool invoked from the terminal). I opened the Quick Open tool just before I noticed the Document # bug, but IIRC I didn't open any file from it. I use a split view, and I think the file in question was open on both sides. Just to comment further on Daniel's observations. I'm having the same issue he describes: Kate randomly switching to the stashed version of my open tabs (e.g. "~/Documents/file.txt" suddenly becomes "~/.local/share/kate/stash/Default.katesession/Document xx"). I couln't find the logic behind when it happens, it's intermittent, but doesn't happen that frequently. I don't open files from Git repos in Kate, so I can confirm that it has nothing to do with Git. (In reply to Grósz Dániel from comment #3) > This also occasionally happens without quitting and restoring. I've just > found that a tab I'd edited a few minutes ago had mutated into Document 4 > corresponding to some katesession file, while I didn't close Kate in the > meantime. I think it's also happened a few other times. > > I haven't been able to figure out when it happens. The things I did before > it included making a Git stash (from the terminal) involving edits to that > tab, making some more edits to that tab and amending the last commit (from > Kate's Git plugin), popping the stash (from the terminal) which needed > merging (with git mergetool invoked from the terminal). I opened the Quick > Open tool just before I noticed the Document # bug, but IIRC I didn't open > any file from it. I use a split view, and I think the file in question was > open on both sides. I'm still not sure exactly what triggers it, but it's often just starting to edit a file (maybe something related to automatic saving?), and it happens quite frequently lately, making Kate nearly unusable. Created attachment 177234 [details]
Video of the bug
Here's the video how it happens. It usually occurs if you open the file and start immediately edit it, especially paste anything from the clipboard.
I lost many data due to this, and constantly have to check whether the file has been saved.
Most probably it happens only with "Kate configuration - Session - Automatically save-restore: files with unsaved changes" checkbox ticked. Most likely a regression from "periodically saving a session". The `Automatically save and restore` options are experimental atm. Same here - seems to be directly related to "Automatically save and restore: Newly-created unsaved files" setting being enabled. *** Bug 499085 has been marked as a duplicate of this bug. *** I found the trigger: I can reliably reproduce it happening without a need to close Kate or reload a session. All you need, is to be in a session, open a document, and change it. it is *instantly* renamed to “Document #”, with # being the number of opened documents, starting at 0. And the on-disc location is set to „$HOME/.local/share/kate/stash/${session}.katesession/Document #”. So it is impossible to save the changes, and closing the file LOSES THE CHANGES. (Technically, they are saved to “Document #”, but opening any other file that happens to re-named to that, will of course overwrite it.) I literally cannot edit that file with Kate anymore. I had to use another editor! @Developers: Can you look in the logic that checks if the document has been changed (compared to the on-disk version)? In there, inside a conditional that checks if we are in a session, the bug should be found. (I can verify that it doesn’t happen if we’re not in a session. Even with the same exact file being opened and changed.) (In reply to valdikss from comment #7) > Most probably it happens only with "Kate configuration - Session - > Automatically save-restore: files with unsaved changes" checkbox ticked. Yes, I disabled that (as well as the presumably related "Newly-created unsaved files" just in case), and it hasn't happened since then. (In reply to navid.zamani+kde from comment #11) > I found the trigger: > > I can reliably reproduce it happening without a need to close Kate or reload > a session. > All you need, is to be in a session, open a document, and change it. I don't think that *always* triggered it for me, when I had the above options enabled. *** Bug 499482 has been marked as a duplicate of this bug. *** Git commit 41ee6adfdc3f94099ac40b47e2d12b2187eb37f5 by Waqar Ahmed. Committed on 12/02/2025 at 11:51. Pushed by waqar into branch 'master'. Fix documents being stashed during session We must use a temp doc otherwise we overwrite the url of the active doc. Related: bug 499482 M +11 -1 apps/lib/katestashmanager.cpp https://invent.kde.org/utilities/kate/-/commit/41ee6adfdc3f94099ac40b47e2d12b2187eb37f5 Git commit 48dbbdb3cd2628df73a2b9391ff767de4798f10d by Waqar Ahmed. Committed on 12/02/2025 at 11:56. Pushed by waqar into branch 'release/24.12'. Fix documents being stashed during session We must use a temp doc otherwise we overwrite the url of the active doc. Related: bug 499482 (cherry picked from commit 41ee6adfdc3f94099ac40b47e2d12b2187eb37f5) M +11 -1 apps/lib/katestashmanager.cpp https://invent.kde.org/utilities/kate/-/commit/48dbbdb3cd2628df73a2b9391ff767de4798f10d |