Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug related to stdin/always/jobcontrol



On Thu, 22 Sep 2016 18:18:47 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> However, in attempting to figure it out, I found some sixteen-year-old
> code that is clearly wrong:
> 
> diff --git a/Src/exec.c b/Src/exec.c
> index d924148..bf97b5c 100644
> --- a/Src/exec.c
> +++ b/Src/exec.c
> @@ -1702,7 +1702,7 @@ execpline(Estate state, wordcode slcode, int how, int last1)
>  			    jobtab[list_pipe_job].other = newjob;
>  			    jobtab[list_pipe_job].stat |= STAT_SUPERJOB;
>  			    jn->stat |= STAT_SUBJOB | STAT_NOPRINT;
> -			    jn->other = pid;
> +			    jn->other = list_pipe_job;
>  			    jn->gleader = jobtab[list_pipe_job].gleader;
>  			}
>  			if ((list_pipe || last1) && hasprocs(list_pipe_job))
> 
> jn->other is a job table index, not a process ID.

The code's correct as it stands (modulo problems setting the values it's
using) --- read my previous explanations and the updated comment in
zsh.h about "other" which now explicitly states this is a pid if the job
is a SUBJOB.  "other" could perhaps be a union to indicate this.

pws



Messages sorted by: Reverse Date, Date, Thread, Author