Bug 50678 - removal of "-login" from bash invocation of Xsession causes environment variables to be lost
Summary: removal of "-login" from bash invocation of Xsession causes environment varia...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: tcsh
Version: 1.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Eido Inoue
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-08-02 00:42 UTC by Jonathan Kamens
Modified: 2007-04-18 16:35 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-08-21 18:01:10 UTC
Embargoed:


Attachments (Terms of Use)

Description Jonathan Kamens 2001-08-02 00:42:15 UTC
Run "bash -c set > /tmp/non-login" and "bash -login -c set > /tmp/login". 
Then run "diff /tmp/non-login /tmp/login".  You will see that when bash is
run as a login shell, it sets various variables that it doesn't set
otherwise, and it changes the settings of some other variables.  The most
interesting of these is MAIL, which isn't set at all when bash isn't a
login shell.  As a result of this, the recent change from "#!/bin/bash
-login" to "#!/bin/bash" in /etc/X11/xdm/Xsession has caused the default
setting of the MAIL environment variable to be lost.

It needs to be put back somewhere.  Perhaps it doesn't belong in xinitrc --
perhaps it belongs in something in /etc/profile.d.  But it shouldn't just
disappear.

Comment 1 Havoc Pennington 2001-08-02 03:54:34 UTC
Is bash your user shell?

The session is now launched as "exec -l $SHELL -c gnome-session"
(s/gnome-session/whatever you use/g).

Try this:
 unset MAIL
 bash
 exec -l $SHELL 
 echo $MAIL

For me MAIL is then set.

I'm not at work now, but tomorrow I'll check a test machine to see if $MAIL is
set for the entire X session as it should be.
If bash is not your shell, the problem may be that /etc/csh.login does not set
up $MAIL. Or an alternative solution is to re-add the --login at the top of
Xsession, but leave the exec -l part later in Xsession as well. This would then
make a login tcsh shell into a child of a login bash shell, so it would inherit
environment variables. I tend to think this is broken though, fixing
/etc/csh.login is likely more appropriate.

Comment 2 Jonathan Kamens 2001-08-02 10:41:18 UTC
Tcsh is my login shell.

Obviously, if bash were my login shell, I wouldn't have this problem :-).


Comment 3 Havoc Pennington 2001-08-02 13:38:58 UTC
So we should either re-add the --login for now (but leave the exec -l $SHELL
bit) as a short-term hack, or reassign to tcsh and be sure we sync /etc/profile
to /etc/csh.login. I guess should reassign to tcsh even if we add the --login hack 
for now.

Comment 4 Mike A. Harris 2001-08-08 15:39:56 UTC
After prior discussion with hp, --login stays as it is "the right thing",
reassigning to tcsh.  tcsh should mirror bash's startup more WRT
the login scripts.

Comment 5 Havoc Pennington 2001-08-08 16:03:52 UTC
Hang on, --login isn't the right thing, it's just a workaround for tcsh not 
having what it should in csh.login. (It's fine to put --login back for this
release, just let's remember to take it out again for 8.0)

Comment 6 Mike A. Harris 2001-08-08 16:25:04 UTC
Sorry hp, bad wording on my part.  What I meant was, -login is gone
now, and stays gone.  I was convinced in our emails that it was
correct, but may cause odd problems in other broken things, now we
know that it is not far reaching, and so they aren't major issues.
I plan on keeping it without the -login to bash.  Sorry for the bad
explanation above..

Fix tcsh is the solution.  In the past, using tcsh out of the box
wouldn't have worked correct anyway, so leaving the new way doesn't
lose anything IMHO, but gains the correct way of doing this at least
in xinitrc.  Now when tcsh is fixed (a few hours work really), all
should be well for tcsh users.  Other shells aren't very important
such as ksh/whatever IMHO as they are virtually unused in the big
picture.  That is another bug report if true...

Comment 7 Jim Radford 2001-08-20 17:48:54 UTC
       exec -l $SHELL -c xterm -geometry 80x24-0-0

Should be

       exec -l $SHELL -c "xterm -geometry 80x24-0-0"

Comment 8 Mike A. Harris 2001-08-21 18:01:05 UTC
Fixed in xinitrc in rawhide



Note You need to log in before you can comment on or make changes to this bug.