shell scripts are opened in a texteditor

Bug #695437 reported by Patrick Ulbrich on 2010-12-29
98
This bug affects 21 people
Affects Status Importance Assigned to Milestone
Synapse
Low
Jeremy Munsch

Bug Description

whenever i choose a shell script in synapse, it only provides options to open it in various text editors instead of executing it.
The default behaviour of textfiles with the +x attribute should be execution.

Related branches

Patrick Ulbrich (pulb) on 2010-12-29
summary: - shell scripts are opened in texteditor
+ shell scripts are opened in avtexteditor
summary: - shell scripts are opened in avtexteditor
+ shell scripts are opened in a texteditor
Michal Hruby (mhr3) wrote :

I disagree that it should be default action, but yes, it should be possible to run executable files.

For the time being you can type it with full path and it'll be picked up by command plugin, which will allow to run it.

Changed in synapse-project:
status: New → Confirmed
importance: Undecided → Low
milestone: none → backlog
RapierTG (rapier) wrote :

I second, that it should be executed by default, becouse default option should be the one that is used most frequentlly. I think that scripts are executed more frequentlly that edited.

Note, that *.desktop are opened in text editor also, while this have almost no sense at all. It could be nice if it was executed.

Nikodemus Siivola (nikodemus) wrote :

No, please, god, don't make execution the default.

Or at least allow users to configure this. Or even, better, use a voting scheme to decide what to do.

Andre Parodi (andre-parodi) wrote :

I have a number of helper bash script which i usually want to run with the least number of keystrokes possible. So I would vote in favor or execute as a default.

however i think a better way would be to "simply" remember what the last action was for this item and do that every time. If I allways execute "restart-tomcat.sh" then this script should default to execute. If i usually edit .bashrc then default that to edit.

my 2c.

Martin Gontovnikas (gonto89) wrote :

You can actually do a little trick and execute a script right now.
If after the name of the script you press spacebar, then you will be able to run it.
After that, Zeitgeist will recognize it and under the applications tab you will be able to run it

pt123 (pt123) wrote :

yes it needs a run option like Gnome-Do, remembering the last action would be extremely useful and productive.

The point of having script files is to run them, not to view them. So run should be the default action.

Gnome-Do unfortunately screws ups the most used command for the script file.

upkpk (upkpk) wrote :

Another option would be to add an "execute" action in the TAB-menu for executable files, and keep "edit file" as a default. Allowing execution of scripts with no further confirmation (a bit like nautilus does) is dangerous in my opinion.

halcyon (halcyon-wild) wrote :

Might be a bit late to this thread.

I am missing the Everything search engine functionality a lot. The everything search engine for Windows is here - http://www.voidtools.com/

Synapse comes closest. Everything executes the file, if you press Enter. Else you can right click and choose other options. There is no option to right click and select further action in Synapse. This one feature will solve not just the above issue, but also similar issues with other file types. For example, if you search an audio file, just right click and choose if you want to open its containing folder, see its properties, or play it with default player.

The best part about Synapse over other similar tools is that it is easy to open with shortcut, press down arrow to see all results, scroll to the desired item in the result list using arrow key and press Enter. The next logical step would be to press the context menu key (or right click, if one prefers to move the hands away from the keyboard to the mouse).

Please consider.

jashsu (jashsu) wrote :

This is by far the biggest annoyance I have with Synapse, and I hope there is some consideration to at least add an option or keybind/shortcut for "execute" instead of open for scripts.

Ari (ari-lp) wrote :

I also disagree with the bug reporter. Yes, there should be an option to execute shell scripts from Synapse. But no, this should not be the default action.

And to those of you that are in need of a similar functionality: Why not simply create a .desktop launcher for your shell script?

Vadim Peretokin (vperetokin) wrote :

To be fair, the OS does not provide an easy way to create them.

Ari (ari-lp) wrote :

It's true that Ubuntu has stopped shipping with the appropriate editing tool, but you can just install it with

    sudo apt-get install gnome-desktop-item-edit

You could then proceed to write a Nautilus script like this:

    #!/bin/bash

    gnome-desktop-item-edit --create-new ~/.local/share/applications

and install it by moving it to ~/.gnome2/nautilus-scripts. That gives you easy access to .desktop file creation from your file manager's context menu.

This is not as straightforward as it was on earlier versions of Ubuntu, but that's not Synapse's fault. I don't think Synapse's developers should have to fix Canonical's strange packaging decisions.

tchick (monsorno-nospam) wrote :

As synapse is a "launcher" app, it should launch commands. I wouldn't expect from a launcher that it let me edit the commands that I type. Furhtermore I do not understand, why it should handle shell scripts differently than other commands. For that +1 for making this the default.

MoMaT (momat) wrote :

I agree with the reporter, files with +x should be executed by default. If you want to edit, you press TAB and choose "open with ...".

Changed in synapse-project:
assignee: nobody → Jeremy Munsch (jeremy-munsch)
status: Confirmed → In Progress
Changed in synapse-project:
milestone: backlog → 0.2.99.2
status: In Progress → Fix Committed
Ari (ari-lp) wrote :

I appreciate the renewed activity and development progress with Synapse, but I would highly recommend against making this behaviour the new default. I would still argue that scripts that are not located in the PATH have no place being executed by Synapse.

Quite a lot of shell scripts can be dangerous to execute without controlling their arguments and/or working directory. Take an installation script for instance. This is something you would usually only want to run once and not have quick access to via a launcher.

Seeing how easy it is to haphazardly select the wrong entry in Synapse with just one or two key strokes, I would urge you to revert this change and rework it into a contextual action and/or a toggleable option.

Jeremy Munsch (jeremy-munsch) wrote :

While a toggleable option would be definitely need to be implemented, I have to say that dangerous scripts may often need to be run as sudoer.
Its also as easy to run a script with zsh or bash accidently (even not as easy but still), many of them may handle that case.

I would say that dangerous scripts are likely to be written by users themselves. And running them on synapse of with autocompletion or bad alias would be as dangerous.

I need also to say that hidden files are not handled.

I would say that :
 - an option need to be implemented to disable execute executable files by default
 - run in terminal need to be in second position for executable files

Options are stored in json file for the record
 http://synapse.zeitgeist-project.com/wiki/index.php?title=Plugins/Configuration

Jeremy Munsch (jeremy-munsch) wrote :

Also the wiki would need a fix/rewrite because bots have access to it and are spamming.
Its also almost impossible to find some pages, I’ve found some by deeply searching on web or the synapse launchpad project.

This could help to spread updated info on ho to use synapse.

Ari (ari-lp) wrote :

> I would say that :
> - an option need to be implemented to disable execute executable files by default
> - run in terminal need to be in second position for executable files

I think this would a great start, but I am still not convinced that executing scripts should be the default.

> I have to say that dangerous scripts may often need to be run as sudoer.

People often say this, especially in regards to malicious code, but to me a rogue script deleting my home directory and personal documents within sounds way more frigthening than any modification to system files could ever be.

> Its also as easy to run a script with zsh or bash accidently (even not as easy but still), many of them may handle that case.

It's true that navigating the terminal can be dangerous, but what we are talking about is a completely different issue altogether.

Most users will anticipate the dangers associated with the power of the CLI and act accordingly when they're in a terminal, carefully treading their way through whatever commands they might issue. It's quite the opposite when using a GUI: We have grown accustomed to having feedback and warnings for dangerous actions; for instance, most file managers will invoke a confirmation dialog when clicking on an executable file, asking the user if they really want to execute the script (opening it in a text editor being the default action, for good reasons!).

The current implementation goes completely against the expectations your average user has grown accustomed to while using other applications such as Nautilus, Thunar, Krunner or even the Unity dash. Not executing scripts by default in a GUI context is a standard UX practice. If you are going to change something like that you need to have some very good reasons – and I just don't see them here.

The number of people 'affected' by this issue on launchpad does not constitute a good metric to base decisions like these on. Most users will never visit this page, nor have the need for quick access to a script through a launcher. But if this stays the default, I can assure you that quite a lot of unsuspecting users _will_ come here complaining about unexplained behaviour, data loss, and whatever else might occur because of haphazard script executions – that is, if they ever come to realize that Synapse was at fault.

All it takes is just one badly programmed icon theme installation script.

Jeremy Munsch (jeremy-munsch) wrote :

I also need to say that when you download copy script in a new file it is not executable by default. So a script may be executed once before meaning the user wanted that. Now I see your worries, and I have to say I do not have a magical solution to make every one happy. So if you do have any suggestions please put them here.

Ari (ari-lp) wrote :

I think we should go with a slightly modified version of your proposal:

 - an option to _enable_ executing executable files by default
 - run in terminal as the second position for executable files if the option isn't set

This should satisfy everyone asking for this feature while also making sure that your average user won't stumble on this without knowing what they're doing.

Changed in synapse-project:
status: Fix Committed → Fix Released
Khurshid Alam (khurshid-alam) wrote :

This completely breaks text file handling. Now it tries to execute css file instead of openning it in gedit. I have to press tab->open to make it work. Is there any way I can make this default for css and scss files?

Ari (ari-lp) wrote :

Recently updated to the latest Synapse revision and was surprised by this change. As a dev this change has made Synapse an absolute mine field to navigate. I have hundreds of executable scripts that I regularly work on, but that have absolutely no reason to be executed from my graphical launcher.

For instance, why would I want to launch a build script for one if my projects outside of its project directory? What if the script is lazily coded and tries to remove files it shouldn't remove?

In my opinion this change is an absolute nightmare, and I have absolutely no clue why anyone in here supported it. If you want to launch your scripts, move them to your $PATH. It has worked liked that for ages. This change goes against every launcher UX paradigm established over the past few years and is frankly incredibly dangerous.

Ari (ari-lp) wrote :

I've just submitted a new bug report to rework this change. If you are negatively affected by this modification to Synapse's behaviour, and are still subscribed to this bug report after all these years, please voice your support here: https://bugs.launchpad.net/synapse-project/+bug/1763360

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions