[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How To Permanently Add-to a Users PATH Statement in the Bash Shell



* On 2020 08 Jul 08:38 -0500, Greg Wooledge wrote:
> There are lots of choices here.  And this is with only the login shell
> layer involved -- no X11 or Wayland.

Good points and it must be emphasized that ~/.profile or ~/.bash_profile
are for *login* shells only.  Ordinarily shells started from a GUI
terminal emulator are not login shells though there is usually an option
that can be ticked to invoke the shell as a login shell.

> That's interesting, but I'm not sure I fully trust that test you
> performed.  I don't know whether the "Run Command dialog" is doing
> something secretly.  I'd prefer to check the actual starting environment
> of one of the GNOME processes.  I don't know what their names are, but
> assuming you can find one that looks like it was started at the time
> you logged in, grab its PID and then do something like this:
> 
> tr \\0 \\n < /proc/its_pid_here/environ | grep your_variable_here
> 
> That will show you the initial environment of that process, without
> letting "Run Command" get involved to do any tricky stuff.
> 
> If it turns out that the Wayland session really does dot in ~/.profile,
> that's yet another reason why you need to ensure that it remains
> shell-neutral.  I would imagine that Wayland dots it in from a POSIX
> shell (the same way the Debian X11 session dots in ~/.xsessionrc from
> a POSIX shell).

My test was not exhaustive, but I did run your command and with Gnome on
Wayland and any variables I had set in ~/.profile appeared in the
environment of processes running as my username such as gnome-shell.
Trying the same on a Buster VM with Xfce on Xorg showed that variables
set in ~/.profile did not appear in the environment of a running process
such as xfce4-panel or xfdesktop.

Most likely Debian uses dash to source the ~/.profile and ~/.xsessionrc files

A quick test shows that Gnome on Wayland does not source ~/.xsessionrc,
however Gnome on Xorg does appear to source both ~/.profile and
~/.xsessionrc (tested from a cold start).  In this case it is my guess
that it is Gnome that is sourcing ~/.profile independent of the GUI
environment it is running on.

I think this is as far down this road as I care to go!

- Nate

-- 

"The optimist proclaims that we live in the best of all
possible worlds.  The pessimist fears this is true."

Web: https://www.n0nb.us
Projects: https://github.com/N0NB
GPG fingerprint: 82D6 4F6B 0E67 CD41 F689 BBA6 FB2C 5130 D55A 8819

Attachment: signature.asc
Description: PGP signature


Reply to: