Bug 383848 - KSyntaxHighlighting 5.37 detects normal text files as poweshell script
Summary: KSyntaxHighlighting 5.37 detects normal text files as poweshell script
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: 5.37.0
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL: https://phabricator.kde.org/D7464
Keywords:
: 383691 383860 384115 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-08-22 12:21 UTC by Till Schäfer
Modified: 2017-08-30 16:35 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.38


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Till Schäfer 2017-08-22 12:21:57 UTC
Since I have upgraded to Kate 17.08.0 (from 17.04.3) all my normal text files are highlighted as powershell script by default (autodetection). The files have a ".txt" extension and not a powershell specific one. 

This is always reproducible.
Comment 1 Till Schäfer 2017-08-22 12:26:43 UTC
seems to be part of frameworks 
-> thus, this was introduced with the update to 5.37
Comment 2 Till Schäfer 2017-08-22 13:21:29 UTC
some more observations: 

settings -> Open/Save -> Modes & Filetypes
- I can see correctly specified file extensions "*.ps1;*.ps1m;*.ps1d". 
- I have noticed that the other entries contain extra mime-types for the specific type (e.g. "application/x-python;text/x-python" for python) type or no mime type (i.e., the empty string). PowerShell does contain the mimetype "text/plain" instead. 
  -> replacing the mime type "text/plain" with the empty string "" fixes the problem.

The mimetype and extension is somewhat ambiguous (as the mime type can declare their own filename pattern (and thus extension)). https://docs.kde.org/stable5/en/applications/katepart/highlight.html does not clearly state how this two properties behave in combination. I guess this is implemented as an AND and the author of the PowerShell file interpreted it as an OR. 

=> Thus, the relation of this attributes should be clearly specified in https://docs.kde.org/stable5/en/applications/katepart/highlight.html and the mime-type should be set to empty in PowerShell.xml
Comment 3 Till Schäfer 2017-08-22 13:23:00 UTC
/s/I guess this is implemented as an AND and the author of the PowerShell file interpreted it as an OR./I guess this is implemented as an OR and the author of the PowerShell file interpreted it as an AND./
Comment 4 Till Schäfer 2017-08-22 13:57:17 UTC
created a path: https://phabricator.kde.org/D7464
Comment 5 Till Schäfer 2017-08-22 16:52:26 UTC
fixed in master: https://phabricator.kde.org/R216:26daf7ee5b4a4534d918ed7d9e66d64cb30b0c26
Comment 6 Dominik Haumann 2017-08-22 20:38:00 UTC
*** Bug 383860 has been marked as a duplicate of this bug. ***
Comment 7 Christoph Feck 2017-08-28 20:26:20 UTC
*** Bug 384115 has been marked as a duplicate of this bug. ***
Comment 8 Christoph Feck 2017-08-30 16:35:06 UTC
*** Bug 383691 has been marked as a duplicate of this bug. ***