zsh-workers
 help / color / mirror / code / Atom feed
From: Geoff Wing <gcw@pobox.com>
To: Bart Schaefer <schaefer@candle.brasslantern.com>
Cc: zsh-workers@sunsite.auc.dk
Subject: PATCH: 3.1.6-dev-17 (Was: BUG: backgrounding zsh does bad tty stuff)
Date: Sat, 12 Feb 2000 23:17:41 +1100	[thread overview]
Message-ID: <20000212231741.A20778@primenet.com.au> (raw)
In-Reply-To: <1000212055846.ZM6576@candle.brasslantern.com>; from schaefer@candle.brasslantern.com on Sat, Feb 12, 2000 at 05:58:46AM +0000

Bart Schaefer wrote about Re: BUG: backgrounding zsh does bad tty stuff:
:On Feb 12,  5:03am, Geoff Wing wrote:
:} Subject: BUG: backgrounding zsh does bad tty stuff
:} % zsh-3.0.7 -f
:} % echo $SHLVL
:} 2
:} % zsh-3.0.7 -f &
:} [1] 19784
:
:I immediately get
:[1]  + suspended (tty output)  zsh -f

:What operating system are you using?

NetBSD/i386 (current)

:However, what did you expect?

I expected to get what you got. 

:There's even a loop in init.c:init_io() where zsh repeatedly attempts to
:force itself to be the tty foreground process, sending the pgrp leader
:a SIGTTIN and then attempting to grab the tty.  Not pretty, but it has
:been there for a very long time.

Yes, since 2.2. Note that bash (2.03) has something similar but bash still
works properly.
My problem is that zsh gets past that loop when it should be stuck there.
This seems to fix it for me:  we shouldn't be making ourself the process
group leader for the terminal until our parent has told has we're really
the process group leader.
Also, I don't know why the sleep(1) is in there.  It should hang on the
killpg() - though it may be needed to compensate for some other weird
occurrence and possibly shouldn't be taken out?

*** Src/init.c.org	Tue Jan 25 06:25:59 2000
--- Src/init.c	Sat Feb 12 23:13:02 2000
***************
*** 394,403 ****
  #ifdef JOB_CONTROL
      /* If interactive, make the shell the foreground process */
      if (opts[MONITOR] && interact && (SHTTY != -1)) {
- 	attachtty(GETPGRP());
  	if ((mypgrp = GETPGRP()) > 0) {
  	    while ((ttpgrp = gettygrp()) != -1 && ttpgrp != mypgrp) {
- 		sleep(1);
  		mypgrp = GETPGRP();
  		if (mypgrp == gettygrp())
  		    break;
--- 394,401 ----
***************
*** 408,413 ****
--- 406,412 ----
  	    opts[MONITOR] = 0;
      } else
  	opts[MONITOR] = 0;
+     attachtty(GETPGRP());
  #else
      opts[MONITOR] = 0;
  #endif

-- 
Geoff Wing : <gcw@pobox.com>     Work URL: http://www.primenet.com.au/
Rxvt Stuff : <gcw@rxvt.org>      Ego URL : http://pobox.com/~gcw/
Zsh Stuff  : <gcw@zsh.org>       Phone   : (Australia) 0413 431 874


  reply	other threads:[~2000-02-12 12:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-02-12  5:03 BUG: backgrounding zsh does bad tty stuff Geoff Wing
2000-02-12  5:58 ` Bart Schaefer
2000-02-12 12:17   ` Geoff Wing [this message]
2000-02-12 18:00     ` PATCH: 3.1.6-dev-17 (Was: BUG: backgrounding zsh does bad tty stuff) Bart Schaefer
2000-02-13  5:22       ` Geoff Wing

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=20000212231741.A20778@primenet.com.au \
    --to=gcw@pobox.com \
    --cc=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).