Subject: Re: FVWM: Emacs does not print when started from FVWM-Buttons

From: Kendrick Vargas <[email-masked]>
Date: Wed, 14 May 1997 10:35:17 -0400 (EDT)

On Wed, 14 May 1997, Bruce Stephens wrote:

> [email-masked] said:
> > What I mean is that the .xsession or .xinitrc or WHATEVER that calls 
> > fvwm2 is simply a shell script, and if you set environments within 
> > that shell script, fvwm2 should make those environments available to 
> > the programs that fvwm2 starts... Currently, only a few environments 
> > are made available to programs... $HOME, $PATH, $LD_LIBRARY_PATH, and 
> > a few other vital ones...
> 
> Is that true?  My understanding was that all environment variables got passed 
> on (so long as the shell which runs .xsession or whatever exports them, of 
> course).  Is this not true?  Does fvwm2 *really* pick and choose which 
> variables to pass on?

In my case, yes. I don't believe I've ever been able to pass weird
environment variables. I know this because I once tried it with my IRC
environments. I set them in my .xsession hoping they'd get passed to
irc, but it never happened... I think I saw this come up on the list one
time earlier as well..... The case isn't that fvwm2 is picking and
choosing, I think the case is that it's not passing ANY... It grabs it's
PATH and LD_LIBRARY_PATH when necessary, and runs what it has to run. 

> What's more likely is that the person is running xdm, which runs .xsession, 
> and so never actually runs csh at all until they get an xterm up.  So the 
> environment variables exist in the xterms, but not in anything else, and in 
> particular not in fvwm2 and modules.  The trick there is to ensure that the 
> variables are set (and exported) in .xsession or .xinitrc.

Well... I do tend to make sure to take care of my .xsession... It took me
1.5 years before I figured out how to make one .xsession work on Solaris,
IRIX, Linux, and whatever else you might throw my way...
			-peace

--- BEGIN GEEK CODE BLOCK ------------+-----------
GAT d- s:+ !a C+(+++) UI/L/S/B++(+++) | "In the morning glad I see
P>+ L+(++) E---- W+++ N+ o? K? w++++  |  My foe outstrech'd beneath the tree."
O--- M-- V PS+++@ PE Y-- PGP+ t++ 5   |               -The Poison Tree
X++ R- tv+ b DI++ D+ G e>*  h*(!) r-  |                William Blake
y*(+) ------ END GEEK CODE BLOCK -----+

--
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].

---

From: Bruce Stephens <[email-masked]>
Date: Wed, 14 May 1997 16:05:26 +0100

[email-masked] said:
> environment variables. I know this because I once tried it with my 
> IRC environments. I set them in my .xsession hoping they'd get passed 
> to irc, but it never happened... I think I saw this come up on the 
> list one time earlier as well..... The case isn't that fvwm2 is 
> picking and choosing, I think the case is that it's not passing 
> ANY... It grabs it's PATH and LD_LIBRARY_PATH when necessary, and 
> runs what it has to run.  

That's odd.  As far as I can see (just skimming through the code), fvwm2 is 
doing a fork(2) which preserves the environment, followed by an execl(3) which 
also preserves the environment.  (This is for exec_command, which I assume 
FvwmButtons and things also use.  If you also use xrsh, then be aware that 
xrsh only carries a few variables to the remote machine by default.)

A quick check (setting *and exporting* the variable FOOBAR in .xsession and
logging out and back in again) shows that FOOBAR is carried through correctly. 
 I'd guess this is not fvwm2's problem---it's either user error, or some weird 
difference in how fork/execl behave on your machine (I'm using Solaris2.5).

---

From: "Richard A. Guay" <[email-masked]>
Date: Wed, 14 May 1997 12:23:33 +0000

> difference in how fork/execl behave on your machine (I'm using Solaris2.5).

It not that fvwm is  not passing the environment variable.  What I 
have found is that if the script that launches fvwm is different than 
the shell that you have your environment variables set, then you will 
not get the environment in fvwm that you thought you were.  For 
example, for a while a bourne shell was used to execute my .xinitrc 
file while I use zsh for my main shell.  In this case, I did not get 
my environment variables set because they are set in my .zshrc file 
and not my .profile file.  When I switch my .xinitrc file to run as a 
zsh program, then I got the environment that I expected to get.  
Therefore, if you are using a csh, make sure that the script that 
launches your fvwm session is also a csh script!

Richard A. Guay
Network Administrator and ASIC Design Engineer
ASIC International Inc.
[email-masked]
http://www.asicint.com

---

From: Christopher Wolf <[email-masked]>
Date: Wed, 14 May 1997 11:49:36 -0500 (CDT)

>launches your fvwm session is also a csh script!

So what all this eventually works down to is:

If you don't set your variables, you cannot use them.

-W

---

From: Kendrick Vargas <[email-masked]>
Date: Wed, 14 May 1997 13:09:37 -0400 (EDT)

> launches your fvwm session is also a csh script!

well, this can be a problem. Sun OS's (in my experience) don't care what
shell you specify for your .xinitrc or .xsession, Solaris will always
process it as a /bin/sh script. Besides, you can set environment variables
inside a shell script. It's not hard to add a line like 

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

or something like that, but even doing this, it doesn't work...
			-peace

PS> Please don't CC me, I'm on the mailing list, thanx :)

---

From: Andrew J Cosgriff <[email-masked]>
Date: Thu, 15 May 1997 07:46:35 +1000

"Kendrick" == Kendrick Vargas <[email-masked]> writes:
Kendrick> well, this can be a problem. Sun OS's (in my experience)
Kendrick> don't care what shell you specify for your .xinitrc or
Kendrick> .xsession, Solaris will always process it as a /bin/sh
Kendrick> script. Besides, you can set environment variables inside a
Kendrick> shell script. It's not hard to add a line like

Kendrick> export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Kendrick> or something like that, but even doing this, it doesn't
Kendrick> work... 

...probably because it's not valid Bourne Shell.

export VAR=value

only works in ksh (and zsh and bash)

if it's plain sh you have to do

VAR=value
...
export VAR VAR2 VAR3

I'm quite sure I used to have Solaris running my .xinitrc as a ksh
script, but that was over 6 months ago, in a previous life...

Enjoy,
 Andrew
-- 
 - Andrew J. Cosgriff -                  [email-masked]    (PGP/MIME ok)
 +61 3 9905 1165 (bh) 9905 4746 (fax)    http://www-personal.monash.edu.au/~ajc
     GOOD-NIGHT, everybody ... Now I have to go administer FIRST-AID to my
                              pet LEISURE SUIT!!
--
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].

---

From: Kendrick Vargas <[email-masked]>
Date: Wed, 14 May 1997 18:02:47 -0400 (EDT)

> if it's plain sh you have to do

Well, I meant to type that... I've tried every single which way... It took
alot of beating of me and my sysadmin's brains to figure that one out :)
			-peace

---

From: Bruce Stephens <[email-masked]>
Date: Thu, 15 May 1997 09:52:58 +0100

[email-masked] said:
> Besides, you can set environment variables inside a shell script. 
> It's not hard to add a line like 

> or something like that, but even doing this, it doesn't work... 

As others have commented, that's the wrong syntax.

I put the line

FOOBAR=froopy; export FOOBAR

in my .xinitrc, and nowhere else (not in any of my .zshrc or other files, and 
it sure seemed to exist in xterms spawned from fvwm2 spawned from the 
.xsession/.xinitrc (which are the same file in my setup).  I'm using Solaris 
2.5.1, fvwm 2.0.45 and xdm.

Can you track down your problem further?  Does the same happen with other 
window managers?  Does your ps(1) have options for looking at the environment 
of running processes?  ("ps -eww" used to work on BSDish boxes.)

---

From: Bruce Stephens <[email-masked]>
Date: Thu, 15 May 1997 10:12:00 +0100

[email-masked] said:
> Can you track down your problem further?  Does the same happen with 
> other  window managers?  Does your ps(1) have options for looking at 
> the environment  of running processes?  ("ps -eww" used to work on 
> BSDish boxes.) 

One possibility that occurs is that your .xinitrc/.xsession isn't being 
executed at all!  I've used at least one system where the default "ow3" 
command to start OpenWindows was a perl script which didn't execute any 
scripts in the users' directories at all.  Perhaps your xdm has been hacked up 
similarly?

---

From: Mark Boyns <[email-masked]>
Date: 15 May 1997 07:14:46 -0700

> As others have commented, that's the wrong syntax.

That syntax is fine when using bash.

> 2.5.1, fvwm 2.0.45 and xdm.

I'd just like to comment that I have never had a problem with
environment variables and fvwm under Solaris or NetBSD.  I start my X
session with `ssh-agent startx' to make a SSH_ environment variables
available to every program started by fvwm.
--
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].

---

From: David Nugent <[email-masked]>
Date: Fri, 16 May 1997 00:42:16 +1000

>  available to every program started by fvwm.

Same here, sort of.

.xsession:

#!/bin/sh

GNU_SECURE=/etc/gnu.rhosts			; export GNU_SECURE
CVSROOT=/home/cvs/local 			; export CVSROOT
CVS_RSH=ssh					; export CVS_RSH
BTERM=xterm					; export XTERM
XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB		; export XKEYSYMDB
XNLSPATH=/usr/X11R6/lib/X11/nls 		; export XNLSPATH
XAPPLRESDIR=/usr/X11R6/lib/X11/app-defaults	; export XAPPLRESDIR
CLASSPATH=.:/usr/local/lib/netscape		; export CLASSPATH
INFOPATH=/usr/share/info:/usr/local/info:/usr/local/lib/xemacs-19.15/info
						  export INFOPATH
.
.
.
eval `ssh-agent -s`
ssh-add </dev/null

xhost -

exec fvwm2

All of those explicitly set variables, and the SSH_* variables carry
through to all apps without problems at all. FreeBSD 3.0.

Regards,
David

David Nugent - Unique Computing Pty Ltd - Melbourne, Australia
Voice +61-3-9791-9547  Data/BBS +61-3-9792-3507  3:632/348@fidonet
[email-masked] [email-masked] http://www.blaze.net.au/~davidn/

---

From: "Lars Uffmann" <[email-masked]>
Date: Fri, 16 May 1997 14:23:32 +0200 (MET DST)

> >  available to every program started by fvwm.

#!/bin/bash -login
#
# .xsession/.xinitrc
#

The -login option causes the shell to parse the init files
anyway, so I can put all the export stuff in my ~/.profile.

regards, Lars

> ..xsession:

--
Lars Uffmann, [email-masked], fon: +49 5202 15372
Public Key available, send in e-mail, Subject: Your Key, Please