zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: zsh 4.0.2 bug: jobs pipes no output
Date: Thu, 23 Oct 2003 03:12:42 +0000	[thread overview]
Message-ID: <1031023031242.ZM5858@candle.brasslantern.com> (raw)
In-Reply-To: <20031022224654.C3B4DDF259@swordfish.cs.caltech.edu>

On Oct 22,  3:46pm, Troy Bridoux wrote:
} Subject: zsh 4.0.2 bug: jobs pipes no output

Minor point, but 4.0.2 is two years (five revisions) out of date.

} As you can see, "jobs"s standard output gives nothing to "cat"

This is intentional behavior, not a bug.  However, it's been a point
of confusion for long enough that it was "fixed" about 15 months ago
in development versions of zsh (4.1.x).

It's intentional in that zsh forks off the left side of pipelines and
tries to keep the right side in the current shell, whereas nearly all
other shells either always fork both sides of a pipeline, or fork the
right side.  Without going into the reasons why forking left first is
preferable, this means that when a builtin is on the left, it is run
in a subshell -- and subshells do not have job control, and therefore
have no jobs to list.

The "fix" for this was to allow the subshell to retain part of the job
table information from the parent, and print it out -- but it means
there can be race conditions, so that the output from "jobs" on the
left side of a pipe may be incorrect with respect to the actual list
of jobs being managed by the parent.  For example:

zagzig% echo $ZSH_VERSION
4.1.1-dev-1
zagzig% sleep 20 &
[1] 5850
zagzig% (sleep 30; jobs) | cat
[1]  + done       sleep 20
[1]  + running    sleep 20
zagzig% 

Whether it's better to have the job list be incorrect or unavailable
remains a matter of philosophical debate.  I'm beginning to think I
prefer "unavailable."


      reply	other threads:[~2003-10-23  3:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-22 22:46 Troy Bridoux
2003-10-23  3:12 ` Bart Schaefer [this message]

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=1031023031242.ZM5858@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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).