Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: killing suspended jobs makes zsh hang after 47d1215



Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> writes:

> On Jun 12,  7:22am, Bart Schaefer wrote:
> }
> } ----------------------------
> } revision 1.80
> } date: 2011/04/01 11:02:16;  author: pws;  state: Exp;  lines: +18 -1
> } Stef van Vlierberghe: 28965 (as posted in 28967):
> } findproc() should not return processes not marked as SP_RUNNING
> } ----------------------------
> } 
> } Evidently there are in fact cases where we need to find jobs that are
> } not running.
>
> The specific bug is fixed by the patch below, but I wonder if there are
> other job status that need to be tested here as well.

After playing a bit more with pn->status...

  % cat | cat &
  [1] 91580 97756
  [1]  + suspended (tty input)  cat | cat
  % %
  [1]  + continued  cat | cat
  ^C
  load: 0.06 no foreground process group

or when less(1) in `cat /dev/random | less' pipeline exits before
cat(1) is done

  Breakpoint 1, findproc (pid=97756, jptr=0x7fffffff4c08, pptr=0x7fffffff4c00, aux=0) at jobs.c:192
  192                 if (pn->pid == pid && pn->status == SP_RUNNING) {
  (gdb) p pn->status
  $1 = 19
  (gdb) p WIFSIGNALED(pn->status)
  $2 = 1
  (gdb) bt
  #0  findproc (pid=97756, jptr=0x7fffffff4c08, pptr=0x7fffffff4c00, aux=0) at jobs.c:192
  #1  0x000000000047d83c in wait_for_processes () at signals.c:493
  #2  0x000000000047d9f4 in zhandler (sig=20) at signals.c:584
  #3  0x00007ffffffff003 in ?? ()
  #4  0x000000000047d900 in wait_for_processes () at signals.c:524
  #5  0x00000000004481e8 in zwaitjob (job=1, wait_cmd=0) at jobs.c:1317
  #6  0x0000000000448390 in waitjobs () at jobs.c:1362
  #7  0x000000000044a1d9 in bin_fg (name=0x80f318738 "fg", argv=0x7fffffff52c0, ops=0x7fffffff5390, func=2) at jobs.c:2058
  #8  0x000000000040ed73 in execbuiltin (args=0x80f318700, bn=0x6af3c0) at builtin.c:450
  #9  0x000000000042ab5d in execcmd (state=0x7fffffff59a0, input=0, output=0, how=2, last1=2) at exec.c:3182
  #10 0x00000000004265a0 in execpline2 (state=0x7fffffff59a0, pcode=195, how=18, input=0, output=0, last1=0) at exec.c:1640
  #11 0x0000000000425aef in execpline (state=0x7fffffff59a0, slcode=3074, how=18, last1=0) at exec.c:1424
  #12 0x000000000042531e in execlist (state=0x7fffffff59a0, dont_change_job=0, exiting=0) at exec.c:1207
  #13 0x0000000000424d63 in execode (p=0x80f318660, dont_change_job=0, exiting=0, context=0x49b217 "toplevel") at exec.c:1028
  #14 0x00000000004412f3 in loop (toplevel=1, justonce=0) at init.c:185
  #15 0x000000000044431d in zsh_main (argc=2, argv=0x7fffffff5b00) at init.c:1528
  #16 0x000000000040e12b in main (argc=2, argv=0x7fffffff5b00) at ./main.c:93



Messages sorted by: Reverse Date, Date, Thread, Author