Bug 453272 - External tools: forward slash in name causing all tools to disapear
Summary: External tools: forward slash in name causing all tools to disapear
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 22.04.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-01 20:08 UTC by witchhunter
Modified: 2022-07-12 21:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 22.08.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description witchhunter 2022-05-01 20:08:22 UTC
SUMMARY
In External tools settings, adding new tool named with forward slash character creates new folder in ~/.config/kate/externaltools. Upon restart all default tools in before mentioned folder are gone.


STEPS TO REPRODUCE
1. Configure Kate > External tools > Add tool
2. Create new tool which name contains / character 
3. Restart Kate

OBSERVED RESULT
All default tools are deleted including newly added one, or
at best case newly added tool is not in the list.

EXPECTED RESULT
New tool should be added.

SOFTWARE/OS VERSIONS
Operating System: KDE neon Testing Edition, VM
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.3
Kernel Version: 5.13.0-40-generic (64-bit)
Graphics Platform: X11
Comment 1 Christoph Cullmann 2022-05-05 17:58:42 UTC
Could you try this patch?

https://invent.kde.org/utilities/kate/-/merge_requests/735
Comment 2 witchhunter 2022-05-07 12:50:51 UTC
(In reply to Christoph Cullmann from comment #1)
> Could you try this patch?

Sorry I couldn't be of any help. Unfortunately, I'm unfamiliar with compiling languages and trying to build (vanilla) Kate with official  https://kate-editor.org/build-it/  tutorial resulted in errors:
<<<  PACKAGES FAILED TO BUILD  >>>
kglobalaccel - file:///home/v/projects/kde/src/log/2022-05-07-02/kglobalaccel/cmake.log
kxmlgui - file:///home/v/projects/kde/src/log/2022-05-07-02/kxmlgui/cmake.log
kbookmarks - file:///home/v/projects/kde/src/log/2022-05-07-02/kbookmarks/cmake.log
kio - file:///home/v/projects/kde/src/log/2022-05-07-02/kio/cmake.log
kparts - file:///home/v/projects/kde/src/log/2022-05-07-02/kparts/cmake.log
kdeclarative - file:///home/v/projects/kde/src/log/2022-05-07-02/kdeclarative/cmake.log
kinit - file:///home/v/projects/kde/src/log/2022-05-07-02/kinit/cmake.log
kross - file:///home/v/projects/kde/src/log/2022-05-07-02/kross/cmake.log
ktexteditor - file:///home/v/projects/kde/src/log/2022-05-07-02/ktexteditor/cmake.log
knewstuff - file:///home/v/projects/kde/src/log/2022-05-07-02/knewstuff/cmake.log
plasma-framework - file:///home/v/projects/kde/src/log/2022-05-07-02/plasma-framework/cmake.log
baloo - file:///home/v/projects/kde/src/log/2022-05-07-02/baloo/cmake.log
frameworkintegration - file:///home/v/projects/kde/src/log/2022-05-07-02/frameworkintegration/cmake.log
kcmutils - file:///home/v/projects/kde/src/log/2022-05-07-02/kcmutils/cmake.log
kdelibs4support - file:///home/v/projects/kde/src/log/2022-05-07-02/kdelibs4support/cmake.log
knotifyconfig - file:///home/v/projects/kde/src/log/2022-05-07-02/knotifyconfig/cmake.log
krunner - file:///home/v/projects/kde/src/log/2022-05-07-02/krunner/cmake.log
purpose - file:///home/v/projects/kde/src/log/2022-05-07-02/purpose/cmake.log
kate - file:///home/v/projects/kde/src/log/2022-05-07-02/kate/cmake.log
Comment 3 Christoph Cullmann 2022-05-07 17:45:16 UTC
Ok, no problem.

I think in principle this should work, but it needs a bit more love, as otherwise old stuff will lead to duplicated things.
Comment 4 witchhunter 2022-06-04 20:28:40 UTC
(In reply to Christoph Cullmann from comment #3)

Finally, I have managed to build Kate and apply the patch. 
Yea, it seems like an elegant solution and for most part it works fine. However, there is one niche exception:
If the name contains % character, followed by number it will messed up the name shown in the settings window. 

e.g. When tool is saved as "name%5", it causes following output in terminal:
kf.kio.widgets.kdirmodel: protocol mismatch: "" vs "file"
kf.i18n: "Placeholder %1 skipped in message {name%5}."
kf.i18n: "Placeholder %2 skipped in message {name%5}."
kf.i18n: "Placeholder %3 skipped in message {name%5}."
kf.i18n: "Placeholder %4 skipped in message {name%5}."

and the name in the settings window is altered to:
name%5(I18N_ARGUMENT_MISSING)(I18N_GAPS_IN_PLACEHOLDER_SEQUENCE)
Comment 5 Christoph Cullmann 2022-06-12 13:54:55 UTC
Hu, I see, bad :(

Will need to take a look at that again.
Comment 6 Christoph Cullmann 2022-07-12 21:27:19 UTC
Git commit 4c25d449359175127c87c204173541e9b038f14d by Christoph Cullmann.
Committed on 12/07/2022 at 19:32.
Pushed by cullmann into branch 'master'.

avoid that we create invalid file names

e.g. many special characters haev issues, not
just the / mentioned in the bug report

M  +5    -7    addons/externaltools/kateexternaltool.h

https://invent.kde.org/utilities/kate/commit/4c25d449359175127c87c204173541e9b038f14d
Comment 7 Christoph Cullmann 2022-07-12 21:29:13 UTC
Backported to 22.08