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

From: Alexis Huxley <alexis_at_danae.demon.co.uk>
Date: Mon, 2 Nov 1998 14:20:41 +0000

On Mon, Nov 02, 1998 at 01:28:51PM +0100, /users/domivogt wrote:

> 1) Unlike most (probably all) other shells, bash *deletes*
> the contents of PS1 if it is non-interactive (i.e. if

Yes, I came to the same conclusion about bash after receiving an email
from list-reader Michael Tiefenback <tiefen_at_jlab.org>. Unfortunately
he was getting PS1 being *the same* in .xinitrc-spawned and fvwm-spawned
xterms, but this gave me a tremendous impetus to keep digging.

> you run a script with bash). This is documented
> behaviour however.

Hmm ... I checked the documentation beforehand and couldn't see any
mention of this. Re-reading this on the bash man page:

       An interactive shell .... PS1 is set
       and $- includes i if bash is interactive, ...

you can't infer that a non-interactive shell has PS1. Although just the
mention of this is 'suspicious' :-)

You suggested I should change all my scripts, but that isn't terribly
portable or graceful. I see fvwm2 has an 'ExecUseShell' configuration
command. I think it would be neater to use it to explicity specify an
alternative shell for fvwm2 to use - in light of /bin/sh being bash
under most Linux distributions.

it the name of a script that simply prepends '-i' to the argument
list and exec's bash?

> The 'bug' or feature (remember it is documented on the manpage)
> can be verified with the following command:
>
> echo 'echo PS1 = $PS1' | bash

Yes, I eventually strace'd an already-running fvwm2 proess and found
how it was exec'ing menu items, and simulated the problem with this
bit of code a bit closer to how fvwm2 is doing it as follows:

PS1="newprompt> "
export PS1
/bin/bash -c 'echo $PS1' <-- PS1 lost
/bin/bash -i -c 'echo $PS1' <-- PS1 not lost

The implication being that if bash is invoked with command line parameters
which do not suggest it's an interactive shell (e.g. with a script
or -c <command>) then it presumes *incorrectly* that it's *never* going to
'give rise to' an interactive. Which is *too* presumtious.

> Write a bug report to the bash developers. It may be a good

I will shortly - I'd like to hear the results of a little test I asked
Michael to do first though.

[ Michael, you might as well post them back on the list I think, even
though it's becoming apparent it's a shell problem rather than an fvwm2
problem - at least it will go into the mailing list archive and become
searchable - which is where I tried before posting here (and after
checking newsgroup FAQs and posting to newsgroups). ]

>> Dominik, please, just for my sanity, could you move your dot-files out of the
>
> You are completely sane (at least concerning you problem ;-) ). In fact

I was going nuts! Thanks very much for the reassurance! :-)

Alexis
--
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 Mon Nov 02 1998 - 08:28:39 GMT

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