Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Atom opens a new file called ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT=false

Tags:

atom-editor

Whenever I start Atom it opens two files, one called:

ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT=false

And the other one:

/usr/bin/atom

It's really annoying and I don't understand how to fix it. From what I understand it is some sort of environment configuration bug, but I can't find what's causing it.

like image 544
Yoana G Avatar asked Jul 01 '20 16:07

Yoana G


1 Answers

I am going to make several assumptions. You are running on Ubuntu and you've installed Atom via Snap.

If these assumptions are correct the cause of the issue is a misconfigured application menu item from the Snap package author.

To fix it you just need to run this command:

sudo sed -i 's/Exec=env BAMF_DESKTOP_FILE_HINT=\/var\/lib\/snapd\/desktop\/applications\/atom_atom.desktop \/snap\/bin\/atom ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT=false \/usr\/bin\/atom %F/Exec=env BAMF_DESKTOP_FILE_HINT=\/var\/lib\/snapd\/desktop\/applications\/atom_atom.desktop ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT=false \/snap\/bin\/atom %F/' /var/lib/snapd/desktop/applications/atom_atom.desktop

TL;DR {

Here is a detailed explanation of what's causing the issue and what the command above does. It may be useful if the file has been changed since the answer was written.

The actual cause for the bug is that this menu item file:

/var/lib/snapd/desktop/applications/atom_atom.desktop

It has a typo in it and what should be environment variables are set after calling the atom executable, resulting in Atom treating it as arguments in the form of files that it should open.

#                                                                                     ▼ Executable   ▼ Not an environment variable                   ▼ Not an executable
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/atom_atom.desktop /snap/bin/atom ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT=false /usr/bin/atom %F

It should instead be:

#        ▼ Environment variable                                                       ▼ Environment variable                          ▼ Executable
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/atom_atom.desktop ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT=false /snap/bin/atom %F

The solution above uses sed to search and replace the file and fix the issue.

}

NOTE: The command will work until the Snap author updates the menu item file (.desktop) when hopefully the issue would have been resolved.

like image 171
Itay Grudev Avatar answered Nov 17 '22 02:11

Itay Grudev