FVWM: fvwm2/twm losing PS1 (unix prompt setting) !?

From: Alexis Huxley <alexis_at_danae.demon.co.uk>
Date: Fri, 30 Oct 1998 19:35:21 +0000

This is driving me nuts, over the last couple of weeks I've asked on
comp.os.linux.x and comp.windows.x, but no responses. I've also trawled
the mailing list archive.

Before starting X windows I run:

        PS1="myprompt> "
        export PS1

I then start X with 'startx'. The system's default window manager is
fvwm2. Then I choose 'xterm' by clicking on the background to activate
the system wide wm menu and selecting 'xterm'. And my PS1 setting has
been lost!

I moved my .profile, .bash*, .fvwm2rc, .xsession, .xinitrc, .Xresources
files out of the way, logged out and in and repeated the above and it
still did the same thing.

I switched to 'twm' instead of fvwm2 and exactly the same thing happened.

I tried marking PS1 readonly before starting X, but the same thing
happened.

System wide config files might be changing PS1, but I couldn't see
anything in /etc/X11/*wm/* nor in /etc/profile, nor in the window
manager's manual page or other documentation.

Nor is it a bash problem. Bash sets PS1 to its own default when it
doesn't see a PS1 in the environment to inherit. The next test I did
proved that:

I've narrowed the problem down to the window manager specifically, by
running 'xterm &' without options from my .xsession file, and by adding a
menu option to do the same to my personal .fvwm2rc file. The one started
by the .xinitrc has PS1 preserved. But the one started by fvwm2 (which
is in turn also started by .xinitrc) loses the PS1 setting. (.Xresources
has been moved out of the way, so it's nothing to do with changing the
'loginShell' X resource between the two invocations of xterm.)

This diagram might make the process tree and environment inheritance
clearer:

                        login shell (I set PS1)
                             |
                          startx
                             |
                         <whatever>
                             |
           .xinitrc/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)

I've even simpified the startup by running 'xinit /usr/bin/X11/fvwm2'
and 'xinit /usr/bin/X11/xterm'. The second one keeps the correct PS1
setting, whereas an xterm started from the first one has PS1 reset.

( I tried doing a 'strace' on 'xinit /usr/bin/X11/fvwm2', but stracing
subprocesses (-f option) fails because of some process attachment problem
that I haven't worked out yet. I realise a strace wouldn't show a change
in PS1, but it might have shown a config file load or something else
that might have helped me suss out what's going on. )

It's a Debian 2.0 system, and the fvwm2/twm/bash package maintainers (I
guess) works around this 'feature' by setting PS1 in .bashrc - i.e. PS1
is set on every single subshell startup. Unfortunately ...

Unfortunately this breaks some scripts I run, which like to set PS1
before starting user-requested interactive sub-shell. (They do this to
remind the user that they're still in the script.) So I had to remove
the PS1 setting from .bashrc again. (These scripts work fine in a non-X
environment, they also work fine from an X session, which uses 'xterm'
as a low-tech window manager!) Which brings me back to a lost PS1 in
shells spawned by the window manager.

So, in a nutshell, the fvwm2 and twm window managers leave all my other
variables alone, they just unset PS1.

So, the question is, please, why are they unsetting it, and how do I
stop them? Also, just so I don't go totally insane, can anyone just
verify that they get the same thing?

Thanks for reading all the way to the end!

Alexis

-- 
Alexis Huxley
alexis_at_danae.demon.co.uk
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 majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Fri Oct 30 1998 - 13:36:42 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:38:01 BST