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

Re: bug in zsh wait builtin - rhbz#1150541



On Sun, 26 Oct 2014 00:04:48 +0100
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> I'm now wondering whether we need
> 
> 	if (!jn || (!(jn->stat & (STAT_CURSH|STAT_BUILTIN)) &&
> 		    jn - jobtab != thisjob))
> 	    addbgstatus(pid, (int)lastval2);
> 
> i.e. if there's *no* job we should remember the PID because we don't
> have enough information to say we don't need to remember it.  That's
> probably safe --- we've already had a succesful return value from wait
> or one of its relatives so it's a child of the shell --- but there might
> be cases where it's inefficient.  I suppose I ought to check what
> happens when job control is off.

It's typically OK with job control off, there is a job at that point...

I found the places where this (!jn) triggers by adding error output in
this case and running the test suite...

./A02alias.ztst: starting.
This test hangs the shell when it fails...
*** /tmp/zsh.ztst.err.4092	Sun Oct 26 00:10:01 2014
--- /tmp/zsh.ztst.terr.4092	Sun Oct 26 00:10:01 2014
***************
*** 0 ****
--- 1 ----
+ pid 4118 with no job
Test ./A02alias.ztst failed: error output differs from expected as shown above for:
  print -u $ZTST_fd 'This test hangs the shell when it fails...'
  alias cat='LC_ALL=C cat'
  cat <(echo foo | cat)

So happens with <(....).

./C04funcdef.ztst: starting.
*** /tmp/zsh.ztst.err.12383	Sun Oct 26 00:10:30 2014
--- /tmp/zsh.ztst.terr.12383	Sun Oct 26 00:10:30 2014
***************
*** 0 ****
--- 1 ----
+ pid 12454 with no job
Test ./C04funcdef.ztst failed: error output differs from expected as shown above for:
  () (cat $1 $2) <(print process expanded) =(print expanded to file)
Was testing: Process substitution with anonymous functions

And =(...), not surprisingly.

./D03procsubst.ztst: starting.
*** /tmp/zsh.ztst.err.12707	Sun Oct 26 00:10:31 2014
--- /tmp/zsh.ztst.terr.12707	Sun Oct 26 00:10:31 2014
***************
*** 0 ****
--- 1,2 ----
+ pid 12713 with no job
+ pid 12714 with no job
Test ./D03procsubst.ztst failed: error output differs from expected as shown above for:
  paste <(cut -f1 FILE1) <(cut -f3 FILE2)
Was testing: <(...) substitution

And again.

./V08zpty.ztst: starting.
*** /tmp/zsh.ztst.err.15038	Sun Oct 26 00:10:44 2014
--- /tmp/zsh.ztst.terr.15038	Sun Oct 26 00:10:44 2014
***************
*** 0 ****
--- 1 ----
+ pid 15042 with no job
Test ./V08zpty.ztst failed: error output differs from expected as shown above for:
  zpty cat cat
  zpty -w cat a line of text
  var=
  zpty -r cat var && print -r -- ${var%%$'\r\n'}
  zpty -d cat
Was testing: zpty with a process that does not set up the terminal: internal write

So happens with processes forked by zpty.  I get messages in the
completion tests but no errors which I guess are also zpty.

So it looks like these cases aren't relevant and we can ignore the case
of no job and still pick up all the cases we do need.

pws



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