From: "Jun. T" <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: Removing subshell from zargs (see "zargs with -P intermittently failing")
Date: Tue, 31 May 2022 01:33:09 +0900 [thread overview]
Message-ID: <67D8ACEC-3D46-4EC4-9AAD-C508C7097499@kba.biglobe.ne.jp> (raw)
In-Reply-To: <CAH+w=7auHNRoNPrs1NP6kbYu0FWh5jB92QxihxhAULDEjwm_rw@mail.gmail.com>
Sorry I missed this post. And I fear I will not be able to going into
any detail at least for a few days.
> 2022/05/30 5:56, Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> However, I also intermittently get this:
>
> % zargs -n 1 -P 19 -- {1..40} -- f
> % jobs
> [1] running sleep 60
> [9] + done { "${call[@]}"; }
>
> Or even this:
>
> % zargs -n 1 -P 19 -- {1..40} -- f
> %
> [1] done sleep 60
> % jobs
> [9] + done { "${call[@]}"; }
(1) On my Mac, it seems that this does not happen if I start zsh by
'zsh -f' (but I don't know why).
(2) It seems we don't need the extra background job 'sleep 60 &'
to get the problem.
(3) I tried the following dirty patch for debugging:
diff --git a/Src/jobs.c b/Src/jobs.c
index a91ef787f..6e59b5b71 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -2391,7 +2391,8 @@ bin_fg(char *name, char **argv, Options ops, int func)
curmaxjob = maxjob;
ignorejob = thisjob;
}
- for (job = 0; job <= curmaxjob; job++, jobptr++)
+ for (job = 0; job <= curmaxjob; job++, jobptr++) {
+ zwarn("%d %d", job, jobptr->stat);
if (job != ignorejob && jobptr->stat) {
if ((!OPT_ISSET(ops,'r') && !OPT_ISSET(ops,'s')) ||
(OPT_ISSET(ops,'r') && OPT_ISSET(ops,'s')) ||
@@ -2400,6 +2401,7 @@ bin_fg(char *name, char **argv, Options ops, int func)
(OPT_ISSET(ops,'s') && jobptr->stat & STAT_STOPPED))
printjob(jobptr, lng, 2);
}
+ }
unqueue_signals();
return 0;
} else { /* Must be BIN_WAIT, so wait for all jobs */
When the problem occurs, I get:
% zargs -n 1 -P 19 -- {1..40} -- f; jobs
zsh: 0 0
zsh: 1 17504 # thisjob = ignorejob
zsh: 2 0
zsh: 3 0
zsh: 4 0
zsh: 5 0
zsh: 6 0
zsh: 7 0
zsh: 8 2137
[8] + done { "${call[@]}"; }
2137 = 0x859
= STAT_CHANGED | STAT_DONE | STAT_LOCKED | STAT_INUSE | STAT_NOSTTY
maxjob = 8 here, but it should have been decremented to 1?
The only place maxjob is decremented is in freejob(), I guess.
next prev parent reply other threads:[~2022-05-30 16:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-29 20:56 Bart Schaefer
2022-05-30 16:33 ` Jun. T [this message]
2022-05-30 18:39 ` Bart Schaefer
2022-05-30 20:07 ` Bart Schaefer
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=67D8ACEC-3D46-4EC4-9AAD-C508C7097499@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).