zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: bug in zsh wait builtin - rhbz#1150541
Date: Sun, 26 Oct 2014 00:04:48 +0100	[thread overview]
Message-ID: <20141026000448.12fa03fd@pws-pc.ntlworld.com> (raw)
In-Reply-To: <141025153231.ZM19285@torch.brasslantern.com>

On Sat, 25 Oct 2014 15:32:31 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Oct 25,  3:28pm, Bart Schaefer wrote:
> }
> } #0  0x080b7085 in wait_for_processes () at ../../zsh-5.0/Src/signals.c:537
> } 537             if (!(jn->stat & (STAT_CURSH|STAT_BUILTIN)) && jn - jobtab !=
> } thisjob)
> } (gdb) p jn
> } $1 = 0x0
> 
> Add "jn != NULL &&" to the front of that condition and all tests pass.

Yes, I was dozily wondering about that when I sent the patch but didn't
get around to checking.

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.

> Incidentally, when you ^Z the foreground job, the value of $! is not
> updated, so the only way to use wait is by job identifier (which is
> equivalent to using fg).  $! finally does get updated when the job is
> continued with bg.  (This describes the pre-33531-patch state, but I
> don't think the patch alters it.)

Yes, this isn't going to interact particularly usefully with the patch,
but I'm not really expecting it to be particularly useful when you're in
an interactive shell with job control anyway.

pws


  reply	other threads:[~2014-10-25 23:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-21  7:53 Tim Speetjens
2014-10-21 20:02 ` Peter Stephenson
2014-10-22  6:55   ` Bart Schaefer
     [not found]     ` <CAO7vJOjrb=N3xuTJVSb7U8mdXtexYp8nN4YaoknfUb3fofU2zg@mail.gmail.com>
2014-10-22 15:48       ` Bart Schaefer
2014-10-22 18:32     ` Chet Ramey
2014-10-23  8:32     ` Peter Stephenson
2014-10-24  4:50       ` Bart Schaefer
2014-10-24  8:04         ` Tim Speetjens
2014-10-25 19:08         ` Peter Stephenson
2014-10-25 21:54           ` Bart Schaefer
2014-10-25 22:28           ` Bart Schaefer
2014-10-25 22:32             ` Bart Schaefer
2014-10-25 23:04               ` Peter Stephenson [this message]
2014-10-25 23:17                 ` Peter Stephenson
2014-10-26 19:01                   ` Peter Stephenson
2014-10-26 20:41                     ` Bart Schaefer
2014-10-26 21:22                       ` Peter Stephenson

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=20141026000448.12fa03fd@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /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).