Bug 445016 - Kate fails to save changes to the running session when it receives a SIGTERM
Summary: Kate fails to save changes to the running session when it receives a SIGTERM
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: sessions (show other bugs)
Version: Git
Platform: Other Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-05 13:50 UTC by Nate Graham
Modified: 2022-03-02 18:41 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 22.04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2021-11-05 13:50:52 UTC
All KDE software built from source this morning on top of Fedora 34.


STEPS TO REPRODUCE
1. Open Kate with a session
2. Open a new file
3. `killall kate` (which sends the SIGTERM signal)
4. Launch Kate again

OBSERVED RESULT
Kate opens with the set of tabs that does not include the file opened in step 2. Changed session data is lost.

EXPECTED RESULT
Kate saves any changed session data (including newly-opened files) when it receives a SIGTERM signal.

IMPACT
Anytime Kate gets quit automatically by the user shutting down or restarting the computer, any changed session data is not saves, causing it to be lost. This is very annoying if the set of files opened in tabs differs significantly at the moment kate is SIGKILL'ed from what it was when Kate was last launched.
Comment 1 Nate Graham 2021-11-05 13:51:22 UTC
(I mean SIGTERM'ed)
Comment 2 Bug Janitor Service 2022-03-02 06:23:34 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/649
Comment 3 Waqar Ahmed 2022-03-02 11:16:44 UTC
Git commit a8a9eb10f4e9159504fd4c58c87bc755114c5b15 by Waqar Ahmed.
Committed on 02/03/2022 at 11:09.
Pushed by waqar into branch 'master'.

Handle SIGINT/SIGTERM to prevent accidental data loss

(linux only)

M  +2    -0    kate/CMakeLists.txt
M  +16   -0    kate/main.cpp
M  +1    -0    shared/CMakeLists.txt
A  +101  -0    shared/signal_watcher.cpp     [License: LGPL(v2.0+)]
A  +37   -0    shared/signal_watcher.h     [License: LGPL(v2.0+)]

https://invent.kde.org/utilities/kate/commit/a8a9eb10f4e9159504fd4c58c87bc755114c5b15
Comment 4 Nate Graham 2022-03-02 16:57:29 UTC
Thank you so much, Waqar!
Comment 5 Christoph Cullmann 2022-03-02 18:41:24 UTC
Will be extended to KWrite in

https://invent.kde.org/utilities/kate/-/merge_requests/651