[26146] in Athena Bugs
$initdir scripts
daemon@ATHENA.MIT.EDU (Jacob Morzinski)
Thu Oct 21 22:45:58 2004
Date: Thu, 21 Oct 2004 22:45:53 -0400 (EDT)
From: Jacob Morzinski <jmorzins@mit.edu>
To: bugs@mit.edu
Message-ID: <Pine.LNX.4.58L.0410212153570.22618@milquetoast.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Errors-To: bugs-bounces@mit.edu
Hello,
I reviewed my dotfiles the other day, and as a part of that I
looked over the rc scripts in $initdir. I think I found some
typos and bugs in the $initdir scripts, and am including proposed
patches for them at the end of this message.
There is a subtle bug in the bashrc script that it would be
particularly nice to get fixed.
The patch is at the end of the mail. Before the patches, I will
comment on the issues I saw in files, and what changes I have
made. The order of commentary matches the order of the patched
lines.
xsession, login, cshrc:
The files xsession, login, and cshrc had a small typo in a
comment, "commend" instead of "command". Fixed in the patch.
cshrc:
The cshrc has a misleading comment at the point where it resets
the HOME variable. The comment suggests that HOME is being reset
to a short, /mit/<user> path. This hasn't been true for as long
as I can remember. Removed the misleading part of the comment.
The cshrc's alias for "term" sets noglob but does not unset it.
Fixed by appending an "unset noglob" to the alias.
bash_login:
The bash_login should only source ~/.bashrc if the file exists.
This imitates csh more faithfully, and avoids needless error messages.
Fixed by adding a "-r" test for the file.
The bash_login script sets the variables ATHENA_LOGIN_SESSION and
initdir in a different order from how they are set in the login
script. The out-of-order commands makes file comparisons
difficult. To make file comparisons easier in the future,
changed the order of the variables to match the login script.
The bash_login comment that explains how to use skip_tty_startup
gives csh-style instructions for the ~/.bash_environment, which
will not work. Fixed to give bash-style instructions.
The bash_login script runs "get_message -login", but the
login script runs "get_message -new -login". Changed the
bash_login to include "-new" in the get_message args.
The bash_login comment that explains how to use skip_lert gives
csh-style instructions for the ~/.bash_environment, which will
not work. Fixed to give bash-style instructions.
bashrc:
The bashrc script is very difficult to compare to the cshrc,
because of the many differences in the order in which commands
are run. I would be willing to re-order the files to make them
easier to compare, but have not yet done so. Here, I report only
the bugs in the bashrc script.
The bashrc script checks $ENV_SET to decide whether to run a
large block of code, code which changes the user's PATH and HOME.
However, there is a bug. The test
if [ "${ENV_SET:+non-zero}" != "non-zero" ]
is exactly equivalent to
if [ -z "$ENV_SET" ]
which causes dramatic problems for tcsh users (whose ENV_SET is
set, but is zero-length). A user who logs in with tcsh, cd's to
an arbitrary directory, and runs "bash" from there will encounter
problems. Their HOME gets reset to the current, arbitrary,
working directory. Their PATH gets reset, discarding any
lockers that were "add"ed. Fixed by changing ${ENV_SET:+set}
to just ${ENV_SET+set} .
The bashrc script sets the coredumpsize to unlimited, but the
cshrc script set the coredumpsize to zero. Changed the bashrc to
set coredumpsize to zero.
The bashrc script sets and exports a LD_LIBRARY_PATH variable,
but the cshrc script does not. Deleted the variable from the
bashrc script.
The bashrc script sets the bindir variable in just one place, but
the cshrc script sets bindir in two places. Fixed the bashrc to
set bindir in two places, like the cshrc.
The long comment in the bashrc script about "Reset the HOME
variable" is no longer correct. Users' HOME directories have
been long pathnames for about a decade. Fixed by trimming the
comment until it made sense.
The bashrc script sets XFILESEARCHPATH, but the cshrc script does
not set the variable. Fixed by deleting the variable from the bashrc.
That's the end of the commentary concerning the changes I made.
The patches are below; the order of changed lines in the patch is
the same as the order of the commentary above.
-Jacob
Index: xsession
===================================================================
--- xsession (revision 1)
+++ xsession (working copy)
@@ -265,7 +265,7 @@
# to receive the alert in the form of a zephyrgram, and since they may
# run zwgc from their .startup.X, we wait until that has finished. To
# skip lert (a generally bad idea unless you plan to run it yourself -
-# it is not at all intended for frivolous messages), put the commend
+# it is not at all intended for frivolous messages), put the command
# "set skip_lert" in your ~/.environment file.
if ((! $?NOCALLS) && (-r ~/.startup.X)) then
Index: login
===================================================================
--- login (revision 1)
+++ login (working copy)
@@ -130,7 +130,7 @@
# Run notification system, lert. To skip this (a generally bad idea unless
-# you plan to run it yourself), put the commend "set skip_lert" in your
+# you plan to run it yourself), put the command "set skip_lert" in your
# ~/.environment file.
if (! $?skip_lert) then
Index: cshrc
===================================================================
--- cshrc (revision 1)
+++ cshrc (working copy)
@@ -95,9 +95,7 @@
endif
# Reset the "home" and HOME variables to correspond to the actual
- # location of the user's home directory. This will avoid having
- # long pathnames being printed when /mit/<user> is a symlink to a
- # path within AFS.
+ # location of the user's home directory.
#
# This code has been optimized to run as quickly as possible. Since
# it is being invoked only at the beginning of the session, and
@@ -210,7 +208,7 @@
alias renew 'kinit $USER && fsid -a && zctl load /dev/null'
# alias for a convenient way to change terminal type
-alias term 'set noglob; unsetenv TERMCAP; eval `tset -s -I -Q \!*`'
+alias term 'set noglob; unsetenv TERMCAP; eval `tset -s -I -Q \!*`; unset noglob'
# aliases dealing with x window system
alias xresize 'set noglob; eval `resize -c` || unset noglob'
Index: bash_login
===================================================================
--- bash_login (revision 1)
+++ bash_login (working copy)
@@ -3,19 +3,20 @@
# This file is sourced by default user file ~/.bash_login
-. ~/.bashrc
+# Imitate C shell behavior of sourcing the rc file, if it exists:
+[ -r ~/.bashrc ] && . ~/.bashrc
# SGI xwsh runs shells as login shells. We don't want this.
if [ "${XSESSION+set}" = set ]; then
exit 0
fi
-initdir=/usr/athena/lib/init
-
# Remember the pid of the login shell; used by dustbuster.
ATHENA_LOGIN_SESSION=$$
export ATHENA_LOGIN_SESSION
+initdir=/usr/athena/lib/init
+
# Create a unique temporary directory for the session, and remember
# the directory name in the environment.
sessiondir="`$initdir/mksessiondir -s $$`"
@@ -119,7 +120,7 @@
# Run standard system/user startup activities
# Run default system startup activities. To skip these, put the command
-# "set skip_tty_startup" in your ~/.bash_environment file.
+# "skip_tty_startup=t" in your ~/.bash_environment file.
if [ "${ZEPHYR_CLIENT+set}" != set ]; then
export ZEPHYR_CLIENT
@@ -132,7 +133,7 @@
fi
IGNOREEOF= # ^D won't log you out
$ZEPHYR_CLIENT # Start Zephyr client
- get_message -login # Display current motd
+ get_message -new -login # Display current motd
mailquota -n # Check quota on post office server
from -t -n # Check for mail
(olc who &) > /dev/null 2>&1 # Ping the OLC server
@@ -151,7 +152,7 @@
# Run notification system, lert. To skip this (a generally bad idea unless
-# you plan to run it yourself), put the commend "set skip_lert" in your
+# you plan to run it yourself), put the command "skip_lert=t" in your
# ~/.bash_environment file.
if [ "${skip_lert+set}" != set ]; then
Index: bashrc
===================================================================
--- bashrc (revision 1)
+++ bashrc (working copy)
@@ -15,14 +15,14 @@
# Set up standard system/user environment configuration (including setup of
# environment variables, attachment of lockers, and setting of search path)
-if [ "${ENV_SET:+set}" != set ]; then
+if [ "${ENV_SET+set}" != set ]; then
export ENV_SET=t # Avoid unnecessary repeat
export HOSTTYPE="`/bin/athena/machtype`"
umask 077 # Strictly protect files
# (does not apply in AFS)
- ulimit -c unlimited # Don't allow coredumps
+ ulimit -c 0 # Don't allow coredumps
export EDITOR=emacs # Set default editor
export VISUAL=emacs # Set default screen editor
export MM_CHARSET=iso-8859-1
@@ -78,7 +78,6 @@
export NOMSGSEVERITY=1
;;
sun4)
- export LD_LIBRARY_PATH=/usr/openwin/lib
export OPENWINHOME=/usr/openwin
;;
linux)
@@ -98,15 +97,15 @@
export ATHENA_SYS=@sys
fi
+ bindir=arch/${ATHENA_SYS}/bin
+
if [ "${PRINTER+set}" != set -a -e /var/athena/clusterinfo ]; then
PRINTER=`awk '/LPR/ { print $3 }' /var/athena/clusterinfo`
if [ -n "$PRINTER" ]; then export PRINTER; fi
fi
# Reset the HOME variable to correspond to the actual location
- # of the user's home directory. This will avoid having long
- # pathnames being printed when /mit/<user> is a symlink to a
- # path within AFS.
+ # of the user's home directory.
# Since this code is being invoked only at the beginning of
# the session, and prior to the inclusion of any of the user's
@@ -162,15 +161,6 @@
export XUSERFILESEARCHPATH
-
- if [ sun4 = "$HOSTTYPE" ]; then
- if [ "${XFILESEARCHPATH+set}" != set ]; then
- XFILESEARCHPATH="/usr/openwin/lib/locale/%L/%T/%N%S:/usr/openwin/lib/%T/%N%S"
- else
- XFILESEARCHPATH="$XFILESEARCHPATH:/usr/openwin/lib/locale/%L/%T/%N%S:/usr/openwin/lib/%T/%N%S"
- fi
- export XFILESEARCHPATH
- fi
fi