zsh-workers
 help / color / mirror / code / Atom feed
* Background jobs with no job control / disown bug?
@ 1995-11-03 11:28 Peter William Stephenson
  1995-11-03 11:36 ` Richard Coleman
  1995-11-03 14:32 ` Chip Salzenberg
  0 siblings, 2 replies; 5+ messages in thread
From: Peter William Stephenson @ 1995-11-03 11:28 UTC (permalink / raw)
  To: Zsh hackers list

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1995-11-03 16:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-11-03 11:28 Background jobs with no job control / disown bug? Peter William Stephenson
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

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).