zsh-workers
 help / color / mirror / code / Atom feed
From: schaefer@z-code.ncd.com (Barton E. Schaefer)
To: "Richard J. Coleman" <coleman@math.gatech.edu>,
	zsh-workers@math.gatech.edu
Subject: Re: need info about attachtty hanging
Date: Sat, 13 Apr 1996 14:54:31 -0700	[thread overview]
Message-ID: <960413145431.ZM25590@zyrcon.z-code.com> (raw)
In-Reply-To: "Richard J. Coleman" <coleman@math.gatech.edu> "need info about attachtty hanging" (Apr 13, 12:43am)

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



      reply	other threads:[~1996-04-13 22:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-13  4:43 Richard J. Coleman
1996-04-13 21:54 ` Barton E. Schaefer [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=960413145431.ZM25590@zyrcon.z-code.com \
    --to=schaefer@z-code.ncd.com \
    --cc=coleman@math.gatech.edu \
    --cc=zsh-workers@math.gatech.edu \
    /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).