zsh-workers
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: zsh-workers@zsh.org
Subject: Re: $pipestatus broken?
Date: Sat, 24 Dec 2011 10:59:49 +0100	[thread overview]
Message-ID: <878vm2uw6i.fsf@ft.bewatermyfriend.org> (raw)
In-Reply-To: <111224013252.ZM22819@torch.brasslantern.com> (Bart Schaefer's message of "Sat, 24 Dec 2011 01:32:52 -0800")

Bart Schaefer wrote:
> On Dec 23, 11:11pm, Frank Terbeck wrote:
> } ...unless, of course, the loop just needs to be there to delay the RHS,
> } for the exit/reap to happen as you suggested.
>
> Hmm, this is getting a bit hairy.
>
> In the simple case { echo foo | read -E }, there is a single job table
> entry for "read" which is the group leader for the pipeline.
>
> In the loop case { echo foo | repeat 1; read -E } there is a job table
> entry for the loop which is the group leader, but a new entry is
> created for "read -E".  execpline() remembers the previous thisjob as
> the local "pj" and restores thisjob = pj at line 1619, but by that
> time it is too late -- waitjobs() has set thisjob = -1 for just long
> enough for zhandler() to call update_job(), which fails to update the
> pipestats because thisjob = -1 tells it there is no current job.
>
> The following seems to fix it, by telling waitjobs() what the previous
> job number was so it can be reset immediately.  There may still be a
> race condition that requires fiddling with signal blocks to make sure
> thisjob is correct at the time the zhandler() catches the signal, but
> if so this should at least allow the block/unblock to be localized.

Hm. I'm having a hard time following what's going on...

With this change, the test I posted in workers-30047 changes a bit.
Before, there were only lines that either looked like "1" or "0 0". Now
I'm getting "0 1", too.

"1" and "0 1" seem to happen way less now - both cases are in the 1%
area each. But maybe I'm just a little luckier, with respect to timing.

Regards, Frank


  reply	other threads:[~2011-12-24 10:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10 12:24 Frank Terbeck
2011-12-10 12:48 ` Frank Terbeck
2011-12-10 14:58   ` Bart Schaefer
2011-12-11 14:37     ` Frank Terbeck
2011-12-23 10:49     ` Frank Terbeck
2011-12-23 21:31       ` Bart Schaefer
2011-12-23 22:11         ` Frank Terbeck
2011-12-24  9:32           ` Bart Schaefer
2011-12-24  9:59             ` Frank Terbeck [this message]
2011-12-24 18:23               ` Bart Schaefer
2011-12-24 18:46                 ` Bart Schaefer
2011-12-24 17:37       ` Bart Schaefer

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=878vm2uw6i.fsf@ft.bewatermyfriend.org \
    --to=ft@bewatermyfriend.org \
    --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).