File commander sometimes silently fails to execute script

Issue #663 resolved
prl created an issue

If a shell script has a .sh extension, the FileCommander gives it a "shell script" icon and tries to execute it when OK is pressed when the script has focus.

If the script doesn't have execute permission, it will fail to run, but no error message is displayed in the Console screen it is run from.

The problem is particularly bad if the shell script normally produces no output.

Replication steps

In the commandline interface, create a short shell script in a convenient location on the Beyonwiz., e.g:

root@beyonwizu4:~# cat hello.sh 
echo Hello world
root@beyonwizu4:~#

and ensure it has no execute permissions:

root@beyonwizu4:~# chmod a-x hello.sh

Then from live TV, MENU>Sources / Files to enter the FileCommander, navigate to the folder containing the script. It should have the :/# icon to indicate that it is a shell script. Navigate so that it has focus, and press OK. The Console window is shown, but there is no unambiguous indication that there was an execution error. Its output Hello world is not shown.

EXIT to return to the FileCommander.

In the commandline interface change its permissions to allow execution, e.g:

root@beyonwizu4:~# chmod a+x hello.sh

Then in FileCommander, press OK again, and the script executes correctly and displays Hello world in the Console screen.

Comments (1)

  1. Peter Urbanec

    Fix bug #663: File commander sometimes silently fails to execute script

    In key_actions: Change do_run_script() so that it checks that the script is readable and issues an error MessageBox if not. Checks whether the script is executable and runs it directly if it is and runs it as "sh script" if it is not.

    In do_run_script(), clean up the use of self.commando where the length-one tuple is used to create a new length-one tuple: (self.commando[0],). Change those cases to simply use self.commando.

    → <<cset d93f4a253be5>>

  2. Log in to comment