Bug 508577

Summary: Attempting to invoke inline `git blame` functionality fails and causes `flatpak-session-helper` to consume excessive CPU resources
Product: [Applications] kate Reporter: Nate Graham <nate>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: VERIFIED FIXED    
Severity: normal CC: waqar.17a
Priority: NOR    
Version First Reported In: Git   
Target Milestone: ---   
Platform: Flatpak   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Nate Graham 2025-08-21 20:37:55 UTC
STEPS TO REPRODUCE
1. Install Kate from the nightly Flatpak repo (https://cdn.kde.org/flatpak/kate-nightly/org.kde.kate.flatpakref)
2. Activate the "Git blame" plugin
3. Open a file in a git repo
4. Click on any line of code
5. Click on the faded text to the right of the code that shows the git details of the commit that last touched that line


OBSERVED RESULT
Nothing visibly happens in the app. However a process named `flatpak-session-helper` is spawned and rapidly consumes 25% of a CPU core. Killing it results in Kate showing an error message saying:
> [14:35:33  Git Error] Git blame, show commit failed.


EXPECTED RESULT
A popup showing the commit details

SOFTWARE/OS VERSIONS
Operating System: KDE Linux 2025-08-21
KDE Plasma Version: 6.4.80
KDE Frameworks Version: 6.18.0
Qt Version: 6.9.1
Kernel Version: 6.16.1-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 7840U w/ Radeon™ 780M Graphics
Memory: 16 GiB of RAM (14.9 GiB usable)
Graphics Processor: AMD Radeon 780M Graphics
Comment 1 Waqar Ahmed 2025-08-26 07:32:54 UTC
Git commit 537542367a509055c73670da94feceac6b4add59 by Waqar Ahmed.
Committed on 26/08/2025 at 07:32.
Pushed by waqar into branch 'master'.

Fix infinite loop in git blame

It was assuming that the commit hash is always arg[1] which is not
true in the case of flatpak where the process is invoked via a helper.

So instead, use better logic to find the commit that the process
result is for.

M  +10   -3    addons/git-blame/kategitblameplugin.cpp

https://invent.kde.org/utilities/kate/-/commit/537542367a509055c73670da94feceac6b4add59
Comment 2 Nate Graham 2025-08-26 14:46:42 UTC
Thank you Waqar!
Comment 3 Waqar Ahmed 2025-08-27 09:29:30 UTC
Git commit b666ade925629013103be988760896b9795c6482 by Waqar Ahmed.
Committed on 27/08/2025 at 09:23.
Pushed by waqar into branch 'release/25.08'.

Fix infinite loop in git blame

It was assuming that the commit hash is always arg[1] which is not
true in the case of flatpak where the process is invoked via a helper.

So instead, use better logic to find the commit that the process
result is for.


(cherry picked from commit 537542367a509055c73670da94feceac6b4add59)

Co-authored-by: Waqar Ahmed <waqar.17a@gmail.com>

M  +10   -3    addons/git-blame/kategitblameplugin.cpp

https://invent.kde.org/utilities/kate/-/commit/b666ade925629013103be988760896b9795c6482
Comment 4 Nate Graham 2025-08-27 13:51:20 UTC
Hmm, I'm not seeing this fixed in last night's nightly build. I still get the same result: no inline popup about the commit details, and flatpak-session-helper consumes CPU until killed.
Comment 5 Waqar Ahmed 2025-08-27 14:25:55 UTC
> 1. Install Kate from the nightly Flatpak repo (https://cdn.kde.org/flatpak/kate-nightly/org.kde.kate.flatpakref)

I just installed kate from the url you gave:

> flatpak install --user https://cdn.kde.org/flatpak/kate-nightly/org.kde.kate.flatpakref

 and it seems to work here.
Comment 6 Nate Graham 2025-09-09 14:28:19 UTC
You're right! I had a locally-built Kate that was masking the system-installed nightly version. I can confirm the issue is fixed now.

Thanks so much!