zsh-workers
 help / color / mirror / code / Atom feed
From: "Jun. T" <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: zargs with -P intermittently failing in zsh 5.9 and macOS
Date: Sat, 28 May 2022 02:25:49 +0900	[thread overview]
Message-ID: <957FB7CE-B2AE-4C22-9CC5-0883B2FAB62D@kba.biglobe.ne.jp> (raw)
In-Reply-To: <CAH+w=7apQ0aN-xUsyAftJZORJ0iRkpO4Q5ZoOOrMcdeJGH_3Qw@mail.gmail.com>


> 2022/05/28 1:10、Bart Schaefer <schaefer@brasslantern.com>のメール:
> 
> On Thu, May 26, 2022 at 10:30 PM Jun T <takimoto-j@kba.biglobe.ne.jp> wrote:
>> 
>> 
>> When 'wait pid' calls getbgstatus(pid), it finds the entry with status=19
>> and returns it.
> 
> Even if it's correct to have two entries, it's wrong to return the
> least recent one.

Yes, of course, so we need to fix it.

>> So I guess we need to call addbgstatus() only if the process has actually
>> exited (or killed). If this is the case, better solution would be
>> (B) call addbgstatus() only if WIFEXITED() or WIFSIGNALED() is true.
>> This it the patch below.
> 
> Does that really work?  I would expect WIFSIGNALED to be true when
> each of WIFSTOPPED and WIFCONTINUED is also true, so it wouldn't
> change anything?  (There isn't any way to stop/continue without using
> a signal that I can think of.)

I've tried A, B, C, and it seems all of them work in the sense that
it solves the current zargs's problem, and 'make check' passes.
But I think A is insufficient, as you write.

I was thinking B is enough, because:
WIFEXITED: has exited spontaneously
WIFSIGNALED: has been killed by a signal
WIFSTOPPED: still alive but now stoeepd
WIFCONTINUED: has been stopped but now continued
So these 4 are mutually exclusive.
In the case of EXITED/SIGNALED, further call of wait3() will not report
the status of the process. So if we call addbgstatus() only for
EXITED/SIGNALED, then it records the final state of the process just
onece. How do you think?  Do you have a Mac for testing?

Or we can use both B and C, and add a DPUTS() if addbgstatus() is
called more than once for a single pid.

  reply	other threads:[~2022-05-27 17:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24 16:09 Eric Nielsen
2022-05-24 17:32 ` Bart Schaefer
2022-05-24 20:21   ` Eric Nielsen
2022-05-24 20:35     ` Bart Schaefer
2022-05-26  8:57   ` Jun T
2022-05-26 11:21     ` Jun. T
2022-05-27  3:39     ` Bart Schaefer
2022-05-27  4:18       ` Lawrence Velázquez
2022-05-27  5:29       ` Jun T
2022-05-27 16:10         ` Bart Schaefer
2022-05-27 17:25           ` Jun. T [this message]
2022-05-29  3:30             ` Bart Schaefer
2022-05-29 14:47               ` Jun. T
2022-05-29 20:07                 ` Bart Schaefer
2022-05-30 11:16                   ` Jun T
2022-06-07  6:51                     ` Jun T
2022-06-09  2:56                       ` Bart Schaefer
2022-06-12 16:43                 ` Eric Nielsen

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=957FB7CE-B2AE-4C22-9CC5-0883B2FAB62D@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --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).