zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: Jobs unexpectedly disowned
Date: Wed, 31 Jul 2019 14:25:27 +0000	[thread overview]
Message-ID: <1564583126.6561.15.camel@samsung.com> (raw)
In-Reply-To: <CAN=4vMp4pMM1JHKVYz9Wzr1N8qhwZ4auXGThFTkA-BFWHgvOyg@mail.gmail.com>

On Sun, 2019-07-21 at 08:19 +0200, Roman Perepelitsa wrote:
> I'm seeing weird behavior with jobs getting disowned and I'm not sure
> whether it's intended.
> 
>     function f2() { sleep 1 &; true }
>     function g2() { f2; jobs; wait }
> 
>     echo g2; g2
> 
> When ran from `zsh -df` I get this:
> 
>     g2
>     [2] 31061

We're not seeing job information because STAT_NOPRINT is being or'ed into the
job status by this code within execpline().

	    if (list_pipe || (pline_level && !(how & Z_TIMED)))
		jn->stat |= STAT_NOPRINT;

because pline_level is non-zero.  I think it's non-zero just because
we're inside the shell function at this point, but I don't understand
why that's supposed to make a difference, and I haven't understood how
this point in the code gets hold of the background job which (although I
haven't checked) should be one started with Z_ASYNC by a lower level
call to execpline().

I think pline_level is really there for stuff inside non-final bits of
pipelines, but this stuff is a bit obscure.  (No, really.)

I also haven't worked out what adding "true" has got to do with it, but
it does make the difference.

pws

  parent reply	other threads:[~2019-07-31 14:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190721062030epcas2p2326b1b0c1779aba66272cc90656e2a29@epcas2p2.samsung.com>
2019-07-21  6:19 ` Roman Perepelitsa
2019-07-21  6:20   ` Roman Perepelitsa
2019-07-31 14:25   ` Peter Stephenson [this message]
2019-08-01 21:00     ` 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=1564583126.6561.15.camel@samsung.com \
    --to=p.stephenson@samsung.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).