Bug 86361 - xdm does not start proper login shell
Summary: xdm does not start proper login shell
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: XFree86
Version: 7.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: X/OpenGL Maintenance List
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-03-20 17:03 UTC by David Sachs
Modified: 2007-04-18 16:52 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-09-29 19:08:17 UTC
Embargoed:


Attachments (Terms of Use)

Description David Sachs 2003-03-20 17:03:53 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Q312461)

Description of problem:
login via xdm apparently does not create a proper login shell process. 

In particular, if the user's default shell is bash, the .bash_profile 
and .bash_logout scripts are not run at the proper times.

Version-Release number of selected component (if applicable):
XFree86-xdm-4.2.0-8

How reproducible:
Always

Steps to Reproduce:
1.Set up Linux machine with xdm (x windows)
2.Create user with bash as login shell
3.Create .bash_profile and .bash_logout scripts for this user whose execution 
can be verified.
4.Log in and check if .bash_profile has been run
5.Log out from xdm session and check for .bash_logout having been run
    

Actual Results:  Commands in the .bash_profile, and .bash_logout were never run.

Expected Results:  Commands in .bash_profile should be run as soon as user logs 
in BEFORE his xdm session is visible.

Commands in .bash_logout should be run when xdm seesion is terminated.

Additional info:

The first process run with the logged in user's id appears to be /bin/sh which 
runs the script to run KDE (or GNOME ...). This process needs to be changed to 
be a LOGIN shell for the user.

Comment 1 Mike A. Harris 2004-09-29 19:08:17 UTC
When logged into xdm/gdm/kdm or while in an X session started from
the commandline via "startx", by default most (possibly all) X
terminal emulators start up using non-login subshells.

The "bash" shell only processes the .bash_profile file on interactive
login shells, so by default, starting any terminal emulator without
specifying a login shell will give a non-login subshell.  This is
expected behaviour.

If you have any commands present in .bash_profile which you would
like to have invoked automatically by all shells, it is best to
place this code in the .bashrc file instead, as that is sourced
by all shells.

The full rules for which startup files are sourced by bash under
various conditions are documented in detail on the bash manpage
under the "INVOCATION" section.

If you prefer nonetheless to have your terminals invoke login
shells always, refer to the terminal emulator's commandline
usage screen, manpages or other documentation for how to invoke
the shell as a login shell.  For xterm, this can be done by
invoking it as "xterm -ls".  Other terminals have similar
commandline switches that may work the same.

Setting status to "NOTABUG".


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