GNOME Bugzilla – Bug 747783
$PATH variable incorrect for applications started from Nautilus
Last modified: 2021-06-18 15:33:28 UTC
When I start an application through Nautilus, the $PATH variable is just "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin". Paths added e.g. in /etc/profile are missing. Steps to reproduce: 1. Open gnome-terminal using the Shell. Run "echo $PATH". In my case: /home/uli/GNUstep/Tools:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/mplus/7.2 2. Right-click in a Nautilus window and click "Open in Terminal". Run "echo $PATH" again. I get: /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin The $PATH is also incomplete when, for example, I use Nautilus to load a file in Emacs and then start a Shell within Emacs. I'm using Nautilus 3.16.0 on Arch Linux. There was no such problem with 3.14. PCManFM does not have this problem either.
Prior to 3.16 in the case of nautilus-open-terminal there was a workaround which involved setting the gnome-terminal option "run command as login shell" but this no longer works. When looking at the environment of nautilus itself it looks like none of the variables set in the profile files get propagated (I checked the exported variables of ~/.bash_profile with the environments of gnome-terminal, firefox, epiphany and nautilus but only nautilus doesn't inherit these).
I can confirm it also, is not loading the file /etc/profile. Is very easy to debug it, just compare environment variables from gnome-terminal with the "open terminal" from nautilus. Nautilus 3.16.2 on Gentoo. As Ulrich, I haven't this problem on 3.14.
This bug does not just affect the $PATH variable but every other user-specified environment variable as well. In my case, I set some (G)Vim specific environment variables in ~/.profile, which are then correctly propagated to Gnome shell. Gvim works just fine when launched from the shell. When I then double-click a file in Nautilus, my environment is not honored.
Still a problem in 3.18. I need to set GDK_CORE_DEVICE_EVENTS=1 to have reasonable scrolling in LibreOffice GTK3 but this variable is not propagated by Nautilus when opening a document (works fine when LibreOffice is started from the shell or terminal).
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version of Files (nautilus), then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/nautilus/-/issues/ Thank you for your understanding and your help.