zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: undisclosed-recipients: ;
Cc: zsh-workers@zsh.org
Subject: Re: Bug related to stdin/always/jobcontrol
Date: Mon, 05 Sep 2016 16:42:07 +0100	[thread overview]
Message-ID: <20160905164207.4630643b@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <87r392jgd0.fsf@juno.home.vuxu.org>

On Fri, 2 Sep 2016 20:39:39 +0200
Christian Neukirchen <chneukirchen@gmail.com> wrote:
> Stripped down test case for a mysterious loss of child:
> 
> zsh 5.2 (x86_64-unknown-linux-gnu)
> zsh-5.2-0-gc86c20a
> VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 29 2016 13:06:04)
> Included patches: 1-2207
> 
> zsh -f
> juno% v() { { vim - } always { true } }
> juno% ls | v
> ^Z
> zsh: running    v
> juno% fg
> fg: no current job

It looks like the job state is quite seriously challenged.

I think the relevance of the always and stdin is probably that there's
something for the job to fix up after it finishes, so the vim process
can't be fully detached from the subshell it's in.

When fg is run, the state of the job you can see has flags 0x2012:

#define STAT_STOPPED	(0x0002) /* all procs stopped or exited          */
#define STAT_LOCKED	(0x0010) /* shell is finished creating this job, */
                                 /*   may be deleted from job table      */
#define STAT_SUBLEADER  (0x2000) /* is super-job, but leader is sub-shell */

This doesn't have STAT_INUSE, so it's not clear "jobs" should be
reporting it at all.  Adding STAT_INUSE and fg'ing doesn't help; it does
attempt to bring the command to the foreground but then gets stuck and
stays stuck even if the vim command is killed from elsewhere.

pws      27402 25329  7 16:28 pts/1    00:00:01 ./zsh
pws      27423 27402  0 16:29 pts/1    00:00:00 vim -
pws      27425 27402  0 16:29 pts/1    00:00:00 ./zsh

That first ./zsh is the parent shell; I guess 27425 is the subshell
process.

job 3 in the job table appears to be valid and is in use but is marked
as STAT_NOPRINT.  It has status 0x173:

#define STAT_CHANGED	(0x0001) /* status changed and not reported      */
#define STAT_STOPPED	(0x0002) /* all procs stopped or exited          */
#define STAT_LOCKED	(0x0010) /* shell is finished creating this job, */
                                 /*   may be deleted from job table      */
#define STAT_NOPRINT	(0x0020) /* job was killed internally,           */
                                 /*   we don't want to show that         */
#define STAT_INUSE	(0x0040) /* this job entry is in use             */
#define STAT_SUBJOB	(0x0100) /* job is a subjob                      */

I'm guessing what should happen is something like foregrounding the
SUBLEADER job should also foreground the SUBJOB job.  But that doesn't
tell us whether a job that's not INUSE should show up, or why the INUSE
flag is missing in the first place.

pws


  parent reply	other threads:[~2016-09-05 15:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02 18:39 Christian Neukirchen
2016-09-05 15:04 ` Christian Neukirchen
2016-09-05 15:42 ` Peter Stephenson [this message]
     [not found]   ` <CGME20160914173110eucas1p1f0567e319ae439b975b19f4e55676fed@eucas1p1.samsung.com>
2016-09-14 17:31     ` Peter Stephenson
2016-09-14 21:35       ` Peter Stephenson
2016-09-15  3:24         ` Bart Schaefer
2016-09-15  8:27           ` Peter Stephenson
2016-09-15 10:33             ` Peter Stephenson
2016-09-15 17:40               ` Peter Stephenson
2016-09-16  1:08                 ` Bart Schaefer
2016-09-16 12:02                   ` Peter Stephenson
2016-09-22 11:59         ` Daniel Shahaf
2016-09-22 16:38           ` Bart Schaefer
2016-09-23  1:18             ` Bart Schaefer
2016-09-23  6:06               ` Daniel Shahaf
2016-09-25 14:39               ` Peter Stephenson
2016-09-25 22:54                 ` struct job.other (was Re: Bug related to stdin/always/jobcontrol) Bart Schaefer
2016-09-26 11:20                   ` Peter Stephenson
2016-09-26 16:33                     ` Bart Schaefer
2016-09-25 15:16           ` Bug related to stdin/always/jobcontrol 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=20160905164207.4630643b@pwslap01u.europe.root.pri \
    --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).