zsh-workers
 help / color / mirror / code / Atom feed
From: pws@ifh.de (Peter William Stephenson)
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Background jobs with no job control / disown bug?
Date: Fri, 3 Nov 1995 12:28:31 +0100 (MET)	[thread overview]
Message-ID: <9511031128.AA24164@sgi.ifh.de> (raw)

It occurred to me that one way of avoiding a background job getting
job control (disown is not a sufficient method in a function) is to
unsetopt MONITOR, spawn the job, then setopt MONITOR again.  This
nearly works.  Unfortunately,

% unsetopt monitor
% sleep 30 &
% setopt monitor
% jobs
[1] + running

i.e. it's still in the job table (but you'll find you can't do
anything with it).  I suggest deleting jobs from the job table when
this is the case.  I believe the following patch to spawnjob() to
delete the job table entry will fix this.

I should like to hear from someone who knows something about job
control whether this is right.  For example, is it correct (as I
believe) to delete the process structures etc. as well as the job
table entry as deletejob() does?  Is this going to have some dire
effect on some pipeline I don't know about (reading exec.c it seems
like everything does)?

(If it is correct and the job's associated structures need deleting,
then why doesn't disown seem to do this, instead of simply zeroing the
job entry?  I don't think we can both be right.  See bin_fg() in builtin.c)

*** Src/jobs.c~	Sun Oct 29 11:50:22 1995
--- Src/jobs.c	Fri Nov  3 12:06:38 1995
***************
*** 590,596 ****
  	    fflush(stderr);
  	}
      }
!     if (!jobtab[thisjob].procs)
  	deletejob(jobtab + thisjob);
      else
  	jobtab[thisjob].stat |= STAT_LOCKED;
--- 590,596 ----
  	    fflush(stderr);
  	}
      }
!     if (!jobtab[thisjob].procs || !jobbing)
  	deletejob(jobtab + thisjob);
      else
  	jobtab[thisjob].stat |= STAT_LOCKED;

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


             reply	other threads:[~1995-11-03 11:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-11-03 11:28 Peter William Stephenson [this message]
1995-11-03 11:36 ` Richard Coleman
1995-11-03 15:05   ` Zoltan Hidvegi
1995-11-03 15:47     ` Zefram
1995-11-03 14:32 ` Chip Salzenberg

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=9511031128.AA24164@sgi.ifh.de \
    --to=pws@ifh.de \
    --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).