when a script is not a script according to krun...

ian reinhart geiser geiseri at yahoo.com
Tue Mar 30 20:15:45 BST 2004

David Faure said:
> On Tuesday 23 March 2004 15:34, ian reinhart geiser wrote:
>> Greetings,
>> I have a question about scripts with KDE.  I have a few perl, python and
>> javascript scripts that all open with a text editor always.  Now if i
>> have
>> a normal bash based shell script with a .sh ending it will open with a
>> text editor when chmod -x and will open as an application if chmod +x.
> I don't see this here: with chmod -x, nothing happens when clicking on a
> .sh file.
> KRun tries to execute it, and
> /bin/sh: line 1: /k/kdialog.sh: Permission denied
> Maybe it depends on the shell.
Hrm, this is odd could you email me the script, cause on my debian system
it executes a shell script chmod +x, but if its not chmod +x, it opens in
the text editor.

>> I was unclear of  how we detect .sh files to run, although I think thats
>> because I had no
>> clue where to start and grep was unhelpful at that point.
> krun.cpp executes files recognized as
> mimetype=="application/x-shellscript"
> (since it also executes application/x-executable ones, etc. )
I cannot get this to work.... let me play some more.

> So the question is the mimetype determination.
> The pattern *.sh is associated with application/x-shellscript, so any *.sh

> OTOH I don't know a good solution to that, so honouring the execute bit is
> also fine by me. I don't think we want to use a different mimetype
> depending
> on it though, so this would require e.g. a modified version of
> KRun::isExecutable()
> that also takes the mode of the file.
> Then we can add perl/python/kjsembed scripts there and add a test +x for
> all mimetypes (except x-desktop).
I truly do not want this to be a mime type issue.  This is because
sometimes scripts dont end in .sh, or .py they can have normal names. This
is horribly common with one of my evil clients TCL scripts. I also believe
for security issues that we should only execute the script if its been
chmod +x.  This way accidentally people dont click on a script in email
and it runs.  They should only run after the user has explicitly asked for
it.  I believe the argument that us executing scripts is bogus, if we
respect the execute bit, but this my NSHO ;)

Is this something that is possible for KDE 3.3?  I think modification of
the KRun::isExecutable() sounds like the most scalable solution.  Since we
wont have to add in a million different scripting languages.

-ian reinhart geiser


More information about the kde-core-devel mailing list