zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: Re: Serious problem with job control and functions
Date: Mon, 28 May 2001 10:51:04 +0200 (MET DST)	[thread overview]
Message-ID: <200105280851.KAA02393@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: <1010527224256.ZM1539@candle.brasslantern.com>

Bart Schaefer wrote:

> This must be related to the patch from 14327.

Yes, it is.

> I have a shell function:
> 
>     man () {
>         command man $* | less -ais
>     }
> 
> I discovered today that if I suspend this function with control-Z, it
> vanishes entirely from the job tables and the `man' and `less' commands,
> though stopped, are orphaned.

As a short reminder: 14327 tried to fix the messed up job assignment for
a loop like:

  for i in foo bar; do cat & wait; done

The shell reported that as if one of the cats were on the left hand side
of a pipe because list_pipe_job pointed to it.

Before 14327 we were discussing other ways to try to fix that, esp.
passing the information that the cats were started in the background up
to the execpline() that set list_pipe_job.  What I should have seen when
I wrote 14327 but didn't is that we don't need to pass the information
up.  At that time list_pipe_job has already been set so we only need to
conditionally reset list_pipe_job to zero (if the job we are currently
setting up is started in the background and if it is the one we are
useing as the list_pipe_job).  That's what the patch below does, plus
taking back what 14327 did.

At least for me all the different things we were discussing work now.

Bye
  Sven

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.27
diff -u -r1.27 exec.c
--- Src/exec.c	2001/05/14 08:51:59	1.27
+++ Src/exec.c	2001/05/28 08:46:34
@@ -976,13 +976,16 @@
         list_pipe_pid = 0;
 	nowait = 0;
 	simple_pline = (WC_PIPE_TYPE(code) == WC_PIPE_END);
-	list_pipe_job = (simple_pline ? 0 : newjob);
+	list_pipe_job = newjob;
     }
     lastwj = lpforked = 0;
     execpline2(state, code, how, opipe[0], ipipe[1], last1);
     pline_level--;
     if (how & Z_ASYNC) {
 	lastwj = newjob;
+
+        if (thisjob == list_pipe_job)
+            list_pipe_job = 0;
 	jobtab[thisjob].stat |= STAT_NOSTTY;
 	if (slflags & WC_SUBLIST_COPROC) {
 	    zclose(ipipe[1]);

-- 
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


      parent reply	other threads:[~2001-05-28  8:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-27 22:42 Bart Schaefer
2001-05-28  5:55 ` Andrej Borsenkow
2001-05-28  8:51 ` Sven Wischnowsky [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=200105280851.KAA02393@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.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).