ksh dumping core
Seth Robertson
seth at ctr.columbia.edu
Thu Oct 19 06:18:10 AEST 1989
In article <834 at fozzy.UUCP> fail at fozzy.UUCP (Dennis Fail) writes:
>goes to another
>workstation, logs in, and does some work and then goes back to his
>workstation and try to use his windows that he was working in, they will
>dump core. This doesn't happen all the time, but with enough frequency
>to be a problem.
>
> I've isolated the problem to be in the history function of ksh
>As a side note, we had had problems with the previous version of ksh
>corrupting the history file after an rlogin, but it would never dump core.
The way I solved the corrupted history file problem was to change the history
file for each pty. I assume that this would solve your problem also.
>From my .kshrc: (The file that gets read in every time a ksh starts. If you
do not have this feature, you could stick it in .profile)
------------------------------------------------------------
##
## Source the people's startup file.
. /public/etc/kshsetup
##
## Set it up so that it prints the contents of ~/.face when I log out
if test "$0" = "su" -o "$0" = "-su"
then
# WatchOut gets set if there is already another history file existing
# with the same name (i.e. don't delete it)
if test "$WatchOut"
then
# Keep the history file and don't print a closing screen
# (Because if you su, you don't want your history file to disappear :-)
trap 'trap 0; exec ~/.kshout save no; kill -9 0; exit; exit' 0
else
# Delete the history file and don't print a closing screen
trap 'trap 0; exec ~/.kshout kill no; kill -9 0; exit; exit' 0
fi
else
if test "$0" = "-ksh"
then
# Delete the histry file and print a closing screen
trap 'trap 0; exec ~/.kshout kill yes; kill -9 0; exit; exit' 0
else
# Delete the history file but don't print a closing screen
trap 'trap 0; exec ~/.kshout kill no; kill -9 0; exit; exit' 0
fi
fi
------------------------------------------------------------
>From my .kshout
------------------------------------------------------------
: ${tty:=`tty`}
: ${pty:=`basename $tty`}
: ${host:=`hostname`}
# If argv[1] is `kill' then we are supposed to get rid of the
# ksh history file
if test "$1" = "kill"
then
if test "$pty" = "console"
then
rm -f .ksh.$host.* ~/core
else
: ${HISTFILE:="$HOME/.ksh.$host.$pty.$USER"}
rm -f "$HISTFILE" ~/core
fi
fi
# If argv[2] is `yes' then we are supposed to print a closing screen
if test "$2" = "yes"
then
clear
cat ~/.face
fi
------------------------------------------------------------
>From /public/etc/kshsetup:
------------------------------------------------------------
: ${tty:=`tty`}
: ${pty:=`basename $tty`}
: ${host:=`hostname`}
if test -f "$HOME/.ksh.$host.$pty.$USER"
then
WatchOut="true"
fi
HISTFILE="$HOME/.ksh.$host.$pty.$USER"
. /public/etc/kshenv # Set up some special features
------------------------------------------------------------
That should solve the problem by having a seperate history file for each
invocation of ksh. I'll include the public/etc/kshenv for those who are
interested:
------------------------------------------------------------
: ${tty:=`tty`}
: ${pty:=`basename $tty`}
if test "$pty" = "console"
then
# 3.4 machines don't run sunview
if test -d /var
then
:
else
alias sunview=suntools
fi
else
alias sunview="echo 'This is not allowed unless you are on the console.'"
alias suntools="echo 'This is not allowed unless you are on the console.'"
fi
alias logout="exit"
# Plus some more CTR specific stuff
------------------------------------------------------------
Hope this helps,
-Seth Robertson
seth at ctr.columbia.edu
--
-Seth Robertson
seth at ctr.columbia.edu
More information about the Comp.unix.wizards
mailing list