zsh-workers
 help / color / mirror / code / Atom feed
* need info about attachtty hanging
@ 1996-04-13  4:43 Richard J. Coleman
  1996-04-13 21:54 ` Barton E. Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Richard J. Coleman @ 1996-04-13  4:43 UTC (permalink / raw)
  To: zsh-workers

Several people have report zsh hanging in attachtty.  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.

1) Where is attachtty being called from when it
   hanges (init_io, init_signals, etc...)?

2) Does anyone know why the original call to set the
   foreground process is failing?

rc



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: need info about attachtty hanging
  1996-04-13  4:43 need info about attachtty hanging Richard J. Coleman
@ 1996-04-13 21:54 ` Barton E. Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Barton E. Schaefer @ 1996-04-13 21:54 UTC (permalink / raw)
  To: Richard J. Coleman, zsh-workers

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-04-13 22:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-13  4:43 need info about attachtty hanging Richard J. Coleman
1996-04-13 21:54 ` Barton E. Schaefer

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).