Bug 417248

Summary: html file received a perl file icon if it has "use strict" or "use warnings" in it
Product: [Plasma] kde-cli-tools Reporter: Zesko <zeskotron>
Component: generalAssignee: Aleix Pol <aleixpol>
Status: RESOLVED UPSTREAM    
Severity: minor CC: bugzilla, elvis.angelaccio, faure, kdelibs-bugs, kfm-devel, nate
Priority: NOR    
Version: 5.18.0   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=417761
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Test case file

Description Zesko 2020-02-06 21:00:48 UTC
SUMMARY:

KDE Dolphin recognizes the HTML file as a Perl file, when a line of code "use strict" was written in it, but Perl file is not for the browser.

https://forum.kde.org/viewtopic.php?f=223&t=164476&p=428073#p428060


Manjaro 18.1.5 / KDE 5.66.0 / Plasma 5.17.5
Comment 1 Nate Graham 2020-02-06 22:26:34 UTC
Can you run a command in Konsole and send the output?

`file --mime-type path_to_your_file`
Comment 2 Zesko 2020-02-07 17:16:05 UTC
(In reply to Nate Graham from comment #1)
> Can you run a command in Konsole and send the output?
> 
> `file --mime-type path_to_your_file`

wrong.html: text/html
Comment 3 Nate Graham 2020-02-07 18:05:52 UTC
Do you see the wrong icon when the file is viewed in Dolphin, or when it is on the desktop, or in both?
Comment 4 Zesko 2020-02-07 18:18:02 UTC
(In reply to Nate Graham from comment #3)
> Do you see the wrong icon when the file is viewed in Dolphin, or when it is
> on the desktop, or in both?


I copied the wrong icon(Perl)-file and then pasted it into Dolphin. It seems right HTML Icon.
If I open it with whatever editor and then save it in Dolphin, the HTML-icon will automatically switch to the wrong (Perl-)Icon.
Comment 5 Zesko 2020-02-07 18:20:01 UTC
(In reply to Nate Graham from comment #3)
> Do you see the wrong icon when the file is viewed in Dolphin, or when it is
> on the desktop, or in both?

in both
Comment 6 Nate Graham 2020-02-07 18:37:05 UTC
Created attachment 125750 [details]
Test case file

Bizarre. Can confirm.

It seems like some code somewhere is unconditionally checking for "use strict" to determine which icon to show.
Comment 7 Zesko 2020-02-07 18:41:45 UTC
(In reply to Nate Graham from comment #6)
> Created attachment 125750 [details]
> Test case file
> 
> Bizarre. Can confirm.
> 
> It seems like some code somewhere is unconditionally checking for "use
> strict" to determine which icon to show.

Other code line "use warnings" too.
Comment 8 Nate Graham 2020-02-07 18:43:34 UTC
Dolphin isn't responsible for this, but I'm not 100% sure what piece of code is. Starting with KIO.
Comment 9 Zesko 2020-02-07 18:48:19 UTC
(In reply to Nate Graham from comment #8)
> Dolphin isn't responsible for this, but I'm not 100% sure what piece of code
> is. Starting with KIO.

I checked it in KDE Neon in VM, but there is no issue in KDE Neon.
Manjaro KDE has this issue.
Comment 10 Elvis Angelaccio 2020-02-23 00:09:49 UTC
(In reply to Nate Graham from comment #6)
> Created attachment 125750 [details]
> Test case file
> 
> Bizarre. Can confirm.
> 
> It seems like some code somewhere is unconditionally checking for "use
> strict" to determine which icon to show.

It's shared-mime-info.

I'm not sure the attached test case is a valid HTML file (why would you put a perl script in a HTML page?).
If it is, then the bug should be reported upstream at: https://gitlab.freedesktop.org/xdg/shared-mime-info
Comment 12 Bastien Nocera 2020-02-25 16:48:00 UTC
(In reply to David Faure from comment #11)
> Fixed:
> https://gitlab.freedesktop.org/xdg/shared-mime-info/commit/
> 18bb7cfc6c43d710ecf60339b5dd9bd19c297cdf

Could you please make sure to file a merge request instead of pushing directly to master?
Comment 13 Zesko 2020-04-09 20:57:26 UTC
I think they did.

https://gitlab.freedesktop.org/xdg/shared-mime-info/-/tree/master/
Comment 14 David Faure 2020-04-23 22:32:02 UTC
Bastien: OK. I thought this one was pretty non-controversial, but I'll use merge requests in the future.
Comment 15 Bastien Nocera 2020-04-24 08:31:23 UTC
(In reply to David Faure from comment #14)
> Bastien: OK. I thought this one was pretty non-controversial, but I'll use
> merge requests in the future.

It's not about controversy, there's a CI that makes sure that no regressions happen, and we want to make sure they're triggered before things get merged.