Subject: Re: FVWM: fvwm2/twm losing PS1 (environment experiment results)

From: Alexis Huxley <[email-masked]>
Date: Sat, 31 Oct 1998 11:17:55 +0000

Dominik Vogt <[email-masked]> said:
 
> My guess is that the reason for your problem is that
> the xterm from inside the window manager is not started
> in the correct environment. Nobody actually unsets PS1.
> What you get is probably the default bash prompt because
> PS1 is empty when the shell starts. Having a look at

Well, PS1 isn't empty before I start, and it *is* exported :-(

> From the console set 
> 
> foo=bar
> export foo
> 
> and start X, fvwm2 and an X terminal, verify if foo is
> still set and post the result.

Ok, I tried it and the results are reproduced below. Summarising; PS1 is
still getting reset, but 'foo' makes it through without changes.

Dominik, or somebody else, if you could please just try what I did, and get
the *right* results, then that would give me the impetus to keep digging with
this - right now I feel like I'm going insane! :-)

If you could just move /etc/bashrc and all possibly relevent dot files out
of the way and do two runs as follows:

PS1="myprompt> "
export PS1
xinit /usr/bin/X11/xterm

[ when the xterm comes up do ]

echo $PS1

and the second run:

PS1="myprompt> "
export PS1
xinit /usr/bin/X11/xterm

[ when fvwm2 comes up do, start an xterm and when that comes up do ]

echo $PS1

I'd be very grateful, even if your results produce the right results unlike
mine.

Ok, the rest of this post is the 'foo' experiment, coupled with a PS1
experiment:

Preamble:

$ id
uid=996(guest) gid=996(guest) groups=996(guest)
$ PS1="mynewprompt> "
mynewprompt> export PS1
mynewprompt> foo=bar
mynewprompt> export foo
mynewprompt> set > /tmp/console.env
mynewprompt> 

Console environment:

mynewprompt> set | more
BASH=/bin/sh
BASH_VERSINFO=([0]="2" [1]="01" [2]="1" [3]="1" [4]="release" [5]="i486-pc-linux-gnu")
BASH_VERSION='2.01.1(1)-release'
DIRSTACK=()
EUID=996
GROUPS=()
HISTFILE=/home/db/guest/.bash_history
HISTFILESIZE=500
HISTSIZE=500
HOME=/home/db/guest
HOSTNAME=danae
HOSTTYPE=i486
IFS='
'
LOGNAME=guest
MACHTYPE=i486-pc-linux-gnu
MAILCHECK=60
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/db/guest/bin:.
PIPESTATUS=([0]="0")
PPID=208
PS1='mynewprompt> '
PS2='> '
PS4='+ '
PWD=/diskb/home/guest
SHELL=/bin/sh
SHELLOPTS=braceexpand:hashall:histexpand:monitor:history:interactive-comments:emacs
SHLVL=1
TERM=linux
UID=996
USER=guest
_=id
foo=bar

Xterm environment:

running 'xinit /usr/bin/X11/xterm' and in the xterm running 
'set > /tmp/xterm.env' and then diffing the environments:

mynewprompt> diff /tmp/console.env /tmp/xterm.env
4a5
> DISPLAY=:0.0
22,23c23
< PIPESTATUS=([0]="0" [1]="0")
< PPID=208
---
> PPID=906
30,31c30,31
< SHLVL=1
< TERM=linux
---
> SHLVL=2
> TERM=xterm
34c34,35
< _=more
---
> WINDOWID=8388622
> _=sh
mynewprompt>

running 'xinit /usr/bin/X11/fvwm2' and then starting an xterm and in the xterm 
running 'set > /tmp/fvwm2.env' and then diffing the environments:

mynewprompt> diff /tmp/console.env /tmp/fvwm2.env
4a5
> DISPLAY=:0.0
10a12
> HOSTDISPLAY=danae:0.0
22,24c24,25
< PIPESTATUS=([0]="0" [1]="0")
< PPID=208
< PS1='mynewprompt> '
---
> PPID=917
> PS1='\s-\v\$ '
30,31c31,32
< SHLVL=1
< TERM=linux
---
> SHLVL=3
> TERM=xterm
34c35,36
< _=more
---
> WINDOWID=16777230
> _=sh
mynewprompt>

... and there is PS1 being set to it's the default (as mentioned in the 
bash man page), suggesting to me that it's *not* actully being explicitly
*set*, but rather explicitly *unset*.

I have no .profile, no .fvwm2rc, no .Xresource, no .bashrc. The is no
/etc/bashrc, but there is a /etc/profile, which sets PS1:

mynewprompt> grep PS1 /etc/profile
PS1="\\$ "
export PATH PS1
mynewprompt>

But since I neither start off with that value, nor does it change to that 
in either the xinit'ed xterm or the xinit'ed-fvwm2'ed xterm, I don't believe
/etc/profile is getting sourced.

Going back to my process diagram tree:

                        login shell (I set PS1)
                             |
                          startx
                             |
                           xinit
                             |
           .xinitrc/.xsession/global-equivalents (PS1 still set)
                            /  \
                          /      \
                        /          \
                   fvwm2/twm      xterm (PS1 still set)
                       |            |
                xterm (PS1 lost)   bash (PS1 still set)
                       |
        bash (PS1 set to bash's default)

Notice that when .xinitrc is executing the environment is still set correctly,
but the two bashes under them, one is right and one is wrong. And the only
difference in the two branches is that one comes through fvwm2 and the other
doesn't. I'm convinced that it is something fvwm2 is doing - perhaps 
indirectly (sourcing some file I don't know about perhaps).

> Bye
> Dominik

Dominik, please, just for my sanity, could you move your dot-files out of the
way and try it? I mean, just to hear that someone had reproduced exactly 
what I have done and *didn't* get the same results would at least give me
the confidence to keep struggling with it.

Thanks!

Alexis

Alexis Huxley
[email-masked]
email key: 549812
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].