Treat "application/x-ms-dos-executable" as executable on all platforms
ClosedPublic

Authored by guoyunhe on Mon, Oct 7, 11:11 AM.

Details

Summary

Because of Wine, *.exe can be executed in almost all desktop platforms.

The dialog will open when a script/exe/binary is clicked.

For scripts, it shows "Open" and "Execute" button. Same as before.

For *.exe on Linux/BSD, it shows only "Execute" button, but it actually does "Open with Wine".

For native binary, it shows only "Execute" button. This is a new difference. I think users should never click and run a binary without warning. Here is already a showUntrustedProgramWarning pop up function. But it only popup for binary without execute bit. If you get a binary from *.tar.gz or *.7z, it may already have a execute bit and no popup will be appear.

BUG: 412694

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
guoyunhe created this revision.Mon, Oct 7, 11:11 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptMon, Oct 7, 11:11 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
guoyunhe requested review of this revision.Mon, Oct 7, 11:11 AM
ngraham edited the summary of this revision. (Show Details)Mon, Oct 7, 3:04 PM
ngraham added a subscriber: ngraham.

Maybe can we check to see if WINE is installed or if there's a handler for application/x-ms-dos-executable? Otherwise if you don't have WINE installed, won't you see a dialog that gives you the option to execute it when that doesn't work?

Maybe can we check to see if WINE is installed or if there's a handler for application/x-ms-dos-executable? Otherwise if you don't have WINE installed, won't you see a dialog that gives you the option to execute it when that doesn't work?

It is another feature. We also need to check if PHP/Python/Perl/Ruby/Node.js is installed for other script types. It is not Wine specific problem but a general issue for all executable that requires an interpreter.

ngraham accepted this revision.Mon, Oct 7, 3:35 PM
ngraham added a subscriber: dfaure.

I suppose that's true. Would be nice to also do that as a follow-up patch.

Shipit!

@dfaure given the security implications here, maybe we should get this into 5.63. What do you think?

This revision is now accepted and ready to land.Mon, Oct 7, 3:35 PM

I just realized that this patch might be unfinished. In the pop up, you usually have "Open", "Execute" and "Cancel". But for *.exe, "Open" is actually to be executed by Wine? "Execute" will do nothing because it isn't a native executable for Linux/BSD.

guoyunhe updated this revision to Diff 67444.Mon, Oct 7, 5:22 PM

"openAsExecute" parameter for ExecutableFileOpenDialog

guoyunhe retitled this revision from Treat "application/x-ms-dos-executable" as executable on all platforms to WIP: Treat "application/x-ms-dos-executable" as executable on all platforms.Mon, Oct 7, 5:34 PM
guoyunhe edited the summary of this revision. (Show Details)
guoyunhe updated this revision to Diff 67458.Mon, Oct 7, 8:30 PM

Fix *.exe execution condition

guoyunhe added a comment.EditedMon, Oct 7, 8:41 PM

It is now working. The condition is so complex. Please help test this patch!

guoyunhe retitled this revision from WIP: Treat "application/x-ms-dos-executable" as executable on all platforms to Treat "application/x-ms-dos-executable" as executable on all platforms.Mon, Oct 7, 9:11 PM
guoyunhe edited the summary of this revision. (Show Details)
guoyunhe edited the summary of this revision. (Show Details)Mon, Oct 7, 9:16 PM
ppeter added a subscriber: ppeter.Tue, Oct 8, 12:38 PM
ppeter added inline comments.
src/widgets/executablefileopendialog.cpp
58
if (mode == OnlyExecute)
  connect(executeButton, ...)
else if (mode == OpenAsExecute)
  ...

looks better :)

GB_2 added a subscriber: GB_2.Tue, Oct 8, 12:46 PM
GB_2 added inline comments.
src/widgets/executablefileopendialog.cpp
58

That would be against the common KDE coding style: https://community.kde.org/Policies/Kdelibs_Coding_Style#Braces

dfaure requested changes to this revision.Fri, Oct 11, 11:02 PM
dfaure added inline comments.
src/widgets/krun.cpp
1101

should this be in ifdef Q_OS_WIN?

On windows, *.exe is executed, not opened (with e.g. wine)

This revision now requires changes to proceed.Fri, Oct 11, 11:02 PM
guoyunhe updated this revision to Diff 67761.Sat, Oct 12, 7:15 AM

*.exe should be normal executable in Windows

guoyunhe marked an inline comment as done.Sat, Oct 12, 7:16 AM
guoyunhe added inline comments.
src/widgets/krun.cpp
1101

Yes, I updated this part.

dfaure accepted this revision.Tue, Oct 15, 6:21 AM
This revision is now accepted and ready to land.Tue, Oct 15, 6:21 AM
This revision was automatically updated to reflect the committed changes.