From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from math.gatech.edu (euclid.skiles.gatech.edu [130.207.146.50]) by werple.net.au (8.7/8.7.1) with SMTP id WAA25052 for ; Fri, 3 Nov 1995 22:46:28 +1100 (EST) Received: by math.gatech.edu (SMI-8.6/SMI-SVR4) id GAA00566; Fri, 3 Nov 1995 06:23:55 -0500 Resent-Date: Fri, 3 Nov 1995 06:23:55 -0500 Old-Return-Path: From: pws@ifh.de (Peter William Stephenson) Message-Id: <9511031128.AA24164@sgi.ifh.de> Subject: Background jobs with no job control / disown bug? To: zsh-workers@math.gatech.edu (Zsh hackers list) Date: Fri, 3 Nov 1995 12:28:31 +0100 (MET) X-Mailer: ELM [version 2.4 PL24] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"s_90O1.0.m8.BlVcm"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/521 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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 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.