[comp.sys.sgi] NeWS environment

aspgpas@cidsv01.cid.aes.doe.CA (Peter Silva) (05/10/91)

This problem drives me nuts.

BASIC QUESTIONS:  

HOW DOES WINDOW MANAGER GET IT'S ENVIRONMENT ?

HOW CAN I DEBUG .login WHICH ONLY FAILS WHEN STARTING NeWS ?

I've noticed that my .login and user.ps files interact in
weird and wonderful ways.  It seems the content of my .login
is ignored by NeWS when the window manager is started up,
depending in some random manner, on what is in the .login
and user.ps files.  The variations that cause it to be
ignored make no sense to me...  (many changes to the 
.login will do it, below is just a very simple example)

I had a big .login file, so I trimmed it down gradually
until I got something I could deal with.  I have a file
that works (.login--) and one that doesn't (.login-)
they user the same user.ps (which I can't live without!)

With .login-  my environment is ignored (the clock comes up
with the machine's TZ, not my own, and the path doesn't
include /usr/local/bin, so several windows just jam (command
not found).  with .login-- everything is fine.

The immediate thing which occurs to one when looking at a
diff of the two files is that there is a problem with xhost
and newshost commands.  So I removed them from the .login, 
and placed them in my user.ps.  The symptoms are unchanged.
(sigh)

below are .login- .login-- diff of the two and my user.ps...
for anyone who might be of help.

#.login-
set verbose
setenv TZ EST5EDT
set term=iris-ansi
set DISPLAY_HOST=cidws04
if ( "$DISPLAY_HOST" != "" ) setenv DISPLAY "${DISPLAY_HOST}:0"
setenv OSflavour "`uname -m`"
setenv HostName  "`uname -n`"
	if ( ( "$DISPLAY_HOST" != "" ) && "`uname -n`" != "$DISPLAY_HOST" ) then
		 setenv NEWSSERVER `sns $DISPLAY_HOST`
	endif
        set MANPATH=( /usr/man /usr/catman \
		      /usr/local/src/X11R4/contrib/toolkits/Xw/doc/manpages \
		    )
	set path=(  /usr/local/bin /usr/bin /usr/sbin /usr/bsd /usr/bin/X11 \
		    /bin /usr/demos /usr/ustation/iris/3.03/pub/bin )

        setenv OSflavour 'sgi4D'
	eval `tset -s -Q \?iris-ansi`
	set term=$TERM
	stty intr  erase ^H kill ^U -tabs -parenb cs8 
set prompt="`uname -n`% "

   alias cd 'cd \!*;echo "\033P1.y`uname -n`:`pwd` -- $LOGNAME \033\\\c"'
   echo "\033P1.y`uname -n`:`pwd` -- $LOGNAME \033\\\c"

	/usr/sbin/newshost disable
	xhost +

unset DISPLAY_HOST
unset setup_dir



#.login--
#set verbose
setenv TZ EST5EDT
set term=iris-ansi
set DISPLAY_HOST=cidws04
if ( "$DISPLAY_HOST" != "" ) setenv DISPLAY "${DISPLAY_HOST}:0"
setenv OSflavour "`uname -m`"
setenv HostName  "`uname -n`"
	if ( ( "$DISPLAY_HOST" != "" ) && "`uname -n`" != "$DISPLAY_HOST" ) then
		 setenv NEWSSERVER `sns $DISPLAY_HOST`
	endif
        set MANPATH=( /usr/man /usr/catman \
		      /usr/local/src/X11R4/contrib/toolkits/Xw/doc/manpages \
		    )
	set path=(  ~/bin ~/share/bin /usr/local/bin /usr/bin /usr/sbin \
		    /usr/bsd /usr/bin/X11 /usr/local/bin/X11 \
		    /bin /usr/demos /usr/ustation/iris/3.03/pub/bin )

        setenv OSflavour 'sgi4D'
	eval `tset -s -Q \?iris-ansi`
	set term=$TERM
	stty intr  erase ^H kill ^U -tabs -parenb cs8 
set prompt="`uname -n`% "

   alias cd 'cd \!*;echo "\033P1.y`uname -n`:`pwd` -- $LOGNAME \033\\\c"'
   echo "\033P1.y`uname -n`:`pwd` -- $LOGNAME \033\\\c"
#	/usr/sbin/newshost disable
#	xhost +

unset DISPLAY_HOST
unset setup_dir


i#diff .login- .login--
1c1
< set verbose
---
> #set verbose
14c14,15
< 	set path=(  /usr/local/bin /usr/bin /usr/sbin /usr/bsd /usr/bin/X11 \
---
> 	set path=(  ~/bin ~/share/bin /usr/local/bin /usr/bin /usr/sbin \
> 		    /usr/bsd /usr/bin/X11 /usr/local/bin/X11 \
25,27c26,27
< 
< 	/usr/sbin/newshost disable
< 	xhost +
---
> #	/usr/sbin/newshost disable
> #	xhost +


% user.ps
% User customization file.

% OK, Let's try and set up my windows...
UserProfile /MenuHome /overFirst put
UserProfile /PrefStackSize 8
UserProfile /prefStacks	   3
UserProfile /prefDelta     [ 90 30 /Filling ]

/locksmenu [
	(qix)	{ (bin/xlock -display localhost:0 -mode qix) forkunix }
	(fractal)  { (bin/xlock -display localhost:0 ) forkunix }
] /new DefaultMenu send def

/forkwsh { % args => -
	(wsh -r1000 -f Screen-Bold.15 ) exch append
	forkunix
} def

/localshell { %args => -
        currentkey dup (-s40x80 -n ) exch append
        forkwsh
} def

/localcmd { %args => -
	currentkey dup (-s40x80 -n ) exch append
	( -c /usr/local/bin/kfix ) 3 -1 roll append append
	forkwsh
} def

%	currentkey dup (-s40x80 -n ) exch append
/unixhost { %args => -
	( -s40x80 -c /usr/local/bin/krlogin ) currentkey append
	forkwsh
} def

/otherhost { %args => -
	( -m40x132 -s40x80 -c /usr/local/bin/ktelnet ) currentkey append
	forkwsh
} def
	
/ShellMenu [
        (cidsv01) { unixhost }
        (cidsv02) { unixhost }
        (cidsv03) { unixhost }
        (cidsv04) { unixhost }
        (cidgw05) { unixhost }
        (cidgw06) { unixhost }
        (cidsv07) { unixhost }
        (cid_dev1) { otherhost }
        (cidws02) { unixhost }
        (cidws03) { unixhost }
        (cidws06) { unixhost }
        (cidws09) { unixhost }
        (cidws10) { unixhost }
        (cmeteoc) { unixhost }
        (cmc_sat) { unixhost }
        (ops)     { unixhost }
        (rpn)     { unixhost }
	(impl) 	  { unixhost }
        (cid_mfa)  { otherhost }
        (cid_mfb)  { otherhost }
        (cid_pro1) { otherhost }
]
/new DefaultMenu send def
(Hosts) /settitle ShellMenu send

(StdStuff) 10 10 [ 90 30 8 8 ] preforigin
(wsh) 	    (StdStuff) prefalias
(elm) 	    (StdStuff) prefalias
(unixhost)  (StdStuff) prefalias
(otherhost) (StdStuff) prefalias
(forkwsh)   (StdStuff) prefalias
(Local)   (StdStuff) prefalias

/basicRestartActions [
        { (rm -f /tmp/.cutbuffer) forkunix }
        { establishEnvironment }
        { RunConsole }
        { (windowchest) seqfork }
        { startXsgi }
] def

/rootmenu [
     (Local shell)   	     { localshell }
     [ (Remote shells) pullRightIcon ] ShellMenu 
     (elm)	     { localcmd }
     (Log Out)       { /showat exitnewsmenu send }
     (SpotlightLock)   { (bin/spotlight) forkunix }
     [ (Screen Lock) pullRightIcon ] locksmenu 
] /new DefaultMenu send def
(Window Manager) /settitle rootmenu send

 
/RestartActions [ 
	{ (demochest) forkunix }
	{ (clock) forkunix }
	{ (bin/night) seqfork }
	{ (ical) forkunix }
        { (mousewarp 6 3) seqfork }
	{ (gamma 1.01) seqfork }
	{ (newshost disable) seqfork }
	{ (xhost + ) seqfork }
] def

(stdin) 400 200 200 800 prefposition
(clock) 1160 908 110 110 prefposition
(cal)   885 832 preforigin 
(night)


--
Peter Silva			OS Support 
psilva@cid.aes.doe.ca		Dorval Computing Centre
(514) 421-4692			Atmospheric Environment Service

aspgpas@cidsv01.cid.aes.doe.CA (Peter Silva) (05/10/91)

|> I've noticed that my .login and user.ps files interact in
|> weird and wonderful ways.  It seems the content of my .login
|> is ignored by NeWS when the window manager is started up,
|> depending in some random manner, on what is in the .login
|> and user.ps files.  The variations that cause it to be
|> ignored make no sense to me...  (many changes to the 
|> .login will do it, below is just a very simple example)
|> 

wow!  It's timing related!  If I put a sleep in the .login
the problem occurs in the good .login as well!

How can you get NeWS to wait for the .login to finish?

What is the order of execution of the various files, and in
what order and precedence (child/parent) are they run?

Basically how does the login process work  ?

--
Peter Silva			OS Support 
psilva@cid.aes.doe.ca		Dorval Computing Centre
(514) 421-4692			Atmospheric Environment Service

dwallach@soda.berkeley.edu (Dan Wallach) (05/13/91)

In article <1991May10.162810.14296@cid.aes.doe.CA> psilva@cid.aes.doe.ca writes:
>wow!  It's timing related!  If I put a sleep in the .login
>the problem occurs in the good .login as well!
>
>How can you get NeWS to wait for the .login to finish?

It sounds to me like you're mixing apples and oranges.  You usually
want to do windowing things in your user.ps and specifically within-a-window
things in your .login/.cshrc.

For example, in a typical X setup, you treat your .login/.cshrc as if
you were just dialing in from home on your dumb terminal, and then you
have the .xsession or .xinitrc file which says what X programs you want.

In my environment, I have the .cshrc file from hell, which always gets
run, no matter what (especially true in X...) and a really tiny .login
file that I don't usually need run (does things like checks if I have mail
waiting for me...).

For things like popping up windows, I've edited my user.ps file to do the
stuff I want.  Here's an excerpt.
%%
%% User customization file.
%%

/RestartActions [ 
	{ (gamma 1.7) seqfork }		% 1.7 is a good first guess
	{ (demochest) seqfork }
% init_my_windows is really a shell script in my bin directory
% that way, I can check environment variables and have more
% customization of window titles...
	{ (init_my_windows) seqfork }
] def


If I were more of a PostScript whiz, I could probably do everything here,
but it was easier in a shell script.

This should solve your problem.

Dan Wallach
dwallach@soda.berkeley.edu

msc@ramoth.esd.sgi.com (Mark Callow) (05/14/91)

In article <1991May10.141105.10129@cid.aes.doe.CA>, aspgpas@cidsv01.cid.aes.doe.CA (Peter Silva) writes:
|> This problem drives me nuts.
|> 
|> BASIC QUESTIONS:  
|> 
|> HOW DOES WINDOW MANAGER GET IT'S ENVIRONMENT ?
|> 
|> HOW CAN I DEBUG .login WHICH ONLY FAILS WHEN STARTING NeWS ?
|> 

Read the man page for exporttonews(1).  This program is run from the NeWS
startup file, /usr/NeWS/lib/NeWS/init.ps, to read you environment and send
it to NeWS.  The important thing to remember is that commands that need
a tty will fail during this exporttonews operation.
-- 
From the TARDIS of Mark Callow
msc@ramoth.sgi.com, ...{ames,decwrl}!sgi!msc
"Spirits of genius are always opposed by mediocre minds" - Albert Einstein