[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: [Fwd: [Bug 53345] .bash_profile  script is not sourced]
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2004-02-27 2:40:37
Message-ID: 20040227024037.GA24885 () ugly ! local
[Download RAW message or body]

On Thu, Feb 26, 2004 at 05:01:24PM -0700, James Richard Tyrer wrote:
> Adriaan de Groot wrote:
> >Let's (shortly) return to the technical issue at hand; personally, I
> >think that Ossi's comments in the bug report are rude and
> >unprofessional, but in the face of extreme provocation
> 
> There was no extreme provocation.  There was, in fact, no provocation
> at all unless this is based on the territorial imperative.
> 
the problem is that you simply don't realize that you severely
misbehaved. under these circumstances i'm not a bit sorry for calling
you names.

> >On Thursday 26 February 2004 09:41, James Richard Tyrer wrote:
> >
> >>Actually, it is the Xsession script that is the issue.  And, I am not
> >> talking about work arounds for a bunch of stuff.  I am just
> >>suggesting the obvious that if the system uses Bash then a Bash
> >>Xsession script would be
> >
> >Unfortunately, it's not the _system_ that uses shell this or that, but a
> > particular user.
> 
> Actually since this is s system script (actually an X11 script if you want
> to be picky), it has nothing to do with the shell that the user is using.
>
that's true, and this is what proves that you don't even know what you
really want yourself. so let me explain it to you.  :-P
you want Xsession to pretend to be the user's $SHELL, so he doesn't need
to set up the session separately. that's actually really simple to
achieve:

Xsession:
#! /bin/sh

case $SHELL in
  */bash)
    [ -z "$BASH" ] && exec $SHELL $0 "$@"
    [ -f /etc/profile ] && . /etc/profile
    if [ -f $HOME/.bash_profile ]; then
      . $HOME/.bash_profile
    elif [ -f $HOME/.bash_login ]; then
      . $HOME/.bash_login
    elif [ -f $HOME/.profile ]; then
      . $HOME/.profile
    fi
    ;;
  */ksh)
    <similar as above>
    ;;
  <and so on for every other known 1) bourne shell derivate 2)>
  *)
    [ -f /etc/profile ] && . /etc/profile
    [ -f $HOME/.profile ] && . $HOME/.profile
    ;;
esac

[ -f /etc/xprofile ] && . /etc/xprofile
[ -f $HOME/.xprofile ] && . $HOME/.xprofile

<the rest of Xsession>

and the 1) and 2) are the problems that immediately follow from the
algorithm:
1) we handle only shells we know. the remaining users are still screwed.
2) users of c shell derivates (the most popular other unix shell) and
   let alone some niche shells nobody heard about are on their own as
   well.

and there is another problem that is not immediately obvious: in the
case of bash and plain sh, the relevant scripts are usually sourced only
by _interactive_ login shells. ergo they can reasonably expect to be
allowed to communicate with the user. now guess what happens if the
script is executed without a terminal. sounds academic, huh? but i have
the worst practical experience with hackish setups, as i tend to
customize a lot ...

greetings

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic