From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3) with ESMTP id IAA08217 for ; Sun, 14 Apr 1996 08:10:27 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id RAA08010; Sat, 13 Apr 1996 17:54:06 -0400 (EDT) Resent-Date: Sat, 13 Apr 1996 17:54:06 -0400 (EDT) From: schaefer@z-code.ncd.com (Barton E. Schaefer) Message-Id: <960413145431.ZM25590@zyrcon.z-code.com> Date: Sat, 13 Apr 1996 14:54:31 -0700 In-Reply-To: "Richard J. Coleman" "need info about attachtty hanging" (Apr 13, 12:43am) References: <199604130443.AAA21733@redwood.skiles.gatech.edu> Reply-To: schaefer@z-code.ncd.com X-Face: czU|*h"p8AX?4.I.yU.^s%TIMx|"-s,*'|#H^|e,QjE&!jL%<]:-.U/;khS%3a2BC5_d#)( mz=$$G0u9P&*N8cA~b[URf;lgKRif@#qEf[ltie#Gg0%6$b`e`k.Cgw:\qJx\\a7c(K7^3;gXW:e1@ J, zsh-workers@math.gatech.edu Subject: Re: need info about attachtty hanging Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"h1_du2.0.1z1.z92Sn"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/924 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Apr 13, 12:43am, Richard J. Coleman wrote: } Subject: need info about attachtty hanging } } Several people have report zsh hanging in attachtty. Not hanging -- infinite-looping. Not quite the same. } Peter sent in a patch that changes } } if (kill(pgrp, 0) == -1) } } to } } if (pgrp != mypgrp && kill(pgrp, 0) == -1) } } Now I'm trying to understand what is going on. Zsh gets EOF because the tty closes. Ignoreeof is set, so it keeps reading input. attachtty() is called to make the top-level shell the foreground process on the tty, which fails. Without the fix above, attachtty() calls itself recursively, which fails again; attachtty() has no automatic variables, so it doesn't consume any stack space, and thus the recursion is infinite. } 1) Where is attachtty being called from when it } hanges (init_io, init_signals, etc...)? My guess is it's from setterm() via refresh(), but it could be from getkey() via any number of zle entry points. It doesn't really make any difference; the fix above is needed no matter what. Note that the "ep" static protects against such recursion in the case where the initial kill() fails. The only time the kill() can possibly fail is from entersubsh(), bin_fg(), or bin_read(), so none of those is involved in this case. } 2) Does anyone know why the original call to set the } foreground process is failing? Yeah: because the tty is closed -- the xterm window (or equivalent) has gone away. *No* process can have that controlling terminal any longer. -- Bart Schaefer Vice President, Technology, Z-Code Software schaefer@z-code.com Division of NCD Software Corporation http://www.well.com/www/barts