Re: Gnome applications and .bash_profile

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

 



On 11/02/09 04:28, quoth Suvayu Ali:
> Hi Steven,
> 
> On Sunday 01 November 2009 09:32 PM, Steven W. Orr wrote:
>> On 10/31/09 03:39, quoth Jonathan Ryshpan:
>>
>> IT IS WRONG to set environment variables in your .bashrc unless you
>> really
>> know what you're doing. Most people don't. IT IS WRONG to have to run a
>> terminal emulator program with the idea that it should be a login
>> shell. ALL
>> PROGRAMS use the environment, not just terminal emulators. If you log
>> in then
>> your environment should be defined.
>>
> 
> What is your comment on the method I posted, have your .bash_profile
> source your .bashrc ? That way you have a consistent environment every
> time, irrespective of whether I am at an xterm or VT or simply running
> some GUI app from a menu or icon. (I am of course assuming my desktop
> environment sources my .bash_profile, as it should, when I login :) )
> 
> Would you say that is a proper way to do things?
> 

It is correct that the .bash_profile should source in the .bashrc but it is
wrong for a terminal emulator to be executed as a login process to account for
gdm's deficiency.

First of all your .bash_profile should source in your .bashrc or else you
won't get any of your bashrc content in your login process. Starting a login
process must run your .bash_profile and starting a sub shell process must run
the .bashrc  This means that the .bashrc must be run by the .bash_profile or
else the login process will never get any of your local aliases, functions and
variable settings.

This confuses a lot of people:

* When you log in, the login process must define the environment. This is done
by sucking in the ~/.bash_profile after the /etc/profile

* The ~/.bashrc is sucked in automatically only by sub shells. To get bashrc
content added to your login shell, the ~/.bash_profile must pull in the ~/.bashrc

* The /etc/bashrc is not run by the system. The user is responsible for doing
this himself. In your ~/.bashrc should be a line that says:
  . /etc/bashrc

All of what I describe above is how things should be done, but it is *wrong*
for the gdm login process to not run the correct files for you in the first
place. That is why I have showed you how to go about the process of fixing it
properly. You need to see about pulling in the /etc/profile and
~/.bash_profile from the /etc/X11/xinit system. You will *probably* be able to
add a file (maybe call it) /etc/X11/xinit/xinitrc.d/00_bash_init.sh  It should
say something like what I mentioned above. I recommend *not* making it
executable even though all of the files in /etc/X11/xinit/xinitrc.d are. This
just confuses people more. Sourced files are not executed; they are read into
a current shell.

If you do it wrong then you will be putting a crappy bandage on a system that
is capable of much elegance. The whole point of environment variables is to
define what *all* child processes will inherit. Look at the env command. It's
not about what you see as being used by bash. It's about what the getenv(3)
and setenv(3) runtime calls make available to all child processes,
irrespective of what language they are written in. The environment is agnostic
about linguistics.

Let's look at an example. In my environment, I define XFILESEARCHPATH and
XUSERFILESEARCHPATH. If I do it then my applications will start up with the
correct set of resources. If I don't then they will not. But what I will not
accept is that I must start my applications from a terminal emulator that was
artificially started with a --login option. That's just silly. If I want to
create a button that run my application then I expect that button to be
running in the proper environment that has those variables set to the values
that I have defined.

Make sense?

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux