From: Vincent Lefevre <vincent@vinc17.net>
To: zsh-workers@zsh.org
Subject: Re: zsh froze under Mac OS X
Date: Tue, 23 Nov 2010 13:03:58 +0100 [thread overview]
Message-ID: <20101123120358.GB1727@prunille.vinc17.org> (raw)
In-Reply-To: <101122073902.ZM13038@torch.brasslantern.com>
[-- Attachment #1: Type: text/plain, Size: 1914 bytes --]
On 2010-11-22 07:39:00 -0800, Bart Schaefer wrote:
> On Nov 22, 3:49pm, Vincent Lefevre wrote:
> }
> } Call graph:
> } 993 zexit
> } 993 sourcehome
> } 993 source
> } 993 loop
>
> This indicates that it's reading your .zlogout file. Anything there
> that could account for the behavior?
I have the following:
----
source ~/.zdomain
----
which just has "domain=local.prunille".
----
if [[ -n $SSH_AUTH_SOCK ]] then
if [[ `whence -w _call_sshagent` == '_call_sshagent: function' ]] then
_call_sshagent -r
elif [[ -n $SSH_AGENT_PID ]] then
eval `ssh-agent -k`
fi
fi
----
Here "_call_sshagent -r" was executed. I've attached the source of
this function.
----
[[ $OSTYPE == linux && $TTY == /dev/tty* ]] && clear
[[ $OSTYPE == linux && -n $SSH_CLIENT &&
${(M)${(f)"$(</proc/$PPID/status)"}:#Name:*} == Name:[[:blank:]]#sshd ]] &&
kill -HUP $PPID 2>/dev/null
----
The OS isn't linux, so nothing should be done here.
----
true
----
So, it seems that zsh froze in _call_sshagent.
> This ...
>
> } 2 exalias
> } 1 exalias
> } 1 gethashnode
> } 1 gethashnode
>
> ... makes me suspect you've got a recursively-expanding alias involved,
> but that's much less certain than that it's .zlogout related.
Well, problems started to occur before I tried to exit zsh. There
could have been a problem in .zlogout due to an earlier memory
corruption or something like that.
If this is memory corruption, then this could be the same bug I've
been noticing for years...
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)
[-- Attachment #2: _call_sshagent --]
[-- Type: text/plain, Size: 3249 bytes --]
#!/usr/bin/env zsh
# Usage: _call_sshagent [ -l | -r ]
# -l: try to use an existing ssh-agent and change SSH_AUTH_SOCK
# accordingly. This is useful for some non-login shells (no
# possible clean-up by the .zlogout).
# -r: remove the socket associated with the current process and
# kill ssh-agent if there are no sockets any longer.
#
# Note: You should execute _call_sshagent from your .zlogin and have
# the following code (or similar) in your .zlogout so that after you
# exit the last login shell, the authentication agent is killed.
#
# if [[ -n $SSH_AUTH_SOCK ]] then
# if [[ `whence -w _call_sshagent` == '_call_sshagent: function' ]] then
# _call_sshagent -r
# elif [[ -n $SSH_AGENT_PID ]] then
# eval `ssh-agent -k`
# fi
# fi
#
# Also, if you use the "screen" utility and do SSH connections from
# it, the shells started by screen should be login shells (thanks to
# a line "shell -zsh" in your .screenrc) to make sure that ssh-agent
# will still be running after you exit all the other shells.
emulate -LR zsh
local link=/tmp/ssh-agent-$USER
local i=0
until (ln -s /dev/null $link.lock 2> /dev/null)
do
[[ $i -eq 0 ]] && echo "$0: waiting for lock" >&2
if [[ $((++i)) -eq 4 ]] then
echo "$0: can't lock $link" >&2
return
fi
sleep 2
done
local dir=`readlink $link`
if [[ $1 == -r ]] then
if [[ -O $link && -d $dir && -O $dir && $SSH_AUTH_SOCK == $link/* ]] then
local others
rm -f $SSH_AUTH_SOCK
unset SSH_AUTH_SOCK
others=($dir/agent.*(N=))
if [[ -z $others ]] then
local pid=$(<$dir/ssh-agent.pid)
rm -f $link $dir/ssh-agent.pid
kill -TERM $pid
kill_sshmasters
fi
else
# Inconsistent data, try to kill ssh-agent in the standard way
eval `ssh-agent -k`
fi
elif [[ $1 == -l ]] then
if [[ -O $link && -d $dir && -O $dir ]] then
local old
old=($link/agent.*(N=[1]))
if [[ -S $old ]] then
SSH_AUTH_SOCK=$old ssh-add -l >& /dev/null
if [[ $? -ne 2 ]] then
export SSH_AUTH_SOCK=$old
unset SSH_AGENT_PID
fi
else
echo "$0: $old isn't a socket" >&2
fi
fi
else
if [[ -O $link && -d $dir && -O $dir ]] then
local old
old=($link/agent.*(N=[1]))
if [[ -S $old ]] then
SSH_AUTH_SOCK=$old ssh-add -l >& /dev/null
if [[ $? -eq 2 ]] then
# The agent could not be contacted, assume that it has died
rm -f $dir/agent.*(N) $dir/ssh-agent.pid && rmdir $dir
rm -f $link
rm -f $link.lock
$0
return
fi
local new=$link/agent.$$
if [[ $new == $old ]] || ln -f $old $new; then
export SSH_AUTH_SOCK=$new
unset SSH_AGENT_PID
else
echo "$0: can't link $new -> $old" >&2
fi
else
echo "$0: $old isn't a socket" >&2
fi
elif eval `ssh-agent`; then
if ln -fs $SSH_AUTH_SOCK:h $link; then
local old=$SSH_AUTH_SOCK
echo $SSH_AGENT_PID > $link/ssh-agent.pid
rm -f $link.lock
$0 && rm -f $old
return
else
echo "$0: can't symlink $dir -> $SSH_AUTH_SOCK:h" >&2
fi
else
echo "$0: can't call ssh-agent" >&2
fi
fi
rm -f $link.lock
# $Id: _call_sshagent 14529 2006-10-22 10:13:13Z lefevre $
prev parent reply other threads:[~2010-11-23 12:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-22 14:49 Vincent Lefevre
2010-11-22 15:39 ` Bart Schaefer
2010-11-23 11:08 ` Peter Stephenson
2010-11-23 13:40 ` Vincent Lefevre
2010-11-23 12:03 ` Vincent Lefevre [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101123120358.GB1727@prunille.vinc17.org \
--to=vincent@vinc17.net \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).