Bug 425829 - KIO regression in how it handles scripts (shell, python, javascript ...etc)
Summary: KIO regression in how it handles scripts (shell, python, javascript ...etc)
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Unclassified
Component: general (show other bugs)
Version: 5.73.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords: regression
: 425431 427362 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-08-26 12:16 UTC by Kai Uwe Broulik
Modified: 2020-10-05 14:42 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.75


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Uwe Broulik 2020-08-26 12:16:11 UTC
SUMMARY
After recent porting to RunOrExecuteJob thingie, it asks whether I want to run or open JavaScript files. This is a regression.


STEPS TO REPRODUCE
1. Open Dolphin
2. Click on a .js file

OBSERVED RESULT
It asks whether I want to run or execute it

EXPECTED RESULT
It opens it in Kate


SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.19.80
KDE Frameworks Version: 5.73.0 git as of 2020-08-25
Qt Version: 5.14.2

ADDITIONAL INFORMATION
Clicking on "Open" also doesn't do anything, I have to click "Run" which then opens it in Kate.

JSON files also appear to be affected. CSS, Plain text, PDFs, PNGs, are not.
Comment 1 Nate Graham 2020-08-26 17:43:11 UTC
All of them or only some? Are they marked as executable?
Comment 2 Nate Graham 2020-08-28 18:05:01 UTC
Can confirm for non-executable files on my own system. This should only happen if the file is actually executable so there *is* an option to execute it.
Comment 3 Christoph Feck 2020-08-28 18:48:36 UTC
Confirmed for .py (Python) files. Previously, I could select between "Execute" or "Open" (in editor), and the choice was respected. Now, "Execute" opens it in the editor, while "Open" does nothing at first, but seems to queue them. A final "Execute" choice will open all queued editor windows.
Comment 4 Kai Uwe Broulik 2020-08-28 20:10:45 UTC
Apparently, application/javascript inherits application/x-executable which has it prompt for executing it. 

isExecutableMime in OpenUrlJob returns true for JS files and potentially others
Comment 5 Kai Uwe Broulik 2020-08-28 20:10:48 UTC
Apparently, application/javascript inherits application/x-executable which has it prompt for executing it. 

isExecutableMime in OpenUrlJob returns true for JS files and potentially others
Comment 6 Kai Uwe Broulik 2020-08-28 20:12:08 UTC
KRun also checked the executable bit before, maybe that's the trick?
Comment 7 Nate Graham 2020-09-03 14:00:34 UTC
*** Bug 425431 has been marked as a duplicate of this bug. ***
Comment 8 Bug Janitor Service 2020-09-15 21:16:13 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/137
Comment 9 Ahmad Samir 2020-09-16 17:31:50 UTC
*** Bug 425177 has been marked as a duplicate of this bug. ***
Comment 10 Ahmad Samir 2020-09-21 17:00:39 UTC
Git commit fdd7c47c85d5d6dbf21e05e7a0d6afcf383f1d24 by Ahmad Samir.
Committed on 21/09/2020 at 12:26.
Pushed by dfaure into branch 'master'.

OpenUrlJob: handle all text scripts consistently

Previously we only handled application/x-shellscript, but there are other
scripts; a script is technically a file that inherits both text/plain and
application/x-executable, e.g. .sh, .csh, .py, perl scripts ...etc. Treat
all those mime types the way we handled shell scripts:
  - if it's not a local url, or isn't executable we open it in the preferred
    text editor
  - if it's executable either show the OpenOrExecute dialog or execute
    directly depending on how the job is configured

The mimetype world is a confusing one:
  - Executables, this includes .exe files (MS Windows); and "application/x-executable"
    and "application/x-sharedlib", this depends on various parameters (e.g.
    stripped executables are x-sharedlib, the same executable if not stripped
    is x-executable...)
  - Scripts: shell, python, perl... etc scripts, which are text files that
    can be executed or opened as text.

Adjust the unit test.
Related: bug 425177
FIXED-IN: 5.75

M  +43   -13   autotests/openurljobtest.cpp
M  +2    -0    autotests/openurljobtest.h
M  +40   -25   src/gui/openurljob.cpp

https://invent.kde.org/frameworks/kio/commit/fdd7c47c85d5d6dbf21e05e7a0d6afcf383f1d24
Comment 11 Nate Graham 2020-10-05 14:42:49 UTC
*** Bug 427362 has been marked as a duplicate of this bug. ***