Bug 499482

Summary: Kate randomly stashes documents
Product: [Applications] kate Reporter: Dominik Kummer <admin>
Component: applicationAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: branch8475, christoph, waqar.17a
Priority: NOR    
Version First Reported In: 24.12.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Dominik Kummer 2025-02-03 23:41:56 UTC
While working on multiple documents in a kate session every now and then
the document is suddenly saved as "HOME/.local/share/kate/stash/MySession.katesession/Document 51"
which is just annoying when I actually want to write into the original file.
Comment 1 Waqar Ahmed 2025-02-04 13:37:31 UTC

*** This bug has been marked as a duplicate of bug 497478 ***
Comment 2 Waqar Ahmed 2025-02-12 11:52:51 UTC
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 497478

M  +11   -1    apps/lib/katestashmanager.cpp

https://invent.kde.org/utilities/kate/-/commit/41ee6adfdc3f94099ac40b47e2d12b2187eb37f5
Comment 3 Waqar Ahmed 2025-02-12 11:57:49 UTC
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 497478
(cherry picked from commit 41ee6adfdc3f94099ac40b47e2d12b2187eb37f5)

M  +11   -1    apps/lib/katestashmanager.cpp

https://invent.kde.org/utilities/kate/-/commit/48dbbdb3cd2628df73a2b9391ff767de4798f10d
Comment 4 Dominik Kummer 2025-03-15 16:33:13 UTC
this bug still persists with kate 24.12.3 and is super annoying. I finally worked around this issue by removing write permission from stash directory. So now kate every now and then tells me that it needs permission to stash, without actually stashing.
Comment 5 Waqar Ahmed 2025-03-15 17:10:03 UTC
You can just disable Automatically save and restore.. Option under session settings

Besides that, please share the steps to reproduce the problem. That will make the issue easier to fix and will be a far more useful contribution.
Comment 6 Dominik Kummer 2025-03-15 18:37:53 UTC
I already described the bug as good as possible when opening the report initially. I am just using kate normally (open multiple files to edit them).

1. Open multiple files in a session
2. Edit files

Observed:
Unsaved files are saved to HOME/.local/share/kate/stash/MySession.katesession/ and the editor suddenly points to that stashed file silently. During focused work it happens that one is editing the stashed file, wondering why the changes dont show any effect (eg configuration etc)

Expected:
Unsaved files shall be stashed into HOME/.local/share/kate/stash/MySession.katesession/ in background. The original file shall stay open.
Comment 7 Waqar Ahmed 2025-03-15 20:50:18 UTC
You misunderstood me. I fully understand what the bug is and whats happening.

What I asked was a step by step way to 100% reproduce the bug always.

We auto save the session if any file is opened/closed(with a delay). The bug must happen during that saving, but the current logic that I am looking at, makes this bug impossible. So there must be something super weird going on.

I would suggest closing all instances of Kate first. Then reopen it and try to reproduce the bug, preferably with a new session.
Comment 8 Dominik Kummer 2025-03-16 20:20:20 UTC
I see. You are right, its most probably my existing session. I will observe the issue with my session and post further details! Thanks!
Comment 9 Christoph Cullmann 2025-03-16 21:21:47 UTC
https://invent.kde.org/utilities/kate/-/merge_requests/1755

current code might just save to original file on close, that should be fixed with that request
Comment 10 Christoph Cullmann 2025-03-18 22:32:16 UTC
*** Bug 501111 has been marked as a duplicate of this bug. ***
Comment 11 Bug Janitor Service 2025-04-02 03:46:46 UTC
๐Ÿ›๐Ÿงน โš ๏ธ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 12 Bug Janitor Service 2025-04-17 03:47:02 UTC
๐Ÿ›๐Ÿงน This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.