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

Re: $PATH and /etc/profile



Michael B Allen wrote:
> bob@proulx.com (Bob Proulx) wrote:
> >     kdm spawns bash --login ~/.xsession
> 
> I think we're on the same page here Bob but I want to point out that
> running /usr/bin/bash --login is specific to bash.

Yes, but if you were a csh/tcsh user you would use the following
~/.xsession instead.  I know I did not say it but left it implied.
The examples get very complicated if every possibility is explored in
detail.

  #!/bin/tcsh -l
  exec x-session-manager

The user knows what shell they are using and can match the syntax
correctly for it.  In this case it would read /etc/csh.cshrc,
/etc/csh.login, ~/.cshrc and ~/.login in that order, IIRC.

> Another method that uses the user's default shell is to change:
> 
>  /etc/X11/Xsession.d/99xfree86-common_start
> 
> to read:
> 
>   exec -l $SHELL -c "$STARTUP"

That is clever and I like it.  But unfortunately exec -l is a bash-ism
and so that does not work if /bin/sh is not bash but a different POSIX
compatible shell.  Users with ash installed as /bin/sh will fail.
Because 'exec -l' is not specified by POSIX /bin/sh is not required to
implement it.  So you can't in general make that change unless you
have changed Xsession to use '#!/bin/bash'.  Then it works.  But many
object to using nonstandard bash features like this.

> Also, you may or may not have noticed ~/.xsession is not executed
> unless the user selects "Default System Session".

Yes.  See my recent posting[1] with some more description.  I just did
not expand upon that here.  But let me tip my hat to you as an astute
and critical reader.

> Otherwise I believe the xsession.d scripts bail out before reachine
> that step.

It won't bail out.  In 50xfree86-common_determine-startup if .xsession
is not executable it will mark it for execution with the POSIX shell
'/bin/sh $STARTUPFILE' and that means the '#!/bin/bash --login' will
be a comment and ignored.  This has been a source of frustration and
confusion to new users because it partially seems to do what they
asked it to do.

See 'man 5 Xsession' for some documentation on this process.

Bob

[1] http://lists.debian.org/debian-user/2004/05/msg00142.html

Attachment: pgpXVfnqSmGvn.pgp
Description: PGP signature


Reply to: