From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18470 invoked by alias); 5 Sep 2016 15:42:18 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39183 Received: (qmail 10945 invoked from network); 5 Sep 2016 15:42:18 -0000 X-Qmail-Scanner-Diagnostics: from mailout1.w1.samsung.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(210.118.77.11):SA:0(-1.7/5.0):. Processed in 0.434365 secs); 05 Sep 2016 15:42:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: p.stephenson@samsung.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at samsung.com does not designate permitted sender hosts) X-AuditID: cbfec7f5-f792e6d0000013f5-0d-57cd92530969 To: undisclosed-recipients: ; Date: Mon, 05 Sep 2016 16:42:07 +0100 From: Peter Stephenson Cc: zsh-workers@zsh.org Subject: Re: Bug related to stdin/always/jobcontrol Message-id: <20160905164207.4630643b@pwslap01u.europe.root.pri> In-reply-to: <87r392jgd0.fsf@juno.home.vuxu.org> References: <87r392jgd0.fsf@juno.home.vuxu.org> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrNLMWRmVeSWpSXmKPExsVy+t/xK7rBk86GG6z/w2lxsPkhkwOjx6qD H5gCGKO4bFJSczLLUov07RK4Mk7cXMtS0CNS0dCZ28B4nK+LkZNDQsBE4sPcM6wQtpjEhXvr 2boYuTiEBJYySlxdeYYdJCEiICMxd/ZjVojEDCaJKVt2sUM4pxklJh84DuWcYZSY9HghG0gL i4CqRPP/FrC5bAKGElM3zWbsYuTgYBYQl5g9JRAkLCxgLPH57hsWEJtXwF6idVsn2DZOAQOJ d7vWg40REtCXODh7JVicH8i++vcTE8Sp9hIzr5xhhOgVlPgx+R7YHGYBLYnN25pYIWx5ic1r 3jJDzFGXuHF3N/sERpFZSFpmIWmZhaRlASPzKkbR1NLkguKk9FwjveLE3OLSvHS95PzcTYyQ IP+6g3HpMatDjAIcjEo8vBtKz4YLsSaWFVfmHmKU4GBWEuFN6wUK8aYkVlalFuXHF5XmpBYf YpTmYFES5525632IkEB6YklqdmpqQWoRTJaJg1OqgdHSfnMb2wnVhLbbX615/RNW+sfKndir OXvDLhdzb8MM7equrgyvLx4fNbcmP723WX7mk0sl18+Vcj74NtGk7rxmlY/5yoLX9XY+iwKn cKoUHrM+VB9z7OdjRTODmNVlQvnrbvzrKDr3XP+c6+1vZx1166cxxRw/d4gtsWt6t9KDOKsk /WkBdUosxRmJhlrMRcWJAGb0ebNuAgAA On Fri, 2 Sep 2016 20:39:39 +0200 Christian Neukirchen 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