Bug 446273

Summary: Unhelpful error message shown when attempting to run malformed shell script with space before shebang
Product: [Frameworks and Libraries] frameworks-kio Reporter: cotasamnemano53253
Component: generalAssignee: KIO Bugs <kio-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: a.samirh78, kdelibs-bugs, nate, rakuco
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: This is the problematic bash file

Description cotasamnemano53253 2021-11-30 13:20:08 UTC
Created attachment 144079 [details]
This is the problematic bash file

SUMMARY

STEPS TO REPRODUCE
1. I create the following bash file with executing permission
2. I click on the file to execute it

OBSERVED RESULT

- I was promted with:

Unknown error code 100
execvp: Exec format error
Please send a full bug report at https://bugs.kde.org

- Although the script run find in the terminal
- And I did include "#! /usr/bin/bash" at the start of my file


SOFTWARE/OS VERSIONS

Qt: 5.15.2
KDE Frameworks: 5.88.0
kf5-config: 1.0
Comment 1 Raphael Kubo da Costa 2021-11-30 17:12:54 UTC
"buildsystem" isn't the right product here, moving to "frameworks-kio".

The problem's in the space character before the shebang in the first line. While kio detects that this is an executable shell script, I think this goes all the way down to QProcess via KProcessRunner and possibly to Linux's detection of scripts (which verifies that the first two characters are "#!"). I agree the error message is very cryptic though.
Comment 2 Nate Graham 2021-12-01 22:45:31 UTC
That's a pretty bad error message, yeah. We can do better.
Comment 3 Ahmad Samir 2022-05-05 11:45:32 UTC
I couldn't reproduce this issue with e.g.:
#! /usr/bin/bash
/usr/bin/kfind &

works OK, and kfind is opened.

Do you still see this issue?
Comment 4 Nate Graham 2022-05-05 21:24:24 UTC
Is there a space *before* the shebang in your test script?
Comment 5 Ahmad Samir 2022-05-05 21:35:37 UTC
Viewing plain text is misleading in web browsers, looking at the attachment again it's " #! /usr/bin/bash". Retesting, now I see the issue.

IIRC this is the error message we get from the system/kernel, not sure how it can be improved...