Bug 411718 - Dolphin shows the wrong file type for Python
Summary: Dolphin shows the wrong file type for Python
Status: RESOLVED UPSTREAM
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 19.08.1
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-08 15:39 UTC by Christian Janoff
Modified: 2021-01-02 18:34 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Simple example Python file used to describe the bug (110 bytes, text/x-python)
2020-03-21 21:01 UTC, Christian Janoff
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Janoff 2019-09-08 15:39:56 UTC
SUMMARY


STEPS TO REPRODUCE

1. activate "Type" column in Dolphin to be able to see the file type text
2. create new text file "example.py"
3. write "class Example:" as line 1, press Ctrl+S to save

OBSERVED RESULT

a) after step 2: Dolphin shows Python file type
b) after step 3: Dolphin shows "Modelica model" file type
c) shell command "file example.py" says "example.py: Python script, ASCII text executable"
d) even after typing a correct Python class the file type stays "Modelica model"
(Example:
class Example:
    def f(self):
        pass

print('Hello')
)

EXPECTED RESULT

- file type is Python

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: KDE Neon 5.16.4
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 5.62.0
Qt Version: 5.12.3

ADDITIONAL INFORMATION
Comment 1 Christian Janoff 2019-09-08 18:50:09 UTC
I forgot:

Edit the file with Kate.
Comment 2 Elvis Angelaccio 2019-09-09 23:04:56 UTC
(In reply to Christian Janoff from comment #0)
> c) shell command "file example.py" says "example.py: Python script, ASCII

Please show the output of "xdg-mime query filetype example.py"
Comment 3 Nate Graham 2019-09-12 15:55:36 UTC
Are you able to provide the requested information? It would also help to attach an affected file.
Comment 4 Bug Janitor Service 2019-09-27 04:33:06 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Bug Janitor Service 2019-10-12 04:33:08 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 6 Christian Janoff 2020-03-21 21:00:41 UTC
I'm (finally) able to provide the requested info:

"xdg-mime query filetype example.py" returns "text/x-modelica"

I also managed to analyse this further, down to kmimetypefinder5 which gets called by that xdg tool:

"kmimetypefinder5 example.py" returns "text/x-modelica"

while

(non-KDE:) "mimetype --brief --dereference example.py returns "text/x-python".

So it seems to be a kmimetypefinder5 problem.
Comment 7 Christian Janoff 2020-03-21 21:01:54 UTC
Created attachment 126933 [details]
Simple example Python file used to describe the bug
Comment 8 Elvis Angelaccio 2020-03-22 10:53:28 UTC
The problem is in shared-mime-info. Please report it upstream here: https://gitlab.freedesktop.org/xdg/shared-mime-info/issues

Workaround: add a shebang to your python file, e.g. #!/usr/bin/python
Comment 9 David Faure 2020-12-31 20:39:28 UTC
After xdgmime and shared-mime-info changes, the bug can finally be fixed in Qt itself: https://codereview.qt-project.org/c/qt/qtbase/+/328240
Comment 10 Elvis Angelaccio 2021-01-02 18:34:52 UTC
Awesome :)