[1748] in Athena Bugs

home help back first fref pref prev next nref lref last post

tcsh leads to failed /usr/athena/lib/init/aliases

daemon@ATHENA.MIT.EDU (geer@ATHENA.MIT.EDU)
Tue Feb 7 22:06:34 1989

From: <geer@ATHENA.MIT.EDU>
Date: Tue, 7 Feb 89 22:06:17 EST
To: bugs@ATHENA.MIT.EDU
as the tcsh does not follow the syntax of C when the
&& operator is present (vide supra), oddly incorrect
behavior can result when the standard dot-file referent
/usr/athena/lib/init/aliases is sourced.  

in line #18 of that file, both conditionals are being
evaluated regardless of the success of each.  when the
$term envar is not present, this can result in odd or
incorrect outcome.

jason% rcp /tmp/bar paris:/tmp/foobar
term: Undefined variable.
jason% rsh paris ls /tmp/foobar
term: Undefined variable.
/tmp/foobar not found
jason% 

the file:

     1	# This file contains standard C shell aliases.
     2	#
     3	#       Win Treese
     4	#       MIT Project Athena
     5	#       12/6/87
     6	#
     7	#       $Source: /paris/source/4.3/athena.lib/init/RCS/aliases,v $
     8	#       $Author: probe $
     9	#       $Header: aliases,v 1.5 88/09/14 15:15:37 probe Exp $
    10	
    11	# Aliases dealing with mail
    12	
    13	alias mail 'Mail'
    14	alias Mail 'more /usr/prototype_user/README.mail ; echo \!* > /dev/null'
    15	
    16	# Aliases for the X window system
    17	
    18	if ($?term && $term =~ xterm*) then
    19	        alias xresize 'set noglob; eval `resize` || unset noglob'
    20	endif

tytso> You're quite correct; for some reason && is always evaluating
tytso> the second argument; the whole csh parser is really broken in a
tytso> lot of ways; this is just one of them.
tytso> 
tytso> I'd suggest replacing line 18 with
tytso> 
tytso> 	if ($?term) then
tytso> 		if ($?term =~ xterm*) then
tytso> 
tytso> It's a hack, but it works.....

--dan

home help back first fref pref prev next nref lref last post